Vous êtes sur la page 1sur 12

BADI implementation for transaction FB60

Aim: To create a BADI implementation for FB60 transaction, that does not allow user to create duplication reference for Vendor Invoice Creation. Step1: Keep a break point in CALL METHOD cl_exithandler=>get_class_name_by_interface line inside the get_instance method of the class cl_exithandler in Class builder (SE24).

Step2: Now execute FB60 transaction, you will see the debugger that you set in SE24 transaction. Double click on the changing parameter EXIT_NAME. Press F8 sequentially and make a note of the exit names.

Step3: After you see FB60 just continue with the Vendor Invoice creation and in mean time note all the Exit names that you come through in the debugger. Step4: Give the values for all mandatory fields and press Enter.

Step5: You will get the screen like this and press F9 for Simulate Document Posting.

Step6: You will get the screen as below.

Step7: Save it. The BADIs triggered is as follows. Before SCREEN1 BADI_FDCB_SUBBAS01 BADI_LAYER BADI_FDCB_SUBBAS02 PPA_CUST_BADI BADI_FDCB_SUBBAS03 WRF_PREPAY_INVOICE BADI_FDCB_SUBBAS04 BADI_FDCB_SUBBAS05 ADDR_LANGU_TO_VERS ADDR_PRINTFORM_SHORT BADI_MATN1

Before 2nd Screen: PPA_CUST_BADI FAGL_PERIOD_CHECK FI_TRANS_DATE_DERIVE ADJ_NETDAYS FAGL_SEGMENT_BS_ACC FAGL_DERIVE_SEGMENT FAGL_DERIVE_PSEGMENT CHECK_COBL_ADDON PPA_CUST_BADI SD_COND_ACCESS_A

After Save Button Pressed: Step 8 : FI_RES_ITEM_CURRENCY AC_QUANTITY_GET BADI_PRKNG_NO_UPDATE FM_POP_CORE FMRI FMRE_BUS_PROCESS FAGL_SET_SEGMENT FI_SL_BADI_DOCSELECT FI_SL_BADI_POPER EXIT_XFMPR1_001 BUAVC_CHECK_RESTRICT UKM_R3_ACTIVATE UKM_R3_ACTIVATE CO_DOCUMENT_INFO

Search for the I_COBL field inside any of the methods inside the BADI classes. Shortcut : Once you got the parameter. Goto se19 in create implementation block under classic BADI enter the BADI names one by one and find out weather implementation can be created or not. After doing this you will have very less BADIs now goto SE24 and add cl_ex_(BADI NAME) and check for methods that have the parameter I_COBL. Press Display button.

Press Parameters button.

Step9: After finding the BADI and method in which you want to implement the code. Goto SE19 and create implementation for that particular BADI.

Step10: Press Create Implementation button and press Enter.

Step11: Enter implementation short text and give the Filter Type also.

Step12: Click on interface tab.

Step13: Double click on the method in which you want to write code as decided. You will see the following.

Press Yes button and Save it. Step14:

Write the following code in the method. method IF_EX_FAGL_DERIVE_SEGMENT~GET_SEGMENT. data lt type COBL . select SINGLE XBLNR from bkpf into lt WHERE XBLNR = i_COBL-xblnr. if sy-subrc eq 0. MESSAGE E015(Z1018_SALESORDER_MSG). ENDIF. endmethod. Step15: Save and activate the code and come back. Step16: Activate the Implementation and go to FB60 and try to create Vendor Invoice Creation with the same reference as 100.