0% found this document useful (0 votes)
267 views39 pages

Enhancements in Sap Abap

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
267 views39 pages

Enhancements in Sap Abap

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 39

1

Enhancements
 This concept is used to add additional customer specific functionalities to the standard
applications or programs or transaction codes.

Following are the different enhancements techniques or methods.

1. Customer Exits.
2. Business Transaction Events (BTE).
3. Enhancement frame work.
4. User Exits.
5. Business ADdIns (BADI).
6. Functional Routines

1).Customer Exits:

 Customer Exits are available in most of the functional areas such are SD- Sales and
Distribution, Material Management (MM), Finance and Controlling (FI/CO)…. Etc.
 They are used to add the additional functionalities in the standard applications or
programs, without using access key to break them.

Access key:

It is the unique key provided by the basis consultant or SAP People to break the standard
applications or programs.
 The application or program will become custom development once they are
broken.

Following are the different types of Customer Exits.

a) Field Exits.
b) Function Exits.
c) Menu Exits.
d) Screen Exits.

a).Field Exits:

They are used to change the field labels of the standard data elements.

b).Function Exits:

Document prepared By Sonu Jangir SAP ABAP


2

They are used to add an additional functionality to the standard applications or program without
breaking them.

 Each Function Exit contain a custom include program which starts with Z* to implement
the customer specific additional business logic.
 The Function Exit is the three digit number which is called using the ABAP statement
CALL CUSTOMER_FUNCTION.

Ex:

*Function Exit

CALL CUSTOMER_FUNCTION ‘<XXX>’

IMPORTING

im_param =

..

TABLES

FUNCTION <funct_exit_name>.

Z<INCLUDE_NAME>

* Define include with Additional Custom Business Logic

SELECT….

ENDFUNCTION.

Note: In the real time we mostly work with function exits.

c).Menu Exits:They are used to add the custom specific menu items and corresponding
additional functionality based on the selected menu item.

d).Screen Exits: They are used to add the additional screen elements and the corresponding
additional functionality to the standard screens, or application or transaction codes.

 The T-Code SMOD and CMOD is used to work with the Customer Exits.

T-Code SMOD: It is used to find the Customer Exits of the standard package.

Document prepared By Sonu Jangir SAP ABAP


3

T-Code CMOD: It is used to assign the enhancements or exit to a project to record the
changes, activate and de-activate the enhancements.

Note: It is not possible to assign an enhancement or exit to more than one project.

Different ways to find Exits:  Following are different ways to find Exits.

1) Using the Package name of the applications.


2) Using the T-Code “SE84”.
3) Using the find function in standard programs.
4) Using the standard tables MODSAP and MODACT.

1). Steps to find Exits using Package:

a)Finding Packages:

 Execute the required T-Code or application.

Ex: VA02/VL02.

 Click on system menu item.


 Click on status and double click on the program name (screen).
 Click on ‘Go to’ menu item.
 Click on attributes.

Note:  The corresponding Package name is displayed in the package field.

b) Finding Exits using T-Code SMOD:

 Execute the required T-Code SMOD.


 Click on utilities menu item.
 Click on find.
 Enter the above found package.

Ex: VA/MGA…

 Click on execute.

Note:  All the corresponding of the Package are listed.

Document prepared By Sonu Jangir SAP ABAP


4

 Find an accurate exit by understanding the system given short description or by using an
trial and error method by activating the exits and perform the required action.

2). Steps to find Exits using the T-Code SE-84:

 Find the package name of the required T-Code.


 Execute the T-Code SE84.
 Expand enhancement folder.
 Double click on enhancements.

Note:  An item project is used to find the enhancements of the projects.

 Enter the required package name or Exit name.


 Click on execute icon.

Note: 1).All the corresponding Exits are listed.

2) Find the correct exit by analyzing the system given short text or by using

Trialand Error method.

3). Steps to find Exits using the find function:

 Execute the required T-Code (Ex: MM01/VA01….).


 Click on system menu item.
 Click on status.
 Double click on the screen program name.
 Click on find icon.
 Enter the find string as CALL CUSTOMER_FUNCTION.
 Press enter button.

Note:  All the Exits which are called using the statement

CALL CUSTOMER_FUNCTION are listed.

 Double click on the required found location.


 Set a session break points.

Note:  Set the session break points for all the found locations up to 30 only at a time.

 Perform the required action in the T-Code to stop the correct Exits.

Document prepared By Sonu Jangir SAP ABAP


5

4). Using the standard table MODSAP and MODACT:

 The standard table MODSAP or MODACT can also be used to list out the enhancement
projects.

Scenario on Field Exit:Change the field table of the standard data element DWERK_EXT –
Deliver plant in the T-Codes VA01,VA02,VA03.

Steps to change the Field label in the standard application:

 Execute the required T-Code Ex: VA02/…


 Enter the document or order number.
 Press enter button.
 Place a cursor on required field.
 Press F1 function key.
 Click on technical information icon.
 Copy the data element name.
 Execute the T-Code CMOD.
 Click on GOTO menu item.
 Click on text enhancements.
 Click on key words.
 Click on change.

Note:  An option “Data elements” is used to change the documentation of the standard data
Elements.

 Paste or enter the required data element name DWERK_EXT.


 Click on yes button.
 Change the field labels.
 Click on save icon.
Ex:- Deliver plant  Del.plant.
 Create the transport request number by pressing create request icon.
 Click on yes button.
 Cancel the change key words window.

Note:  Check the change field label by executing required T-code.

Scenario on Function Exit:

Hiding the attributes of an executable program in the T-Code “SE38” -Attributes.

Steps to find exact Exits:

Document prepared By Sonu Jangir SAP ABAP


6

1. Find an appropriate package name of the required T-Code or an application.

