Você está na página 1de 11

Introduction to SAP enhancements

SAP is a ERP software in which all standard business applications are delivered, sometimes
customer may need to alter existing functionality or add additional functionality to the existing
applications based on customer business requirements.

Enhancements concept
The enhancement is a concept of adding your own functionality to SAP's standard business
applications without having to modify the original applications. To modify the standard SAP
behavior as per customer requirements, we can use enhancement framework.

Types of enhancements in SAP


User Exits
Initially SAP implemented enhancements in the form of User Exits and these are only available in
SD module, user exits are implemented in the form of subroutines and hence are also called as
FORM EXITS, User exits are empty subroutines that SAP developers have provided for you, you
can add your own source code in the empty subroutines.
All user exits starts with the word USEREXIT.
Customer Exits
These are one type of enhancements that are available in some specific programs, screens and
menus within standard SAP Applications. These are Function Modules with a custom empty include
program, you can add your own functionality in these include programs.
Customer Exits are available in all SAP modules, whereas user exits are only available in SD
module.
All customer exits ( Function Modules) starts with CALL CUSTOMER word.

User Exits in SAP


These are implemented in the form of subroutines and hence are also known as FORM EXITs. The
user exits are generally attached to the standard program by the SAP.
User exits are a type of system enhancement that was originally developed for the R/3 SD (Sales
and distribution) module.
User-exits are empty subroutines that SAP Developers have provided for you.
You can fill them with your own source code. Technically this is a modification.
All User exits start with the word USEREXIT_...FORM USEREXIT_XXXX....ENDFORM.
User exits can be found in the following ways:
Go to Object Navigator (SE80), select Package and put VMOD (Application development R/3 SD
customer modification) and press enter. You will find all the includes for user exits in SD. You will
get User exits for Sales order, Delivery, Billing, Pricing etc. Most of the time documentation is
maintained for each subroutine which helps developer for better understanding of the subroutine.
Select the subroutine according to the requirement and start coding within the subroutine.
Examples:
- In User exits MV45AFZZ(Sales Order Exit), we have subroutine
USEREXIT_PRICING_PREPARE_TKOMK
USEREXIT_PRICING_PREPARE_TKOMP
This user exit can be used to move additional fields into the communication table which is used for
pricing. TKOMK for header fields and TKOMG for item fields. The fields which are not in either of
the two tables KOMK and KOMP cannot be used in pricing.
-In User exits MV50AFZ1(Delivery Exit), you have subroutine
USEREXIT_SAVE_DOCUMENT_PREPARE
This user exit can be used for changes or checks, before a document is saved.

Customer Exits in SAP


SAP creates customer exits for specific programs, screens, and menus within standard applications.
These exits do not contain any functionality. Instead, the customer exits act as hooks. You can hang
your own add-on functionality onto these hooks.
Customer exits are nothing but a include in customer name space will be provided in the function
module which starts with CALL CUSTOMER. You can fill them with your own source code.
Technically this is an enhancement. User exits generally refer to SD module while customer exits
refer to all modules like MM, SD, PP, FICO etc.
Advantages of Customer Exits:
- They do not affect standard SAP source code .
- They do not affect software updates .
Disadvantages of Customer Exits:
- Customer exits are not available for all programs and screens found in the SAP System. You can
only use customer exits if they already exist in the SAP System.

Types of Customer Exits


1. Function Module exits.
2. Screen exits.
3. Menu exits.
1. Function Module exits.
Function module exits are exits developed by SAP. The exit is implemented as a call to a function
module. The code for the function module is written by the developer. You are not writing the code
directly in the function module, but in the include that is implemented in the function module.
Format: CALL CUSTOMER-FUNCTION '910' The naming standard of function modules for
function module exits is:
EXIT__<3 digit suffix>.

Examples: Function Module Exits: EXIT_SAPMF02K_001.


2. Screen Exits:
Allow customer to add fields to a screen via a sub screen in an SAP program. The sub screen is
called within the standard screen's flow logic. For this we need to implement FM Exits/Menu Exits
to write the logic for Screen Exits . All screen exits will be subscreens.
3. Menu exits:
Menu exits allow you to add your own functionality to menus. Menu exits are implemented by SAP
and are reserved menu entries in the GUI interface. The developer can add his/her own text and
logic for the menu.
Function codes for menu exits all start with "+". Format: +CUS (additional item in GUI status)

Methods to find out customer Exits:


There are numbers of way by using we can find out Customer Exits.
Enhancement : It is a group or container of the FM exits/Menu Exits/Screen Exits .
Project: It is an SAP Object which contains list of Enhancements. A project must be created for
each enhancement so that the corresponding exits in an enhancement will be in active state.
So, A project is group of Enhancements An Enhancement cannot be linked to more than one
project. It throws error CMOD is the Tcode for creating a project.

Finding customer exit with CALL CUSTOMER


We know every transaction is linked to a program, all customer exits(Function Modules) inside
programs starts with CALL CUSTOMER, so we can use CALL CUSTOMER to find them.
Example of finding customer exit for VA01 T-code
VA01, is a t-code used for creating sales order, to find customer exit for VA01, go to t-code VA01,
system, status.

