+ All Categories
Home > Documents > BAdi2 for MM02

BAdi2 for MM02

Date post: 31-Jul-2015
Category:
Upload: raju221756843567682
View: 123 times
Download: 8 times
Share this document with a friend
14
BADI Implementation for MM02 to change material description 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. Steps to find BADI:- Run the transaction SE24. Under object type put the class name 'CL_EXITHANDLER'. Click on display button. Under this class 'CL_EXITHANDLER' select the method 'GET_INSTANCE' and double click on it.
Transcript
Page 1: BAdi2 for MM02

BADI Implementation for MM02 to change material description

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.Steps to find BADI:-Run the transaction SE24. Under object type put the class name 'CL_EXITHANDLER'.Click on display button. 

                                    

Under this class 'CL_EXITHANDLER' select the method 'GET_INSTANCE' and double click on it.

Page 2: BAdi2 for MM02

Under the method 'GET_INSTANCE' put break point on a function module called'CALL METHOD CL_EXITHANDLER=>GET_CLASS_NAME_BY_INTERFACE' 

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.

Page 3: BAdi2 for 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_RTW_RETAILSYSTEM_IDENTBADI_MATN1Then again pressing F8 key the initial screen of transaction MM02 will appear.

             

Page 4: BAdi2 for MM02

                                    Get a material number using F4 help and press enter.BADI name after calling the main screen of MM02. 

                                     BADI_MATERIAL_OD.Now press F8 you will get the following screen.

Choose the basic data and press enter to proceed.

Page 5: BAdi2 for MM02

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.

Page 6: BAdi2 for MM02

         

Page 7: BAdi2 for MM02

And savethe changes.You will get the following BADI.

BADI_GTIN_VARIANT (User Exit for Customer-Specific GTIN Variant Check)Press F8.

Page 8: BAdi2 for MM02

BADI_MATERIAL_CHEK (Enhanced Checks for Material Master Tables)Press F8.

BADI_MAT_F_SPEC_SEL (BADI for Material Special Field Selection)Press F8.

EHSS_SPEC_CHECKS (BADI: Extended Checks for Specifications)BADI name: BADI_GTIN_VARIANTBADI_MATERIAL_CHECKBADI_MAT_SPEC_SELEHSS_SPEC_CHECKS Step to check all the methods associated with that BADI:-Run the transaction SE18 to see the details of BADI.

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.

Page 9: BAdi2 for MM02

Method CHECK_DATA is used to give the material description. Choose the method where the material description is defined. Steps to implement the BADI:-Run the transaction SE19 (BADI Builder) and create an implementation for the corresponding BADI. Click on create button to create an implementation.

Page 10: BAdi2 for MM02

Give a name for the implementation

        

Give the BADI description as shown below.

Page 11: BAdi2 for MM02

Double click on method CHECK_DATA. On double clicking system will provide you the editor to write the code.

                

Page 12: BAdi2 for MM02

Write the code in the editor window as shown below

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.            "and sy-tcode = 'MM02'    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.

Page 13: BAdi2 for MM02

        CONCATENATE wl_prefix wa_stext-maktx INTO wa_stext-maktx.        MODIFY int_stext FROM wa_stext INDEX wf_idx.        stext[] = int_stext[].      ENDIF.    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.

                                      


Recommended