Ex: Package for attributes is SE38 is SEDT.

2. Finding Exit:
 Execute the T-Code SMOD.
 Click on utilities menu item.
 Enter the required found package name.
Ex: SEDT/MGA/VA…..
 Click on execute icon.
 Click on find icon.
 Enter the required find string.
Ex: Attributes/check/save/function.
 Press enter button.
 Copy the font Exit names by pressing (Ctrl + Y).
 Cancel the find windows.
 Click on back.

3. Project Creation - CMOD:


 Execute the T-Code CMOD.
 Enter the project name (ZB20_PRJ).
 Click on create button.
 Enter short text.
 Click on enhancement assign button.
 Click on yes button.
 Enter the package name.
 Click on save icon.
 Create the TR-Transport request number by pressing an icon create request.
 Click on yes button.
 Paste or enter the found Exit name.

Note:  The exit cannot be assigned more than one project.

 Press enter button.


(Ex: SEU00001 – Fonction Exit in program attributs)
 Click on components button.
 Click on yes button.
 Click on activate icon.

Note: 1.Color of the traffic light will become green, once the project is activated.

Document prepared By Sonu Jangir SAP ABAP


7

Red – Inactive.

Green – Active.

2. The tick marks are appeared under Impl.Column once the Exits areImplemented.

 Double click on function Exit names.


 Double click on the system provided Z* include name.
 Press enter button for the first time.
 Click on yes button.
 Enter the package name.
 Click on save icon.
 Create the TR if required.
 Click on yes button.
 Write any statement to get the Exit stop in the debugger.
Ex: BREAK <OASIS>.
 Activate include program.
 Click on back icon.
 Click on back icon to come out of the function module Exit.

Note:  Follow the similar steps to implement any number of Exits by double clicking on
them.

4. Finding Exact Exit:


 Execute the required T-Code.
Ex: SE38/MM02/….
 Perform the required action.
Ex: AttributesDisplay/Save/Delete.

Note: An accurate/Exact exit is stopped in debugger.

5. Implementing the required Business logic in the found Exit:


 Execute the required T-Code - CMOD.
 Enter the required project name (ZB20_PRJ).
 Click on display button.
 Click on components button.
 Double click on the required Exit name.
 Double click on the include program name.
 Click on display or change icon.
 Implement the required business logic as per the specification.

Document prepared By Sonu Jangir SAP ABAP


8

 Activate the include program.


Ex: *Additional business logic.
<If program EQ ‘ZB21_ALV_GRID_LIST’.
MESSAGE ‘Attributes are Hidden’ type ‘I’.
LEAVE SCREEN.
ENDIF.>

6. Test the Scenario:

 Execute the required T-Code SE38/MM02/ME22N…


 Enter the required data.
Ex: Program name/Doc.No./…
(ZB21_ALV_GRID_LIST)
 Perform the required action.
Ex: Select Attributes  Display/Save/Enter.

Note:  An information message is given as ‘Attributes are hidden’ from the implemented
function Exit.

Scenario on MENU Exits:  Add an additional custom menu item and the corresponding
additional functionality to the standard T-Code MC94 – Change plan.

1. Find Package name: 

 Execute the T-Code MC94.


 Click on system menu item.
 Click on status.
 Double click on screen program name.
 Click on GOTO menu item.
 Click on Attributes.
 Copy the package name (MCP2).

2. Find Exits:

 Execute the T-Code SE84/SMOD.


 Expand enhancements folder.
 Expand customer exit folder.
 Double click on enhancements.
 Enter or paste the required package name (MCP2).

Document prepared By Sonu Jangir SAP ABAP


9

 Click on execute icon.


 Click on find icon.
 Enter an appropriate find string (function).
 Press enter.
 Copy an appropriate found exit name.
Ex: MCP20003

3. Project Creation:

 Execute the T-Code- CMOD.


 Enter the Project name (ZB20_PRO).
 Click on Create button.
 Enter short text.
 Click on enhancements assignments button.
 Click on yes button.
 Enter the package name.
 Click on save icon.
 Create the TR by pressing create request icon.
 Click on yes button.
 Enter/Paste the required Exit name.
 Press enter button.
 Click on components button.
 Click on yes button.
 Click on activate icon to activate the Exits.

Note: 1.An Icon undo activation is used to de-activate the enhancement project.

2. Click on back icon then use activate icon in case of not appeared in the

Components Screen.

 Double click on any one of the function codes such as +CU1,+CU2….


 Enter function text, icon text, icon text, info text … etc.
 Click on yes button.
 Click on yes button.
 Double click on the corresponding function Exit name to add an additional functionality
when the custom menu is pressed.
 Double click on the custom include program name.

Note:  Press enter button then create an include program name for the first time.

Document prepared By Sonu Jangir SAP ABAP


10

 Implement the required additional interactive functionality (as per the specification).
Ex: -- *Additional Interactive Business logic.
 IF i_fcode EQ ‘+CU2’.
CAL TRANSACTION ‘SE11’.
END IF.
 Click on pretty printer button.
 Click on Activate icon.
 Press enter andClick on Back.

4. Test the Scenario:

 Execute the required T-Code (Ex: MC94).


 Enter the required data.
o Ex: Planning type: REPL.
 Press enter button.
 Click on activate version button or perform the required action.
 Click on extras menu item.
 Click on customer functions.
 Click on the required additional custom menu item.

Note:- The additional functionality such as call another T-code (SE11) is happened

From the Implemented menuexit and function exits.

Scenario on Screen Exits:  Add the additional screen fields with the transaction code MP01
(Maintain Approved manufacture parts).

Common steps involved in Screen Exits:

1. Find the corresponding screen exits of an application or T-Code by using the


