Professional Documents
Culture Documents
Community WIKI SAP Community Welcome, Guest Login Register Search the Community
ABAP Development
Detailed explanation about BADI and the ways to find the BADI with an
example (ME23n transaction)
Created by Guest, last modified by Bret Halford on Jul 18, 2013
Def:
BADI (Business Add-In) is a new SAP Object Oriented enhancement technique which is used to add our own business functionality to the existing SAP standard functionality.
BADI's are available in SAP R/3 from the system release 4.6c
Why BADI?
In contrast to the earlier enhancement techniques, BADI follows Object Oriented approach to make them reusable. A BADI can be used any number of times where as standard enhancement techniques
can be used only once.
For example if we assign an enhancement to one custom project, then that enhancement cannot be assigned to any other custom projects. To overcome this drawback SAP has provided a new
enhancement technique called BADI.
SE18
When you create a BAdI definition, a class interface will be automatically created and you can define your methods in the interface. The implementation of the methods can be done in SE19 transaction.
When a BAdi is created following are automatically generated:
An interface with 'IF_EX_' inserted between the first and second characters of the BAdi name
An adapter class with 'CL_EX_' inserted between the first and second characters of the BAdi name.
SE19
Types of BADI's:
While creating a BADI using the T-code SE18, it provides the pop-up screen to select the type of BADI to be used is as shown below.
With this option, any number of active implementations can be assigned to the
same definition BADI. By default this option is checked.
If we want the BADI for multiple use
If you have multiple-use BADI definitions, the sequence must not play any role.
The drawback in Multiple use BADI is, it is not possible to know which BADI is
active especially in country specific version.
Using this option we can define the BADI's according to the filter values to control
the add-in implementation on specific criteria.
Method 1:
https://wiki.scn.sap.com/wiki/pages/viewpage.action?pageId=133758980 1/7
2/6/2018 Detailed explanation about BADI and the ways to find the BADI with an example (ME23n transaction) - ABAP Development - SCN Wiki
4. Run any transaction on which we want find the BADI's say VA01.
7. You can find the BADI name in field EXIT_NAME and if you double click on it,
we can get the corresponding BADI name before hit the corresponding screen.
Based on the requirement find the BADI name and accordingly implement your
functionality using the transaction se19.
Method 2:
2) Double click on the program name i.e. SAPLMEGUI. It will take you into
the program and click on Go to tab from the Menu. There we can find the
package name of the standard transaction ME22n.Copy and paste it in the
package filed.
3) Now Press F8, a list of BADI names will be displayed as shown below. Select the appropriate BADI
name and implement it based on the business requirement using the transaction SE19.
Method 3:
2) A pop-up screen will be displayed and give the package name for any
standard transaction say VA02. Finding the package is explained above. Please
refer above method to find the package name. The package name for VA02
transaction is 'VA.'
3) A list of BADI names will be displayed for the transaction VA02. Select the
appropriate BADI name and implement it using T-code SE19.
Example:
This Example explains how to implement BADI's. Here I am trying to show how
to add custom screen to the ME23N Transactions using BADI's.
The procedure is as explained below.
https://wiki.scn.sap.com/wiki/pages/viewpage.action?pageId=133758980 2/7
2/6/2018 Detailed explanation about BADI and the ways to find the BADI with an example (ME23n transaction) - ABAP Development - SCN Wiki
Go to the code section of the method and add the following code there.
CLEAR re_subscribers[].
*--the name is a unique identifier for the subscreen and defined in this
*--class definition
ls_subscriber-name = subscreen1.
*--the dynpro number to use
ls_subscriber-dynpro = '0002'.
*--the program where the dynpro can be found
ls_subscriber-program = 'ZME_GUI_PO_CUST_SCREEN'.
*--each subscreen needs itsown DDIC-Structure
ls_subscriber-struct_name = 'ZMARA'.
*--a label can be defined
ls_subscriber-position = 7.
*--the height of the screen can be defined here. Currently we support two
*--screen sizes:
ls_subscriber-height = 7.
APPEND ls_subscriber TO re_subscribers.
Save and check and back
Double click on method IF_EX_ME_GUI_PO_CUST~MAP_DYNPRO_FIELDS".
https://wiki.scn.sap.com/wiki/pages/viewpage.action?pageId=133758980 3/7
2/6/2018 Detailed explanation about BADI and the ways to find the BADI with an example (ME23n transaction) - ABAP Development - SCN Wiki
WHEN 'MTART'. <mapping>-metafield = mmmfd_cust_09.
ENDLOOP.
The metafield mapping important for field selection and error handling purpose.
Save, check and back
Activate the Implementation class.
Activate the BADI Implementation.
**
De comment the PBO module in screen flow logic and create the module in above
program.
*---------------------------------------------------------------------*
* FORM SET_SUBSCREEN_AND_PROG *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> DYNNR *
* --> PROG *
* --> VIEW *
* --> TO *
* --> CL_SCREEN_VIEW_MM *
*---------------------------------------------------------------------*
call_subscreen = dynnr.
call_prog = prog.
call_view = view.
ENDFORM.
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
https://wiki.scn.sap.com/wiki/pages/viewpage.action?pageId=133758980 4/7
2/6/2018 Detailed explanation about BADI and the ways to find the BADI with an example (ME23n transaction) - ABAP Development - SCN Wiki
SELECT SINGLE * FROM MARA
Final Output:
No labels
6 Comments
https://wiki.scn.sap.com/wiki/pages/viewpage.action?pageId=133758980 5/7
2/6/2018 Detailed explanation about BADI and the ways to find the BADI with an example (ME23n transaction) - ABAP Development - SCN Wiki
Guest
Hi,
-SId
Guest
thanx for the post
sumanth pelluru
Thanks for posting useful information of badi.
i want like to know that...suppose, if we have done 3 implementations for a single method (using Multiple badi's), and if we have called that method, how do we know that a particular
implemented badi is triggered from that 3 implementations....:)
Harkirat Kaur
Detail Explanation of BADI's providing clarity of topic.
Shaveen Kaushal
Very useful example.Thanks for posting.
https://wiki.scn.sap.com/wiki/pages/viewpage.action?pageId=133758980 6/7
2/6/2018 Detailed explanation about BADI and the ways to find the BADI with an example (ME23n transaction) - ABAP Development - SCN Wiki
ABAPER P
Hello
I followed the same procedure and able to add custom badi tab in me23n Tcode.
But this newly added custom tab is not visible in me21n and me22n and it is only visible to me23n why ?
Now I want to add data manually into custom fields and store it how to make it possible ?
is this BADI ME_GUI_PO_CUST is only used to display data in custom field ? ir we add the data to custom fields and save it ? and this custom tab visible only for me23n ?
https://wiki.scn.sap.com/wiki/pages/viewpage.action?pageId=133758980 7/7