BADI SAP Technical
-
Upload
nelsondarla12 -
Category
Documents
-
view
67 -
download
11
description
Transcript of BADI SAP Technical
![Page 1: BADI SAP Technical](https://reader033.fdocuments.in/reader033/viewer/2022061515/55cf9d23550346d033ac65d2/html5/thumbnails/1.jpg)
Implementing BADI for the transactions VL02 & MM02
Implementing BADI for the transactions VL02 & MM02
By Truptimaya Mishra, Capgemini India
Introduction to BADI
1. Based on OOPS concept.2. No access key required.3. All BADI’s can be seen in a class ‘CL_EXITHANDLER’.
Step 1:
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.
![Page 2: BADI SAP Technical](https://reader033.fdocuments.in/reader033/viewer/2022061515/55cf9d23550346d033ac65d2/html5/thumbnails/2.jpg)
Under the method ‘GET_INSTANCE’ put break point on a function module called
‘CALL METHOD CL_EXITHANDLER=>GET_CLASS_NAME_BY_INTERFACE’
![Page 3: BADI SAP Technical](https://reader033.fdocuments.in/reader033/viewer/2022061515/55cf9d23550346d033ac65d2/html5/thumbnails/3.jpg)
Step 2:
Then according to the requirement run the transaction. In this example transaction code is VL02.
Run the transaction VL02. As in 1st step we have putted a break point, that function module will give all BADI used by the transaction in each screen and activity on the application (VL02).
Under the parameter EXIT_NAME this debugger screen will give all BADI name for each screen.
![Page 4: BADI SAP Technical](https://reader033.fdocuments.in/reader033/viewer/2022061515/55cf9d23550346d033ac65d2/html5/thumbnails/4.jpg)
Each time press F8, you will get all BADI used for the screen. After that system will go for next screen.
BADI NAME: EHS_DG_001
LE_SHP_DELIVERY_PROC
LE_SHP_PRICING
BADI_LAYER
CU_CONFIG_DELEGATION
1st screen of transaction VL02.
Step 3:
Choose your BADI name and you can see the detail in transaction SE18. Lets take a BADI ‘BADI_LAYER’. Click on display button.
![Page 5: BADI SAP Technical](https://reader033.fdocuments.in/reader033/viewer/2022061515/55cf9d23550346d033ac65d2/html5/thumbnails/5.jpg)
Press F8 to get the details of the corresponding BADI.
Here we can get the attribute and interface details of the BADI. As this one is screen BADI sub-screen tab also is there.
![Page 6: BADI SAP Technical](https://reader033.fdocuments.in/reader033/viewer/2022061515/55cf9d23550346d033ac65d2/html5/thumbnails/6.jpg)
Step 4:
To implement the BADI, we have transaction SE19.
To create new BADI to implement the put your BADI name here. If the BADI is an enhancement-point then put the BADI name in option NEW BADI and if only BADI then put the name in CLASSIC BADI.
Give the BADI name and click on create button.
![Page 7: BADI SAP Technical](https://reader033.fdocuments.in/reader033/viewer/2022061515/55cf9d23550346d033ac65d2/html5/thumbnails/7.jpg)
Press F8.
Again press F8. Give an implementation name. Let it be ZTTTTT
![Page 8: BADI SAP Technical](https://reader033.fdocuments.in/reader033/viewer/2022061515/55cf9d23550346d033ac65d2/html5/thumbnails/8.jpg)
Give the description and select a suitable method double click to get into the method to put the ABAP code.
To edit an implemented BADI the below portion is used. Click on the change button to edit the BADI.
![Page 9: BADI SAP Technical](https://reader033.fdocuments.in/reader033/viewer/2022061515/55cf9d23550346d033ac65d2/html5/thumbnails/9.jpg)
EXAMPLE: To change the description of a material in transaction MM02.
Step 1:
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.
![Page 10: BADI SAP Technical](https://reader033.fdocuments.in/reader033/viewer/2022061515/55cf9d23550346d033ac65d2/html5/thumbnails/10.jpg)
Under the method ‘GET_INSTANCE’ put break point on a function module called
CALL METHOD CL_EXITHANDLER=>GET_CLASS_NAME_BY_INTERFACE’
![Page 11: BADI SAP Technical](https://reader033.fdocuments.in/reader033/viewer/2022061515/55cf9d23550346d033ac65d2/html5/thumbnails/11.jpg)
Step 2:
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 putted a break point, that function module will give all BADI used by the transaction in each screen and activity on the application (MM02).
Press F8 to get the BADI used.
BADI name before calling the main screen of MM02.
![Page 12: BADI SAP Technical](https://reader033.fdocuments.in/reader033/viewer/2022061515/55cf9d23550346d033ac65d2/html5/thumbnails/12.jpg)
BADI_SCREEN_LOGIC_RT
W_RETAILSYSTEM_IDENT
Press enter to get into the details.
BADI name after calling the main screen of MM02.
BADI_MATERIAL_OD
![Page 13: BADI SAP Technical](https://reader033.fdocuments.in/reader033/viewer/2022061515/55cf9d23550346d033ac65d2/html5/thumbnails/13.jpg)
Press enter to proceed.
BADI used.
BADI_MATERIAL_OD
ECM_EXIT
BADI_LAYER
GOS_SRV_SELECT
![Page 14: BADI SAP Technical](https://reader033.fdocuments.in/reader033/viewer/2022061515/55cf9d23550346d033ac65d2/html5/thumbnails/14.jpg)
BADI_MATERIAL_OD
ECM_EXIT
Change the description line and click on SAVE icon.
![Page 15: BADI SAP Technical](https://reader033.fdocuments.in/reader033/viewer/2022061515/55cf9d23550346d033ac65d2/html5/thumbnails/15.jpg)
BADI name:
BADI_GTIN_VARIANT
BADI_MATERIAL_CHECK
EHSS_SPEC_CHECKS
Step 3:
Run the transaction SE18 to see the details of BADI.
Click on display button to see the methods declared in that.
![Page 16: BADI SAP Technical](https://reader033.fdocuments.in/reader033/viewer/2022061515/55cf9d23550346d033ac65d2/html5/thumbnails/16.jpg)
Choose the method where the material description is defined.
Step 4:
Run the transaction SE19 and create an implementation for the corresponding BADI. Click on create button to create an implementation.
![Page 17: BADI SAP Technical](https://reader033.fdocuments.in/reader033/viewer/2022061515/55cf9d23550346d033ac65d2/html5/thumbnails/17.jpg)
Give a name for the implementation.
Give the description. Click on save icon and double click on the method chosen.
On a double clicking system will provide you the editor to write the code.
![Page 18: BADI SAP Technical](https://reader033.fdocuments.in/reader033/viewer/2022061515/55cf9d23550346d033ac65d2/html5/thumbnails/18.jpg)
Code is
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.
Note: activate the program and the implementation.