corresponding package name.
2. Add the additional fields to the corresponding structure which stars with CI* or standard
tables by appending a structure.
Ex: CI_AMPL/…
3. Define the screen or sub screen of the screen Exit with required additional fields by
creating the enhancement projects.
4. Provide the additional functionality to pass data to the database tables, provide Search
help and etc using corresponding in exit or flow logic of the screen in the screen exit.

Steps to work with Screen Exits:

Document prepared By Sonu Jangir SAP ABAP


11

1. Find Screen Exit using the package :

 Once the package name of the application or T-code is found then execute SMOD.
 Click on utilities menu item.
 Click on find icon.
 Enter the required found package name (ME).
 Click on execute icon.
 Click on find icon.
 Enter appropriate find string (screen).
 Press enter button.
 Click on required found string.
 Read the system given short text.
 Copy the found exit name.

2. Add additional fields by appending structure or by CI* structure: 

 Once the required standard table or table is in display mode.


Ex: AMP1/MARA/….
 Double click on a structure which starts with CI*.
Note: -- Use append structure button in case of the CI* structure does not exit.
 Click on yes button.
 Enter short description.
 Define the required fields such as MATKL (Material Group)… etc.
 Activate the CI* structure.
 Click on back.

3. Enhancement project creation:

 Execute T-Code CMOD.


 Enter the project name.
 Click on create button.
 Enter short text.
 Click on enhancement assignment button.
 Click on yes button.
 Enter the package name.
 Click on save icon.
 Create the TR by pressing create request icon.
 Click on yes button.
 Enter or paste the required enhancement name (AMPL0001)- (user sub screen for
additional data on AMPL).

Document prepared By Sonu Jangir SAP ABAP


12

 Click on components button.


 Click on activate icon to activate enhancement project.

Note: -- Activate and Deactivate project in an initial screen of CMOD if they are not appeared.

 Double click on the system provided sub screen number of screen exit.
 Press enter button.
 Enter short description.
 Click on layout button.
 Click on dictionary or program fields windows (F6).
 Enter the required table or structure name.
Ex: AMPL
 Select the required additional field.
Ex: MATKL
 Press enter button.
 Place if on the screen by pressing left mouse button.
 Click on activate icon.
 Enter the package name.
 Click on save icon.
 Click on yes button.
 Click on the button maintain original language.
 Click on back.
 Click on flow logic and add the additional functionality.
Note: -- Use the system provided for exits.
 Make sure the screen type ‘Sub screen’ is selected under attributes tab while defining
the sub screen.

4. Test the Scenario:

 Execute the required T-Code MP01.


 Enter the document number (material number).
 Press enter button.
 Double click on any one of material number.
Note: -- The additional custom fields are appeared o standard screen.

BTE—Business Transaction Events:

Document prepared By Sonu Jangir SAP ABAP


13

The Business Transaction Events are also called Source code plug-ins to add an additional
functionality in the standard program or T-Code.

 Each BTE is linked with the system provided interface to which the custom function
module can be assign.
 The BTE are called using the function
OPEN_FI_PERFORM* and OUTBOUND_CALL*.

Ex:--
 Standard program.
.
CALL FUNCTION ‘OPEN_FI_PERFORM
(or) OUTBOUND_CALL’…
BTE-0001490

ZCUSTOM_FUNCTION
 The T-Code BERE and FIBF are used to work with BTE’s.

T-Code BERE: It is used to find the BTE’s.

T-Code FIBF: It is used to work with the BTE’s.

Scenario on BTE: It gives an information message while saving the vendor data (or) sends a
purchase order as a PDF attachment to an Email of the vendor.

T-code—XK02/XK01

Tables – LFA1/LFB1

Find BTE:

 Execute the T-code BERE.


 Click on execute icon.
 Click on find icon.

Document prepared By Sonu Jangir SAP ABAP


14

 Enter a appropriate find string.


Ex: Vendor/Customer/Material.
 Press enter button.
 Close the find window.
 Double click on the required found ‘BTE’.
Ex: 00001420 – VENDOR
 Click on sample module button.
 Click on copy icon.
 Change two function module names and enter the function group name.

Ex: FROM FM: SAMPLE_INTERFACE_00001420

TO FM: ZB20_CUST_INTERFACE_00001400

Function group: ZB20_FUN_GRP.

 Click on yes button.


 Press enter button.
 Enter the copied interface name/Fm name.
 Click on change icon button.
 Implement the required additional business logic as per the specification.
Ex: *Implement additional customer specific business logic.

*Give message.

MESSAGE ‘Vendor saved successfully’ TYPE ‘I’.

*Implement Print program.

*Submit ZB20_PRINT _PROGRAM VIA SELECTION-SCREEN.

 Click on Pretty Printer button.

Note: -- Make use of the parameters of an interface or function module to provide an additional
logic.

 Click on activate icon.

Note: -- The menu path EnvironmentInfo system (process)

In the T-Code FIBF can also be used to find BTE’s.

Steps to assign the custom interface or function Module to BTE:

Document prepared By Sonu Jangir SAP ABAP


15

1. Create Product:

 Execute T-Code FIBF.


 Click on setting menu item.
 Click on products.
 Click on ‘of a customer’.
 Click on new entries button.
 Provide the product details.

Product Text RFC Destination A


ZB20_PRD Product for BTE in 
Vendor Master
 Click on save icon.
 Create a customizing request to save the table entries of TBE24.
 By pressing create request icon.
 Click on yes button.
 Click on back icon.

2. Assign a custom interface or function module to BTE:

 Click on settings menu item in an initial screen of FIBF.


 Click on PS modules.
 Click on ‘of a customer’.
 Click on new entries button.
 Provide the required details.

Event Product CTR Appl Function module


