You are on page 1of 20

Enhancements in SAP

SAP enhancements to enhance standard SAP objects using


ABAP programming
Enhancing standard SAP applications using SAP enhancements
SAP is a ERP software in which all standard business applications are delivered, some times
customer may need to 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, where as user exits are only available in SD
module.
All customer exits ( Function Modules) starts with CALL CUSTOMER word.

User Exits in SAP


Enhancing SAP standard applications using user exits
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


Using customer exits to enhance standard SAP applications
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_<program name>_<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 userexit 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 userexit for this we need to follow the below steps.
Step1: Find the userexit.
Step2: Verify the userexit.
Step1: Implement the userexit.

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 userexits for suitable exit


Choose some exits based on descriptions .
You'll have to roughly decide which is the correct userexit 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 breakpoint 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 userexit
To implement userexit 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
User Exit

Customer Exit

User exit is implemented in the form of a


Subroutine i.e. PERFORM xxx.
PERFORM userexit_save_document_prepare.

A customer exit can be implemented as:

Function exit
Screen Exit
Menu Exit
Field Exit

Example: CALL Customer function "XXX"


INCLUDE ZXXX. ."create and add logic
In case of a PERFORM, you have access to
almost all the data. So you have better control, but
more risk of making the system unstable.

You have access only to the importing,


exporting, changing and tables parameter
of the Function Module. So you have limited
access to data.

User exit is considered a modification and not an


enhancement because we are changing the
existing code.

A customer exit is considered an


enhancement because we are adding
additional functionality to the existing
one..not changing any thing.

You need Access Key for User Exit.

You do not need access key.

Changes are lost in case of an upgrade.

Customer exits came later and they


overcome the shortcomings of User Exit.

User Exit will be activated automatically when ever


you activate the application(program).

To activate a function exit, you need to


create a project in CMOD and activate the
project.

You might also like