Real time example of using BADI in SAPReal time example of BADI for Vendor Master (Xk01) in SAP, BADI implementation for XK01 Requirement: Raise an error message whenever the vendor belongs to German and region is not specified. Requirement analysis In SAP vendors are created using T-code XK01, the created vendors will be stored in LFA1 (Vendor Master Table), so we need to add custom functionality to validate region when creating vendor using XK01 (also when changing in XK02), to do this we go for BADI. To implement the BADI for XK01 we need to follow the below steps. Step1: Find the BADI. Step2: Select suitable BADI. Step3: Implement the BADI. Step4: Test the BADI. Find the BADI for XK01/XK02 First step to implement BADI is finding the badi . Go to SE24 and put the break point in GET_INSTANCE method of CL_EXITHANDLER class. Go to LFA1, take a vendor no and go to XK02, provide vendor no, enter. . change any one value and click on Save (Ctrl S).You will go to next screen. The break-point will be triggered. note down all BADI names. Below are the list of BADI`s you will get . VENDOR_FIELDSTATUS GOS_SRV_SELECT ADDRESS_CHECK ADDR_TXJCD_CHECK CVI_CALL_BTE ADDRESS_UPDATE VENDOR_ADD_DATA Select the suitable BADI and verify the BADI To select the suitable BADI. display . provide BADI name. go to SE18. Based on description and interface signature (importing and exporting parameters) we can choose and verify some BADI`s . Now VENDOR_ADD_DATA will be useful for our requirement. Implement the BADI . continue. to implement the BADI. A popup will open. based on description choose a method and double click to add owr own code. so double click on CHECK_ALL_DATA. . create implementation. provide an implementation name ex: ZVENDOR_ADD_DATA. provide BADI name. BADI is nothing but an interface. Provide short description.BADI uses object oriented concepts. we need to create implementation for the interface. To implement the BADI go to SE19 (BADI Builder). Here CHECK_ALL_DATA will be useful for final checks. go back activate the implementation. go to XK02. select address check box. . Go to XK02. Now our break point will trigger. Save. Now BADI is implemented.METHOD IF_EX_VENDER_ADD_DATA~CHECK_ALL_DATA. so we can implement this because this is very much suitable for our requirement. Remove the break point and write the below code for implementing exit. Test the BADI To test the BADI. MESSAGE 'Region is required for German Vendors' TYPE 'E'. Change country to DE and Region to Space. provide a vendor no. save. provide vendor no. METHOD IF_EX_VENDER_ADD_DATA~CHECK_ALL_DATA. activate the method. BREAK-POINT. change any one. enter. IF I_LFA1=LAND1=`DE’AND I_LFA1-REGIO=` ‘. ENDMETHOD. You will get an error message. Save (Ctrl S). ENDMETHOD. .The BADI is implemented successfully.