00001420 ZB20_PRD ZB20_CUST_INTERFACE_00001420

 Click on save icon.


 Create the customizing request to save the table contents of a table ‘TBE34’ by
pressing create request icon.
 Click on yes button.
 Click on back.

3. Test the Scenario:

 Execute the required T-Code.


Ex: XK02
 Enter the document number or vendor/Customer no.

Document prepared By Sonu Jangir SAP ABAP


16

 Check the check box address in case of vendor.


 Press enter button.
 Change any data.
 Click on save icon or perform the required action.

ENHANCEMENT FRAME WORK:

 It is an advanced enhancements concept introduced from the version ECC6.


 It is used to attach or hook the source code plug-ins such as enhancements section or
enhancements points in the standard programs.
 Following are the different types of enhancements frame work.
1. Implicite Enhancement Section (or) point.
2. Explicit Enhancement Section (or) point.

1. ImplicitEnchantement Section (or) point:

 They are provided implicitly at the particular locations by SAP.


 They are mostly presented at the beginning and end of the subroutines (FORM ….
ENDFORM), beginning and end of the function modules, beginning and end of the
programs etc.

2. Explicit Enchantement Section (or) point:

 They are pre coded by SAP and provided at the specific location in the standard
programs.
 There are two types of Explicit Enhancement.
1. ENHANCEMENT-SECTION.
2. ENHANCEMENT-POINTS.

1. ENHANCEMENT-SECTION:

 It is used to copy, change the existing standard source code and add additional business
logic to the standard program.
 The ABAP statement ENHANCEMENT-SECTION is used to specific the enhancement
sections.

2. ENHANCEMENT-POINT:

 It is used add or plug-in the additional customer specific business logic to the standard
program.

Scenario on Implicit Frame work:

Document prepared By Sonu Jangir SAP ABAP


17

Make the physical file path name in the standard migration program.

RMDATIND – Migrates Material Master Data.

Steps to work with an Implicit Frame work:

 Once the standard program is in display mode.

Ex: RMDATIND/etc.

 Click on enhance icon (spiral icon).


 Click on edit menu item.
 Click on enhancement operations.
 Click on show implicit enhancement options.

Note:-- The system inserts the double coated lines (“ ” ” ”) in the certain locations in the
standard program.

 Right click on the system inserted double coated line at the required location such as
beginning of the program or end of the program or end or beginning of the subroutine…
etc.
 Click on enhancement implementation.
 Click on create.
 Click on create enhancement implementation icon (F8).
 Enter the enhancement implementation name.
 Enter short text.
 Click on yes button.
 Enter the package name.
 Click on save icon.
 Create TR by pressing create request icon.
 Click on yes button.
 Select the created enhancement name.
 Click on yes button.
 Implement the required customer specific additional business logic within the system
generated statement.
 Ex: -- “”””””””””””””””””””””””””””””””””””””””””””””””
ENHANCEMENT <n><ZB20_IMPLICIT_ENHANCEMENT>
*Implement customer specific additional business logic
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN OUTPUT.

Document prepared By Sonu Jangir SAP ABAP


18

LOOP AT SCREEN.
IF SCREEN-NAME = “%%%_PHY”.
SCREEN-REQUIRED = ‘1’.
MODIFY SCREEN.
EXIT.
ENDIF.
ENDLOOP.
ENDENHANCEMENT.
 Click on activate enhancement buttons.
 Press enter button.

Note:-- Test the scenario by executing the required T-Code or program.

Scenario on Explicit Enhancement Frame work:

 Change the default value for an input field “Transactions per commit unit from 500 to
1000” in the standard report (RMDATIND) material master data upload.
 Once the standard program is in display mode.
 Right click on the system provided explicit enhancement section or point.
 After an icon enhance is pressed.
 Click on enhancement implementation.
 Click on create.
 Click on create enhancement implementation (F8).
 Enter enhancement implementation name.(ZB20_EXPLICIT_ENHANCEMENT)
 Enter short description.
 Click on yes button.
 Click on save icon.
 Create the TR by pressing create request icon.
 Click on yes button.
 Select the created enhancement implementation name.
 Click on yes button.
 Implement the required customer specific additional business logic.
Note:-- Change the existing standard source code in case of enhancement section.

Sample:

ENHANCEMENT-POINT BMVDEF00_03 SPOTS ES_RMDATIND

Document prepared By Sonu Jangir SAP ABAP


19

“or ENHANCEMENT-SECTION

*$*$....start : BMVDEF00_03….

ENHANCEMENT 30 ZB20_EXPLICIT_ENHANCEMENT

*Implement additional logic

MAX_COMM = 1000.

ENDENHANCEMENT.

 Click on activate enhancement button.


 Press enter button.

Note:-- Test the scenario by executing the required T-Code or program.

USER EXITS

Document prepared By Sonu Jangir SAP ABAP


20

 These are the subroutines in the standard include programs.


 The user exits are mostly used in sales and distribution (SD) and rarely used in other
functional areas.
 The access key is required to break the standard include program of the user exits for the
first time.

Note:The enhancement frame work is advanced to user exits for adding an additional
functionality without breaking the standard programs.

 The user exit names start with “User Exit*”.


Ex:- Most of the user exit in SD starts with
MV-MV45AFZZ, MV45AFZA

Scenario on USER Exits:

Give an information message while saving the sales order.

Steps to list out the USER Exits using T-Code SPRO:

 Execute T-Code SPRO.


 Click on SAP reference IMG button.
 Expand the required functional area (SD-Logistics etc).
 Expand system modifications.
 Expand the required enhancement type such as User Exits/BADI’s (or) BTE’s …..etc.
