4
Example1 on BADI BUSINESS REQUIREMENT Raise an error message whenever the vender belongs to german country and region is not specified. STEP 1:F ind the list of the BADIS for TCODE XKO2. GO TO SE24 Give the class name as CL_EXIT HANDLER Click on display Double click on the method GET_INSTANCE Put a break point Execute the TCODE XKO2 Give the vender no as 1 Select all the check boxes Press enter

BADI-Example1 on BADI by Me

Embed Size (px)

Citation preview

Page 1: BADI-Example1 on BADI by Me

Example1 on BADI

BUSINESS REQUIREMENT

Raise an error message whenever the vender belongs to german country and region is not specified.

STEP 1:Find the list of the BADIS for TCODE XKO2.

GO TO SE24

Give the class name as CL_EXIT HANDLER

Click on display

Double click on the method GET_INSTANCE

Put a break point

Execute the TCODE XKO2

Give the vender no as 1

Select all the check boxes

Press enter

Give the country as DE and click on save

The debugger will start and note down the list of the BADIS

Page 2: BADI-Example1 on BADI by Me

VENDER_FIELDSTATUSGOS_SRV_SELECTADDRESS_CHECKADDR_TXJCD_CHECKCVI_CALL_BTEADDRESS_UPDATEVENDER_ADD_DATA

Go to se18 Give the BADI NAME And check all the methods Find the suitable/roughly decide BADI name and method by reading the

description and checking the signature. Then create implementation

Step 2 : Creating implementation for the BADI Go to SE19 give u r standard BADI name : vender_add_data. Give the implementation name as ZVENDER_ADD_DATA Click on create Give the description Double click on the method check_all_data Put a static or dynamic break point inside the method and activate the

class method Click on back Activate the implementation

Step 3 : TESTING weather BADI is correct or not Now run the transaction XKO2 Our BADI will be triggered with a break point So, this is the BADI and method which we can use for this business

requirement.

Page 3: BADI-Example1 on BADI by Me

Finally write the below code METHOD IF_EX_VENDER_ADD_DATA~CHECK_ALL_DATA.IF I_LFA1-LAND1=`DE’AND I_LFA1-REGIO=` ‘.Message ‘Region is mandatory for GERMAN VENDORS’ TYPE ‘E’.ENDIF.

ENDMETHOD.

SAVE AND ACTIVATE THE METHOD. Click on back Activate the implementation

Step 4: UNIT TESTING

Now test the transaction XKO2 by giving vender country as ‘DE’ and without specifying the region.

The Error message is displayed.