Introduction to BADI<?XML:NAMESPACE PREFIX = O />
Step 1:
Run the transaction SE24. Under object type put the class name ‘CL_EXITHANDLER’.
Click on display button.
<?XML:NAMESPACE PREFIX = V /><shapetype id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"><stroke joinstyle="miter"></stroke><formulas><f eqn="if lineDrawn pixelLineWidth 0"></f><f eqn="sum @0 1 0"></f><f eqn="sum 0 0 @1"></f><f eqn="prod @2 1 2"></f><f eqn="prod @3 21600 pixelWidth"></f><f eqn="prod @3 21600 pixelHeight"></f><f eqn="sum @0 0 1"></f><f eqn="prod @6 1 2"></f><f eqn="prod @7 21600 pixelWidth"></f><f eqn="sum @8 21600 0"></f><f eqn="prod @7 21600 pixelHeight"></f><f eqn="sum @10 21600 0"></f></formulas><path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"></path><lock v:ext="edit" aspectratio="t"></lock></shapetype><shape id="_x0000_i1025" style="WIDTH: 252pt; HEIGHT: 113.25pt" type="#_x0000_t75"><imagedata src="file:///C:/DOCUME~1/PARVAT~1/LOCALS~1/Temp/msoclip1/01/clip_image001.png" o:title=""></imagedata></shape>
Under this class ‘CL_EXITHANDLER’ select the method ‘GET_INSTANCE’ and double click.
<shape id="_x0000_i1026" style="WIDTH: 292.5pt; HEIGHT: 216.75pt" type="#_x0000_t75"><imagedata src="file:///C:/DOCUME~1/PARVAT~1/LOCALS~1/Temp/msoclip1/01/clip_image003.png" o:title=""></imagedata></shape>
Under the method ‘GET_INSTANCE’ put break point on a function module called
‘CALL METHOD CL_EXITHANDLER=>GET_CLASS_NAME_BY_INTERFACE’
<shape id="_x0000_i1027" style="WIDTH: 280.5pt; HEIGHT: 241.5pt" type="#_x0000_t75"><imagedata src="file:///C:/DOCUME~1/PARVAT~1/LOCALS~1/Temp/msoclip1/01/clip_image005.png" o:title=""></imagedata></shape>
<shape id="_x0000_i1028" style="WIDTH: 308.25pt; HEIGHT: 241.5pt" type="#_x0000_t75"><imagedata src="file:///C:/DOCUME~1/PARVAT~1/LOCALS~1/Temp/msoclip1/01/clip_image007.png" o:title=""></imagedata></shape>
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).
<shape id="_x0000_i1029" style="WIDTH: 303.75pt; HEIGHT: 228pt" type="#_x0000_t75"><imagedata src="file:///C:/DOCUME~1/PARVAT~1/LOCALS~1/Temp/msoclip1/01/clip_image009.png" o:title=""></imagedata></shape>
Under the parameter EXIT_NAME this debugger screen will give all BADI name for each screen.
<shape id="_x0000_i1030" style="WIDTH: 292.5pt; HEIGHT: 234pt" type="#_x0000_t75"><imagedata src="file:///C:/DOCUME~1/PARVAT~1/LOCALS~1/Temp/msoclip1/01/clip_image011.png" o:title=""></imagedata></shape>
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.
<shape id="_x0000_i1031" style="WIDTH: 290.25pt; HEIGHT: 105.75pt" type="#_x0000_t75"><imagedata src="file:///C:/DOCUME~1/PARVAT~1/LOCALS~1/Temp/msoclip1/01/clip_image013.png" o:title=""></imagedata></shape>
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.
<shape id="_x0000_i1032" style="WIDTH: 273pt; HEIGHT: 140.25pt" type="#_x0000_t75"><imagedata src="file:///C:/DOCUME~1/PARVAT~1/LOCALS~1/Temp/msoclip1/01/clip_image015.png" o:title=""></imagedata></shape>
Press F8 to get the details of the corresponding BADI.
<shape id="_x0000_i1033" style="WIDTH: 291pt; HEIGHT: 206.25pt" type="#_x0000_t75"><imagedata src="file:///C:/DOCUME~1/PARVAT~1/LOCALS~1/Temp/msoclip1/01/clip_image017.png" o:title=""></imagedata></shape>
Here we can get the attribute and interface details of the BADI. As this one is screen BADI sub-screen tab also is there.
<shape id="_x0000_i1034" style="WIDTH: 302.25pt; HEIGHT: 224.25pt" type="#_x0000_t75"><imagedata src="file:///C:/DOCUME~1/PARVAT~1/LOCALS~1/Temp/msoclip1/01/clip_image019.png" o:title=""></imagedata></shape>
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.
<shape id="_x0000_i1035" style="WIDTH: 325.5pt; HEIGHT: 214.5pt" type="#_x0000_t75"><imagedata src="file:///C:/DOCUME~1/PARVAT~1/LOCALS~1/Temp/msoclip1/01/clip_image021.png" o:title=""></imagedata></shape>
Give the BADI name and click on create button.
<shape id="_x0000_i1036" style="WIDTH: 269.25pt; HEIGHT: 213.75pt" type="#_x0000_t75"><imagedata src="file:///C:/DOCUME~1/PARVAT~1/LOCALS~1/Temp/msoclip1/01/clip_image023.png" o:title=""></imagedata></shape>
Press F8.
<shape id="_x0000_i1038" style="WIDTH: 290.25pt; HEIGHT: 205.5pt" type="#_x0000_t75"><imagedata src="file:///C:/DOCUME~1/PARVAT~1/LOCALS~1/Temp/msoclip1/01/clip_image025.png" o:title=""></imagedata></shape>
Again press F8. Give an implementation name. Let it be ZTTTTT
<shape id="_x0000_i1037" style="WIDTH: 6in; HEIGHT: 157.5pt" type="#_x0000_t75"><imagedata src="file:///C:/DOCUME~1/PARVAT~1/LOCALS~1/Temp/msoclip1/01/clip_image027.png" o:title=""></imagedata></shape>
Give the description and select a suitable method double click to get into the method to put the ABAP code.
<shapetype id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"><stroke joinstyle="miter"></stroke><formulas><f eqn="if lineDrawn pixelLineWidth 0"></f><f eqn="sum @0 1 0"></f><f eqn="sum 0 0 @1"></f><f eqn="prod @2 1 2"></f><f eqn="prod @3 21600 pixelWidth"></f><f eqn="prod @3 21600 pixelHeight"></f><f eqn="sum @0 0 1"></f><f eqn="prod @6 1 2"></f><f eqn="prod @7 21600 pixelWidth"></f><f eqn="sum @8 21600 0"></f><f eqn="prod @7 21600 pixelHeight"></f><f eqn="sum @10 21600 0"></f></formulas><path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"></path><lock v:ext="edit" aspectratio="t"></lock></shapetype><shape id="_x0000_i1025" style="WIDTH: 322.5pt; HEIGHT: 202.5pt" type="#_x0000_t75"><imagedata src="file:///C:/DOCUME~1/PARVAT~1/LOCALS~1/Temp/msoclip1/01/clip_image001.png" o:title=""></imagedata></shape>
To edit an implemented BADI the below portion is used. Click on the change button to edit the BADI.
<shape id="_x0000_i1026" style="WIDTH: 308.25pt; HEIGHT: 210.75pt" type="#_x0000_t75"><imagedata src="file:///C:/DOCUME~1/PARVAT~1/LOCALS~1/Temp/msoclip1/01/clip_image003.png" o:title=""></imagedata></shape>
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.
<shape id="_x0000_i1027" style="WIDTH: 309.75pt; HEIGHT: 118.5pt" type="#_x0000_t75"><imagedata src="file:///C:/DOCUME~1/PARVAT~1/LOCALS~1/Temp/msoclip1/01/clip_image005.png" o:title=""></imagedata></shape>
Under this class ‘CL_EXITHANDLER’ select the method ‘GET_INSTANCE’ and double click.
<shape id="_x0000_i1028" style="WIDTH: 315pt; HEIGHT: 222pt" type="#_x0000_t75"><imagedata src="file:///C:/DOCUME~1/PARVAT~1/LOCALS~1/Temp/msoclip1/01/clip_image007.png" o:title=""></imagedata></shape>
Under the method ‘GET_INSTANCE’ put break point on a function module called
CALL METHOD CL_EXITHANDLER=>GET_CLASS_NAME_BY_INTERFACE’
<shape id="_x0000_i1029" style="WIDTH: 324.75pt; HEIGHT: 241.5pt" type="#_x0000_t75"><imagedata src="file:///C:/DOCUME~1/PARVAT~1/LOCALS~1/Temp/msoclip1/01/clip_image009.png" o:title=""></imagedata></shape>
<shape id="_x0000_i1030" style="WIDTH: 320.25pt; HEIGHT: 243pt" type="#_x0000_t75"><imagedata src="file:///C:/DOCUME~1/PARVAT~1/LOCALS~1/Temp/msoclip1/01/clip_image011.png" o:title=""></imagedata></shape>
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).
<shape id="_x0000_i1031" style="WIDTH: 303.75pt; HEIGHT: 251.25pt" type="#_x0000_t75"><imagedata src="file:///C:/DOCUME~1/PARVAT~1/LOCALS~1/Temp/msoclip1/01/clip_image013.png" o:title=""></imagedata></shape>
Press F8 to get the BADI used.
BADI name before calling the main screen of MM02.
BADI_SCREEN_LOGIC_RT
W_RETAILSYSTEM_IDENT
<shape id="_x0000_i1032" style="WIDTH: 423pt; HEIGHT: 173.25pt" type="#_x0000_t75"><imagedata src="file:///C:/DOCUME~1/PARVAT~1/LOCALS~1/Temp/msoclip1/01/clip_image015.png" o:title="" cropbottom="43691f" cropright="23137f"></imagedata></shape>
Press enter to get into the details.
<shape id="_x0000_i1033" style="WIDTH: 449.25pt; HEIGHT: 285.75pt" type="#_x0000_t75"><imagedata src="file:///C:/DOCUME~1/PARVAT~1/LOCALS~1/Temp/msoclip1/01/clip_image017.png" o:title="" cropbottom="7828f" cropright="27713f"></imagedata></shape>
BADI name after calling the main screen of MM02.
BADI_MATERIAL_OD
<shape id="_x0000_i1034" style="WIDTH: 441pt; HEIGHT: 257.25pt" type="#_x0000_t75"><imagedata src="file:///C:/DOCUME~1/PARVAT~1/LOCALS~1/Temp/msoclip1/01/clip_image019.png" o:title="" cropbottom="7282f" cropright="17810f"></imagedata></shape>
Press enter to proceed.
<shapetype id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"><stroke joinstyle="miter"></stroke><formulas><f eqn="if lineDrawn pixelLineWidth 0"></f><f eqn="sum @0 1 0"></f><f eqn="sum 0 0 @1"></f><f eqn="prod @2 1 2"></f><f eqn="prod @3 21600 pixelWidth"></f><f eqn="prod @3 21600 pixelHeight"></f><f eqn="sum @0 0 1"></f><f eqn="prod @6 1 2"></f><f eqn="prod @7 21600 pixelWidth"></f><f eqn="sum @8 21600 0"></f><f eqn="prod @7 21600 pixelHeight"></f><f eqn="sum @10 21600 0"></f></formulas><path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"></path><lock v:ext="edit" aspectratio="t"></lock></shapetype><shape id="_x0000_i1025" style="WIDTH: 300pt; HEIGHT: 207pt" type="#_x0000_t75"><imagedata src="file:///C:/DOCUME~1/PARVAT~1/LOCALS~1/Temp/msoclip1/01/clip_image001.png" o:title=""></imagedata></shape>
BADI used.
BADI_MATERIAL_OD
ECM_EXIT
BADI_LAYER
GOS_SRV_SELECT
BADI_MATERIAL_OD
ECM_EXIT
<shape id="_x0000_i1026" style="WIDTH: 449.25pt; HEIGHT: 279pt" type="#_x0000_t75"><imagedata src="file:///C:/DOCUME~1/PARVAT~1/LOCALS~1/Temp/msoclip1/01/clip_image003.png" o:title="" cropbottom="9102f" cropright="23271f"></imagedata></shape>
Change the description line and click on SAVE icon.
<shape id="_x0000_i1027" style="WIDTH: 329.25pt; HEIGHT: 190.5pt" type="#_x0000_t75"><imagedata src="file:///C:/DOCUME~1/PARVAT~1/LOCALS~1/Temp/msoclip1/01/clip_image005.png" o:title=""></imagedata></shape>
<shape id="_x0000_i1028" style="WIDTH: 449.25pt; HEIGHT: 240.75pt" type="#_x0000_t75"><imagedata src="file:///C:/DOCUME~1/PARVAT~1/LOCALS~1/Temp/msoclip1/01/clip_image007.png" o:title="" cropbottom="8718f" cropright="27367f"></imagedata></shape>
BADI name:
BADI_GTIN_VARIANT
BADI_MATERIAL_CHECK
EHSS_SPEC_CHECKS
Step 3:
Run the transaction SE18 to see the details of BADI.
<shape id="_x0000_i1029" style="WIDTH: 441pt; HEIGHT: 160.5pt" type="#_x0000_t75"><imagedata src="file:///C:/DOCUME~1/PARVAT~1/LOCALS~1/Temp/msoclip1/01/clip_image009.png" o:title="" cropbottom="38442f" cropright="19175f"></imagedata></shape>
Click on display button to see the methods declared in that.
<shape id="_x0000_i1030" style="WIDTH: 432.75pt; HEIGHT: 224.25pt" type="#_x0000_t75"><imagedata src="file:///C:/DOCUME~1/PARVAT~1/LOCALS~1/Temp/msoclip1/01/clip_image011.png" o:title="" cropbottom="23533f" cropright="13714f"></imagedata></shape>
Choose the method where the material description is defined.
<shape id="_x0000_i1032" style="WIDTH: 393pt; HEIGHT: 106.5pt" type="#_x0000_t75"><imagedata src="file:///C:/DOCUME~1/PARVAT~1/LOCALS~1/Temp/msoclip1/01/clip_image013.png" o:title=""></imagedata></shape>
Step 4:
Run the transaction SE19 and create an implementation for the corresponding BADI. Click on create button to create an implementation.
<shape id="_x0000_i1031" style="WIDTH: 423pt; HEIGHT: 203.25pt" type="#_x0000_t75"><imagedata src="file:///C:/DOCUME~1/PARVAT~1/LOCALS~1/Temp/msoclip1/01/clip_image015.png" o:title="" cropbottom="18417f" cropright="24637f"></imagedata></shape>
Give a name for the implementation.
<shape id="_x0000_i1033" style="WIDTH: 6in; HEIGHT: 107.25pt" type="#_x0000_t75"><imagedata src="file:///C:/DOCUME~1/PARVAT~1/LOCALS~1/Temp/msoclip1/01/clip_image017.png" o:title=""></imagedata></shape>
Give the description. Click on save icon and double click on the method chosen.
<shape id="_x0000_i1034" style="WIDTH: 431.25pt; HEIGHT: 3in" type="#_x0000_t75"><imagedata src="file:///C:/DOCUME~1/PARVAT~1/LOCALS~1/Temp/msoclip1/01/clip_image019.png" o:title="" cropbottom="21845f" cropright="19175f"></imagedata></shape>
On a double clicking system will provide you the editor to write the code.
<shape id="_x0000_i1035" style="WIDTH: 431.25pt; HEIGHT: 222.75pt" type="#_x0000_t75"><imagedata src="file:///C:/DOCUME~1/PARVAT~1/LOCALS~1/Temp/msoclip1/01/clip_image021.png" o:title="" cropbottom="33314f" cropright="25546f" cropleft="-39f"></imagedata></shape>
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.