Note: The T-Code SPRO can also be used to list out the BADI’s routine …. Etc.
 Expand an appropriate functional sub area user exits. Ex: User exits in sales.
 Click on an icon IMG activated documentation to know more about a user exit.
 Click on execute icon that appears beside the documentation icon.
Note: In the real time the user exit names are given in the specification.

Steps to work with an User exit using frame works:

 Execute the T-Code SE38.


 Enter the required standard include program name Ex: MV45AFZZ.
 Click on display button.
 Click on find icon.
 Enter the required find string (Save/Change/Delete)…
 Press enter button.
 Double click on the required found user exit.

Document prepared By Sonu Jangir SAP ABAP


21

Ex:- USEREXIT_SAVE_DOCUMENT.
 Click on (spiral icon) enhance icon.
 Click on edit menu item.
 Click on enhancement operators.
 Click on show impact enhancement options.
 Right click on the system generated double quoted lines (Implicit enhancement spots).
 Click on enhancement implementation.
 Click on create.
 Click on code button.
 Click on create implementation enhancement.
 Click on yes button.
 Add additional business logic/functionality in between the system generated statements.
(ENHANCEMENT…. ENDENHANCEMENTS) .
FORM USEREXIT_SAVE_DOCUMENT
FORM USEREXIT_SAVE_DOCUMENT Implicitenhancement spot.
<ENHANCEMENT 315 ZB20_SD_FRAMEWORK>.
*Additional customer specific business logic or functionality.
MESSAGE ‘Sales Document Saved Successfully ’TYPEI’
END ENHANCEMENT
END FORM.
 Click on active enhancement button.
 Press enter button.
 Click on back.

Test the scenario:

 Execute the required functional T-Code.


Ex:- VA02/VA01/VL02/VL01/VF02/VF01…
 Enter the document or order number.
 Press enter button.
 Change any data.
 Perform the required action such as Save/Enter/press any icon./….. etc.

Note:An information message is given from a User exit.

Document prepared By Sonu Jangir SAP ABAP


22

Difference between Customer Exits &User Exits:

Customer Exits User Exits


These are the function modules. These are the subroutines.
The customer exit have different type such as: User exit do not have different types.
function exits, menu item, screen exit &field
exits.
The global data cannot be accessed but the The global data can be accessed.
parameters import and tables can be accessed.
These are available under most of the These are mostly available in sales and
functional areas such as: SD,MM,FI… etc. distribution function area.
Access key is not required to add the additional Access key is required to break the standard
functionality. program.
Note:- The enhancement frame work can be
used without breaking the standard program
from the version ECC6.0.
Data inconsistency is not happened since the Data inconsistency may be happened while
global data can’t be accessed. changing the global data.
The customer Exits are called using The User Exit starts with USEREXIT (sub
‘CALLCUSTOMER_Function’. routines in standard include).

Requirement Routines/VOFM Routines

 Requirement/VOFM routines are used to facilitate OR alter standard system


provided business process
 Transaction code "VOFM" is used to maintain OR define requirement routines.
Note: In real time requirement/VOFM routines are defined and given by functional
consultants
Note: Access key is required for defining requirement/VOFM routines
Note: Defined requirement/VOFM routines are specified against required output type under
Procedures in transaction code "NACE"

Steps to define requirement routine:-


 Execute transaction code VOFM
 Click on 'Requirements' menu item
Note: Menu item 'Copying Requirements' is used to copy existing requirements and do
modifications.
Note: Menu item data transfer is used to transfer data.

Document prepared By Sonu Jangir SAP ABAP


23

 Click on output control


Note: Existing requirement routines are listed here
Note: most of the custom requirement routines …start with '9*' and '6*' [Ex: 905, 601 etc]
 Enter required routine number, description and application area

Routine number Description Active Application


901 For UK YES V2
Validation
---- ------ ----
---- ---- --- ----
Note: Select existing routine number …then click on source text icon to make changes in
the existing requirement routine
 Click on save icon
 Enter given access key by Basis consultant
 Click on continue button
 Implement required customer specific business logic in between system generated
subroutine definitions.
 Click on activate button

Steps to specify requirement/VOFM routines:-


 Execute Transaction code 'NACE'
 Select required application [Ex: V2 - Shipping OR V3 - Billing]
 Click on procedures button
Note: Button 'output types' is used to maintain output types
 Select required procedure OR output type
Ex: ZV1000 - Custom procedure.
V20001 - Standard procedure.
 Double click on 'control' folder
 Enter/Select defined requirement routine against required condition type.
Ex: Reference Counter Condition type Description Requirement
30 3 Zpk1 Packing list 901
--- --- --- --- ---
--- --- --- --- ---

 Click on save icon


 Create TR by pressing create request icon
 Click on 'YES' button

Document prepared By Sonu Jangir SAP ABAP


24

Note: The button 'new entries' is used to define new control.


 Click on back icon.

BADI’S

Business ADdIns:

These are the new enhancement techniques to add the additional customer specific business logic
to the standard programs.

 The T-Code’s ‘SE18 & SE19’ are used to work with the BADI’s.

T-Code SE18: This T-Code is used to define the BADI’s.

T-Code SE19: This T-Code is used to implement the BADI’s.

Different types of BADI’s:

Following are the different types and subtypes of the BADI’s.

1. Classic BADI (or) Old BADI.


2. New BADI/kernel BADI.

Subtypes are:

a. Single use BADI.


b. Multiple use BADI.
c. Filter dependent BADI.
1. Classic BADI:
Classic BADI’s are used in most of the function areas like MM,SD,FI/CO……ETC.
The system provided standard method ‘get_instance’ of the standard class
‘CL_EXITHANDLER’ is used to work with the classic BADI’s.
2. New BADI’s (or)Kernal BADI’s:

The ABAP statement GET BADI & CALL BADI are used to work with the new BADI’s or
kernel BADI’s in the programs.

Get BADI statement:

Document prepared By Sonu Jangir SAP ABAP


25

This is used to generate a new BADI object and sets the BADI reference to the objects in the
BADI reference variables.

Call BADI statement:

This statement is used to call the methods of the new BADI’s.

Syntax :--

CALL BADI <ref_badi><meth_name> (or)<static_method>.

EXPORTING

Im_param

IMPORTING

.TABLES]

1. Single use BADI:


 The Single use BADI’s can’t be implemented for the multiple times.
 The single use BADI can only be implemented.

2. Multiple use BADI:


 The multiple use BADI’s can’t be implemented for the multiple times.

3. Filter dependent BADI:


 It is used to control the BADI implementation based on the specified filter value.
 The system generates an import parameters ‘FLT_VAL’ to pass the filter values for
controlling the business logic of the BADI implementation.

Note: 

1. The multiple use option is not possible with the new BADI’s.
2. The filter dependent and multiple use options are possible with the classic BADI’s.
3. The BADI’s implementations are triggered in the specified order in case of the multiple
use BADI with different implementations.

Object: It is a runtime instance of a class to provide the services.

Document prepared By Sonu Jangir SAP ABAP


26

 The services are known as methods.


 The ABAP statement Create Object is used to create an object.
Syntax:--
CREATE OBJECT <ref_name>.

Class: It is used to describe or define the objects.

Method:

 It is the process block (set of lines).


 All the attributes such ass (wa) ,(If)… etc of the class can be accessed in the methods.
 The methods can be compared with the FM’s.
 The ABAP statement CALL METHOD is used to call the methods.

Syntax:--

CALL METHOD <ref_obj><instance_method>….

“Instance method.

CALL METHOD <ref_obj><static_method>….

“Static method.

Interface: It is a separate structure which can be used to extend the scope of a class.

Steps to work with (or) Create Classic BADI:

1. Define BADI:

 Execute the T-Code SE18.


 Click on the utilities menu item.
 Click on yes button <”ZB20_CLS_BADI_DEF”> .
 Enter short description.

Note: 

1. The check box multiple use can be unchecked for single use BADI.
2. The check box filter dependent BADI’s can be checked & specified the filter type in case
of filter dependent BADI’s.
3. Click on interface tab.

 Double click on the system proposed interface name.

Document prepared By Sonu Jangir SAP ABAP


27

Ex: ‘ZIF_EX_ZB20_CLS_BADI_DEF’.
 Click on yes.
 Enter the package name.
 Click on save icon.
 Create TR.
 Click on yes.
 Define the required methods.

METHOD LEVEL
GET_DATA Instance method

 Place the cursor on the method name.


 Click on parameters button.
 Define the required parameters.
Parameters Type Typing method Associated type
IN_EBELN Importing Type EBELN
EWA_EKKO Exporting Type ZB20_STRCTR_EKKO

 Click on active.
 Press enter button.
 Click on methods button.

Note: 

Follow the similar steps to assign the parameters for any number of methods.
 Click on back icon.

2. Implement BADI:

 Execute the T-Code SE19.

Note: 

 The menu path Enhancement  Implementation


 T-Code SE18 can also be used.
 Select a radio button classical BADI under create implementation on block.
Note:  The block edit implementation block is used to edit the existing BADI’s
implementations.
 Enter the BADI definition name.

Document prepared By Sonu Jangir SAP ABAP


28

 Click on create implementation button.


 Enter the implementation name (ZB20_CLS_BADI_DFF-1).
 Click on yes.
 Enter short description.
 Click on interface tab.

Note: 

 The system provided interface (or) class name displayed.


 Double click on the method name to be implemented.
 Click on yes.
 Enter package name.
 Click on save.
 Click on signature button to appear parameters of the methods.
 Implement the required customer specific business logic as per the specification.
Ex:
*Implement customer specific business data.
*Get required data from EKKO
IF im_ebeln NE space
SELECT SINGLE EBELN
ERNAM
FROM EKKO
INTO WA_EKKO
WHERE EBELN EQ IM_EBELN.
ENDIF.
 Click on pretty printer button.
 Click on activate icon.
 Select all the object which are related to BADI.
 Click on yes.
 Click on back icon.
 Activate BADI implementation.
 Click on back icon.

Steps to call a method from an interface or class: 

 Once the program is in changed mode.


 Place a cursor where the method to be called.
 Click on pattern button.
 Select a radio button ABAP object patterns.

Document prepared By Sonu Jangir SAP ABAP


29

 Press enter button.


 Enter an instance (or) class (or) interface name.
 Select/Enter the required method.
 Press enter button.
Ex: Instance --- VF-BADI
Class/Interface ---ZIF_EX_B20_CLS_BADI_DEF
Method --- GET_DATA

Note:  Replace the self reference with the reference object name rf_badi if required.

 Uncomment the required parameter.


 Pass the data variables to the parameters of the methods.
 Click on pretty printer button.

Type Reference to statement: 

This statement is used to refer the data objects such as class, interface, BADI definitions… etc.

Syntax:-- DATA: <ref_obj> TYPE REF TO <class_name/interface_name/BADI_definition>

*create an object

CREATE OBJECT <ref_obj>

Demo program on making use of the custom classic BADI is


(ZB20_USE_CLASSIC_BADI).

Steps to create a new BADI: 

 Execute the T-Code SE18.


 Enter the new BADI name in Enhancement spot field (ZB20_NEW_BADI) .
 Click on create button.
 Click on yes button.
 Enter package name.
 Click on save icon.
 Create the TR.
 Click on yes button.
 Click on create BADI icon.
 Enter the BADI definition name.
 Enter short description.
 Click on yes button.
 Uncheck the multiple use check box.