A pop up will open, you can find the program name, copy the program name and go to SE38,
display ( simply double click to go to program source ).
Once you go to program source, click on find icon.

A pop up will open, search for the word CALL CUSTOMER in main program.
You will find the list of Function Modules with the word CALL CUSTOMER.
Double click on function module CALL CUSTOMER-FUNCTION '911', you can see a include
'INCLUDE ZXOIKU46', that`s where you can implement your own functionality .

User exit real time business example SAP


Business Requirement: When ever business user creates a delivery order, the standard SAP
application dose not check for storage location (whether it is space or not ), if it is space it should
raise a error message.

VL01 is the t-code for creating a deliver order, this uses standard SAP program SAPMV50A, the
standard program don`t check for storage location equal to space or not.
As per the requirement we need to find a suitable user exit for this and we need add additional code
to check storage location.
Technical information : Storage location field is LGORT and it is available in LIPS table.
To implement the user exit for this we need to follow the below steps.
Step1: Find the user exit.
Step2: Verify the user exit.
Step1: Implement the user exit.

Find the User exit


Go to transaction VL01N, System-Status

A pop up will open ans double click on program name.

Click on Find icon, select main program, find 'userexit' and press enter.

You will find number of performs.

Verify the user exits for suitable exit


Choose some exits based on descriptions .
You'll have to roughly decide which is the correct user exit routine to used. So, For my requirement
I used the below user exit.
USEREXIT_SAVE_DOCUMENT_PREPARE : Use this user exit to make certain changes or
checks immediately before saving a document. It is the last possibility for changing or checking a
document before posting.
So,Double click on the user exit FORM USEREXIT_SAVE_DOCUMENT_PREPARE, put break-
point inside the form.
Now go to table LIPS, display, get a deliver no and go to VL02N (T-code for changing deliver
order), provide delivery order no and enter.
Cahnge any value ex: delivery quantity and save.

click on Save (Ctrl S), debugger will open..now this is the suitable exit.

Implement user exit


To implement user exit we need access key from SAP, when we get access key from SAP, write
below code inside from.
If lips-lgort = ' ' . "check if storage location is initial
Message 'Storage location is mandatory field' TYPE 'E'. "error message
Endif .

Save, Activate and test.

Customer exit real time business example SAP


Business Requirement: When ever we create a customer. We need to check weather the customer
belongs to Country : GERMANY and if Region is equal to space .Then, Raise an Error message.
For this requirement we need to implement Function Module exit.

Technical requirements:
Tcode is : XD01/ XD02/ XD03.
Country Field is : LAND1 .
Region Field is : REGIO.
Table name is : KNA1 .
The above tables and fields are given by functional consultants.
To implement the Customer exit for this we need to follow the below steps.
Step1: Find the function exit.
Step2: Verify the customer exit.
Step1: Create project for customer exit.
Step4: Implement the Customer exit.

Find the function exit


Go to SE93 (maintain Transaction) T-code, provide XD01, display.

Double click on Program name SAPMF02D.Click on Find icon, main program, find CALL
CUSTOMER, enter.
A list of call customer functions will be displayed.
Based on requirement, Check Import/Export Parameters for each Function Module And roughly
select some Customer Function Modules .

As per this requirement, we need KNA1 Table details, So we can use the below Customer Function
Module which has an exporting parameter I_KNA1.

Verify the Customer Exit


Then verify the customer exit (function module) wheather it will full-fill requiremnt.
Double click on Function module name and put the break point .
Go to SE11-KNA1-Display, get a customer and go to XD02.

Provide a customer, save (Ctrl S ), wait for breakpoint to trigger.

Stop the Debugging and now implement the Functional Module Exit. As this exit is triggered, this is
the suitable Functional Module Exit for our requirement.

Create Project in CMOD to implement customer exit.


Go to T-code CMOD (Project Management), provide a project name, create.

To implement we need to provide enhancement name but we don`t have enhancement name, we just
have customer exit name, now we need to find enhancement name.
Follow the below steps to find enhancement for a customer exit.
All the enhancements for customer exits will be stored in MODSAP table, we can get enhancement
name by using our customer exit.
Get Function module name from customer exit, double click on CALL CUSTOMER FUNCTION
'001'.

Not down the Function Module name, go to SE11, provide table name MODSAP, display, contents
and provide enhancement/member as EXIT_SAPMF02D_001, execute.

You will find the enhancement name for the function exit.

Now go to CMOD and to project ZXD01_EX and click on enhancement assignments and add
enhancement as SAPMF02D, enter and click on components.
You will find Function module name, double click on function exit.

You will find a include inside the function module, double click to create and add your own code.

And add below code.

Click BACK, activate Function Module.


Again click BACK,

Exit is implemented, test the object.


Go to XD02 .
Enter a Customer
Change Country to DE and Region to space .

We will get a error message.


Difference between user exit and customer exit
in SAP

Você também pode gostar