Professional Documents
Culture Documents
http://wiki.sdn.sap.com/wiki/display/Snippets/BADI+Implementation+f...
Log In
Register
About Us
SDN Community
Home Forums Wiki Blogs
BPX Community
Articles Downloads
BusinessObjects
eLearning
University Alliances
Events InnoCentive
SAP EcoHub
Idea Place Shop
Career Center
My Home > Code Gallery > Community Code Gallery > BADI Implementation for MM02 to change material description
Welcome Guest
Additional Features
Added by Dheeraj Soni , last edited by Craig Cmehil on Mar 24, 2009 (view change) Labels: abap, put Author: Dheeraj Soni Submitted: 12/03/2008 Related Links: <N/A>
The goal of this conversation is to find the BADI for MM02 transaction and implement the BADI as to change the material description.
Introduction
BADI implementation in the MM02 transaction to change the material description.When the customer needs more functionality in the SAP standard Program (Functionality) then we can add extra functionality to standard SAP functionality through BADI. BADI can't disturb the original (standard) code. Adding extra functionality to the standard is nothing but Add-in. BADI are not created in the program itself. They are created and maintained separately and called when we need the BADI. In the given tutorial BADI implantation of transaction MM02 is done as to change the description of the material number, for that I have explained the way to find the appropriate BADI according to the requirement. Than we will learn to see all the methods associated with that BADI name and finally implement that BADI to add extra features.
Under this class 'CL_EXITHANDLER' select the method 'GET_INSTANCE' and double click on it.
Under the method 'GET_INSTANCE' put break point on a function module called 'CALL METHOD CL_EXITHANDLER=>GET_CLASS_NAME_BY_INTERFACE'
1 of 8
8/30/2010 8:39 PM
http://wiki.sdn.sap.com/wiki/display/Snippets/BADI+Implementation+f...
Place the cursor over here and give a break point. Then according to the requirement run the transaction. In this example transaction code is MM02. Run the transaction MM02. As in 1st step we have put a break point, that function module will give all BADI used by the transaction in each screen and activity on the application (MM02). Now double click on the changing parameter EXIT_NAME of the function module to get the name of BADI used in this transaction.
Now press F8 to again and again to get the list of all the BADI. We will get following BADI as shown below. BADI_SCREEN_LOGIC_RT W_RETAILSYSTEM_IDENT BADI_MATN1 Than again pressing F8 key the initial screen of transaction MM02 will appear.
2 of 8
8/30/2010 8:39 PM
http://wiki.sdn.sap.com/wiki/display/Snippets/BADI+Implementation+f...
Press F8.
Press F8.
ECM_EXIT (Customer Exits for Engineering Change Management) Press F8. BADI_LAYER (Layer Value Management for BADIs) Press F8. BADI_MATERIAL_OD (Integration of New Objects in Material or Article Master) Press F8. BADI_MAT_F_SPEC_SEL (BADI for Material Special Field Selection) Press F8. Change material window will come. In this change the material description.
3 of 8
8/30/2010 8:39 PM
http://wiki.sdn.sap.com/wiki/display/Snippets/BADI+Implementation+f...
BADI_GTIN_VARIANT (User Exit for Customer-Specific GTIN Variant Check) Press F8.
4 of 8
8/30/2010 8:39 PM
http://wiki.sdn.sap.com/wiki/display/Snippets/BADI+Implementation+f...
EHSS_SPEC_CHECKS (BADI: Extended Checks for Specifications) BADI name: BADI_GTIN_VARIANT BADI_MATERIAL_CHECK BADI_MAT_SPEC_SEL EHSS_SPEC_CHECKS
Click on display button to see the methods declared in that. Click on the interface tab to see the details of all the methods associated with the BADI name as shown below.
Method CHECK_DATA is used to give the material description. Choose the method where the material description is defined.
5 of 8
8/30/2010 8:39 PM
http://wiki.sdn.sap.com/wiki/display/Snippets/BADI+Implementation+f...
Double click on method CHECK_DATA. On double clicking system will provide you the editor to write the code.
6 of 8
8/30/2010 8:39 PM
http://wiki.sdn.sap.com/wiki/display/Snippets/BADI+Implementation+f...
The entire code is written as shown below CONSTANTS: wl_prefix(6) TYPE c VALUE 'LT_BD_', wl_uname TYPE sy-uname VALUE 'EI6DEV'. DATA: int_stext TYPE TABLE OF short_desc. DATA: wa_stext TYPE short_desc. DATA: wf_idx TYPE sy-tabix. DATA: WA1 TYPE SHORT_DESC. DATA: WA TYPE SHORT_DESC. WA-MAKTX = 'HELLO'. LOOP AT STEXT INTO WA1. CONCATENATE WA1-MAKTX WA-MAKTX INTO WA1-MAKTX. MODIFY STEXT FROM WA1. ENDLOOP. IF sy-uname = wl_uname. int_stext[] = stext[]. READ TABLE int_stext INTO wa_stext WITH KEY spras = sy-langu. IF sy-subrc = 0. wf_idx = sy-tabix. IF wa_stext-maktx+0(6) = wl_prefix OR wa_stext-maktx IS INITIAL. EXIT. ELSE. CONCATENATE wl_prefix wa_stext-maktx INTO wa_stext-maktx. MODIFY int_stext FROM wa_stext INDEX wf_idx. stext[] = int_stext[]. ENDIF. "and sy-tcode = 'MM02'
7 of 8
8/30/2010 8:39 PM
http://wiki.sdn.sap.com/wiki/display/Snippets/BADI+Implementation+f...
ENDIF. ENDIF. Save the changes and activate the program. Than activate the BADI implementation. The output of the BADI implementation is as shown below. The material description has been changed with the prefix LT_BD_.
This is how we can change the standard material description using BADI. Thanks & regards. Dheeraj
Legal Terms
Privacy
Impressum
8 of 8
8/30/2010 8:39 PM