Document prepared By Sonu Jangir SAP ABAP


30

 Expand the BADI definition name.


 Double click on interface.
 Enter an interface name (ZIF_EX_B20_NEW_BADI_DEF).
 Double click on an interface name.
 Click on yes button.
 Enter the package name.
 Click on save icon.
 Create the TR.
 Click on yes button.
 Press enter and define the required methods.

Method name Level


GET_SALES Instance method
 Place the cursor on the method name.
 Click on parameters button.
 Define the required parameters.

Parameters Type Typing method Associated type


IM_VBELN Importing Type VBELN_VA
ES_SALES Exporting Type ZB20_STRCTR_VBAK

 Click on activate.
 Press enter.
 Click back.
Note:  Follow the similar steps to define the parameters for any number of methods.
 Activate an interface.
 Click on back.
 Click on activate to activate an enhancements spot.
 Click on back.

Steps to implement a new BADI: 

 Execute the T-Code SE19.


 Select a radio button new BADI.
 Enter enhancement spot name under create implementation block.
 Click on create implementation button.
 Enter enhancement implementation name.
 Enter short text.
 Click on yes.

Document prepared By Sonu Jangir SAP ABAP


31

 Enter the package name.


 Click on save icon.
 Create the TR and click yes.
 Enter BADI implementation name (ZB20_NEW_BADI_IMP).
 Click on yes.
 Expand the BADI implementation.
 Double click on implementing class.
 Enter the class name.
 Press enter (ZCL_EX_B20_NEW_BADI_DEF).
 Click on yes.
 Enter package name.
 Click on save.
 Click on yes to save the class under same TR.
 Double click on the interface method name
(ZIF_EX_B20_NEW_BADI_DEF~GET_SALES).
 Click on yes.
 Press enter.
 Click on display or change icon.
 Implement the required business logic in between the system generated statement
METHOD… ENDMETHOD.
 Custom business logic.
IF IM_VBELN <> space.
SELECT SINGLE VBELN
ERDAT
ERNAM
FROM VBAK
INTO ES_SALES
WHERE VBELN EQ IM_VBELN.
ENDIF.

 Click on pretty printer button.


 Click on activate.
 Select all the related objects.
 Press enter button.
 Click on back.
Demo program on making use of New custom BADI (ZB20_USE_NEW_BADI).

Document prepared By Sonu Jangir SAP ABAP


32

Note:  Replace CALL METHOD statement with CALL BADI statement to call the methods
from a new BADI.

Fall Back Class: 

Program goes to runtime error (or) short down in case of a BADI does not have active
implements.
The fall back classes are used/defined to call the default methods in case of a
BADI doesn’t have any active implementations.

Note:  The exceptions can also be raised to avoid such kind of errors.

Steps to define filter dependent BADI: 

 Execute T-Code SE18.


 Click on utilities menu item.
 Click on create classic BADI.
 Enter the BADI definition name(ZB20_FLT_CLS_BADI)
 Click on yes.
 Enter short text.
 Check the check box ‘Filter dependent’.
 Select or enter the required filter type (BUKRS-Company code).
 Click on interface tab.
 Double click on the system proposed interface name.
 Click on yes.
 Enter the package name.
 Click on save icon.
 Create the TR.
 Click on yes.
 Enter or define the required methods.

Note:  Define the parameters by placing a cursor on the method name if required.

 Click on activate icon.


 Press enter.
 Click on save icon.
 Click on back.

Note:  The system generates an import parameter FLT_VAR to pass the filter values for
controlling the business logic of the BADI.

Document prepared By Sonu Jangir SAP ABAP


33

 Click on back.

Steps to implement filter dependent BADI: 

 Execute T-Code SE19.


 Select radio button classic BADI under create implementation block.
 Enter BADI definition name.
 Click on create implementation button.
 Enter implementation name.
 Click on yes button.
 Enter short description.
 Click on insert row icon to set the filter values.

Ex:

 Filter dependent Filter type


BUKRS

Co.code
2000
1000
….
……

 Click on interface tab.


 Double click on the method name.
 Click on yes.
 Enter the package name.
 Click on save icon.
 Click on yes to save the BADI implementation under the same TR.
 Click on yes.
 Click on save.
 Implement the required business logic as per the specification in between the system
generated statements.
Ex: IF FLT_VAL EQ <1000>.
*business logic for first filter value.

Document prepared By Sonu Jangir SAP ABAP


34

.
ELSEIF FLT_VAL EQ <2000>
*Business logic for second filter value.
ENDIF.
 Click on pretty printer button.
 Click on activate icon.
 Select all the related objects.
 Press enter button.
 Click on back.
 Activate the implementation.
Demo program on filter dependent BADI is (ZB20_USE_FLT_BADI).

Steps to work with a fall back class: 

 Once the new BADI definition is in change mode.


 Uncheck the multiple use check box.
 Double click on interface name.
 Press enter and click on yes.
 Enter the package name and then click on save icon.
 Create the TR.
 Click on yes.
 Press enter button.
 Define the required method and the corresponding parameters.
 Click on activate.
 Click on back.
 Double click on the BADI definition name.
 Check the check box ‘Call fall back’.
 Enter the fall back class name (ZCL_B20_NEW_BADI_FALBK_DFF).
 Double click on the fall back class name.
 Click on yes.
 Enter the package name.
 Click on save.
 Click on yes to save the class under the same TR.
 Click on yes.
 Press enter button.
 Double click on the required interface method.
 Implement the required business logic in between the system generated statements
method END method.
 Click on pretty printer.

Document prepared By Sonu Jangir SAP ABAP


35

 Click on activate.
 Select all the BADI related objects.
 Press enter button.
 Click on back.

Standard BADI: 

 Most of the Standard BADI’s are classic BADI’s.


 These are used to add the additional customer specific functionality or business logic to the
standard programs or T-Codes.

Different ways to find Standard BADI’s: 

Following are the different ways to find the standard BADI’s.

1) Using T-Code SE-84.


2) Using the standard class CL_EXITHANDLER.
3) Using SQL tracer (ST05).

1. Steps to find Standard BADI’s using the T-Code SE-84: 

 Find the package name of the required T-Code/program.


Ex: execute MM02/VA02SystemStatusDouble click on program
nameGOTOAttributes.
 Execute the T-Code SE84.
 Expand enhancements.
 Expand business add-ins folder.
 Double click on definitions.

Note: An implementation selection/icon is used to list out the BADI implementation of the
package.

 Enter the required package name (MGA).


 Click on execute icon.

Note:

1) All the corresponding BADI’s are listed.


2) Most of the standard BADI’s start with BADI*.

Document prepared By Sonu Jangir SAP ABAP


36

3) Find an appropriate BADI by reading its name and description use trial & error method to
find an exact Exit/BADI.
Ex: BADI_MATERIAL_CHECK-Enhanced checks for material master tables.

2. Steps to find the BADI’s using the standard class CL_EXITHANDLER: 

Note: T-Code SE24 is used to maintain the global class.

 Execute the T-Code SE24.


 Enter the standard class name CL_EXITHANDLER.
 Click on display button.
 Double click on the method GET_INSTANCE.
 Set a session break point on the method GET_CLASS_NAME_BY_INTERFACE.
 Execute the required functional T-Code.
Ex: MM02
 Perform the required action.
Ex: Save material

Note: Skip the break point for the unwanted action by pressing F8 function.

 Double click on a passing parameter (EXIT_NAME) to know/list out corresponding


BADI.
Ex: BADI_MATERIAL_CHECK.

3. Steps to find the BADI’s using SQLTRACER (ST05): 

 Execute the T-code ST05.


 Check the check box ‘Table buffer trace’.
 Click on activate trace button.
 Execute the required functional T-Code in another new session.
Ex: MM02/VA02/VL02…..
 Perform the required action.
Ex: Save/Enter/Press any icon /…
 Open SQL tracer session.
 Click SQL tracer session.
 Click on deactivate trace button.
 Click on display trace button.
 Press enter button.
 Click on find icon.
 Enter the find string.

Document prepared By Sonu Jangir SAP ABAP


37

Note:
1. All the corresponding BADI’s and the interfaces are listed.
2. Find an appropriate correct BADI by analyzing the BADI names, BADI
descriptions (or) by using trail &error method.
Ex: BADI_MATERIAL_CHECK.

Database views V_EXT_ACT:

It contains the BADI definitions implementations, filter values etc.

Following are the field in this DB view.

View field Description


EXIT_NAME Business Add-in definition
IMP_NAME Business Add-in Implementation BADI
FLT_VAL Filter value for filter dependent
implementation
MST_LANG Language key
Database views V_EXT_IMP:

It contains the BADI interface name, class name, implementation name, definition name
&etc,Following are some of the useful fields:-

Field Description
INTER_NAME Interface name
FLT_VAL Filter value for filter dependent BADI
implementation
IMP_CLASS Object type name
IMP_NAME Business Add-in implementation
EXIT_NAME Business Add-in definition
Steps to implement a standard BADI: 

 Execute the T-Code SE19.


 Select a radio button classic BADI under create implementation block.

Note:The block edit implementation is used to change the existing BADI implementation.

 Enter the required BADI name (BADI_MATERIAL_CHECK).


 Click on create implementation.
 Enter implementation name.(ZB20_ MATERIAL_CHECK)
 Press enter button.
 Enter short description.

Document prepared By Sonu Jangir SAP ABAP


38

 Click on interface tab.


 Double click on required method name.
Ex: (CHECK_data).
 Click on yes.
 Enter the package name.
 Click on save icon.
 Create the TR by pressing create request icon.
 Click on yes button.
 Click on SAVE icon.
 Implement the required additional customer specific business logic using parameters of
the method in between the system generated statement METHOD & ENDMETHOD.
Ex: METHOD if
EX_badi_Material_CHECK~CHECK_DATA
*Additional business logic
<If wmara_Volum EQ space.
MESSAGE : “Enter Volume” TYPE ‘E’
ENDIF
END METHOD >
 Click on pretty printer button.
 Click on activate icon.
 Check all BADI related objects names.
 Press enter button.
 Click on back.

Test the scenario: 

Make volume field (MARA_VOLUM) mandatory in MM02/MM01.

 Execute the required T-Code Ex: MM02/VL02.


 Enter the document number
Ex: Material no/Delivery no. etc…
 Press enter button.
 Select an appropriate view (Basic Data).
 Change any data.
 Click on save icon.

Note:All implementations are triggered in the specified sequence one by one in case of a
BADI has multiple implantations.

Document prepared By Sonu Jangir SAP ABAP


39

Different between EXITS and BADI’s:

Exits BADI’s
These are procedural ABAP based. These are OOABAP based.
It is not possible to assign an Exit to more than The multiple use BADI can be implemented
one project. for multiple types.
Filter values can be set to the Exits. Filter values can be set for filter dependent
BADI’s.
T-Codes CMOD & SMOD are used. T-Codes SE18 & SE19 are used.

Different between classic BADI and New BADI:

Classic BADI/OLD BADI New BADI/Kernel


The standard method set instance of the The ABAP statements GET BADI and CALL
standard class CL_EXITHANDLER is used to BADI are used to work with new BADI.
work with classic BADI’s.

Document prepared By Sonu Jangir SAP ABAP

You might also like