58 Flares Twitter 0 Facebook 55 Google+ 3 LinkedIn 0 Email -- Pin It Share 0 58 Flares ×

Contributed By Sujith Reddy

OBJECT:

Implement the BADI for to download the vendor key information in a excel sheet at the time of saving the created vendor.

KEY INFORMATION FIELDS:

1)      vendor number

2)      company code

3)      account group

4)      name

5)      search term

6)      street

7)      country

8)      postal code

9)      recon account

10)   cash management group or planning group

11)   created by

12)   date.

STEPS TO IDENTIFY THE BADI:

Step 1: Execute SE24, provide class name (Object type) as CL_EXITHANDLER and click on Display button.

How to Find BADI in SAP ABAP1Step 2: Double click on GET_INSTANCE method.

Step 3: Select the first call method and click on stop button (break point).

How to Find BADI in SAP4Step 4: Execute our required transaction in a new session for which transaction we want to identify the BADI (/OXK01).

Step5: Identify the EXIT_NAME  as a BADI name and continuously click on F8 to find next BADI name.

Step 6: Identify the all the BADI related to the transaction and maintain all the transaction in excel sheet.

How to Find BADI in SAP7For this requirement

BADI NAME:  VENDOR_ADD_DATA

METHOD NAME : CHECK_ALL_DATA.

STEPS TO IMPLEMENT THE BADI:

Step 1: Execute SE19, select classic BADI radio button at the down of the window and provide your BADI name—VENDOR_ADD_METHOD

Step 2: click on create implementation.

BADI Real Time Scenarios 1Step 3: provide implementation name (Provide any name starts with Z (or) Y). i.e ZSAI_BADI.

BADI Real Time Scenarios

Step 4: Press enter.

BADI Real Time Scenarios 1Step 5: provide short text, click on save and press enter.

BADI Real Time Scenarios 2Step 6: click on create enhancement implementation and provide implementation name as the above name. (ZSAI_BADI)

Step 7 : Select the implementation name and press enter button.

BADI Real Time Scenarios 3Step 8: click on interface tab.

BADI Real Time Scenarios 4Step 9: double click on CHECK_ALL_DATA method.

BADI Real Time Scenarios 5Step 10: click on signature in the application tool bar and identify the import export parameter.

Step 11: Implement the logic.

BADI Real Time Scenarios 6PROGRAM:

method IF_EX_VENDOR_ADD_DATA~CHECK_ALL_DATA.

TYPES : BEGIN OF TY_VEN,

LIFNR TYPE LIFNR,

BUKRS TYPE BUKRS,

KTOKK TYPE KTOKK, “ACC GROUP

NAME1 TYPE NAME1,

SORTL TYPE SORTL, “Search term

STRAS TYPE STRAS, “Street

LAND1 TYPE LAND1,

PSTLZ TYPE PSTLZ, “Postal code

AKONT TYPE AKONT, “Recon

FDGRV TYPE FDGRV, “Cash Management group

CBY   TYPE SYUNAME,

CDAT(10) TYPE C,

END OF TY_VEN.

DATA IT_VEN TYPE TABLE OF TY_VEN.

DATA WA_VEN TYPE TY_VEN.

 

WA_VEN-LIFNR = I_LFA1-LIFNR.

WA_VEN-BUKRS = I_LFB1-BUKRS.

WA_VEN-KTOKK = I_LFA1-KTOKK.

WA_VEN-NAME1 = I_LFA1-NAME1.

WA_VEN-SORTL = I_LFA1-SORTL.

WA_VEN-STRAS = I_LFA1-STRAS.

WA_VEN-LAND1 = I_LFA1-LAND1.

WA_VEN-PSTLZ = I_LFA1-PSTLZ.

WA_VEN-AKONT = I_LFB1-AKONT.

WA_VEN-FDGRV = I_LFB1-FDGRV.

WA_VEN-CBY   = SY-UNAME.

WA_VEN-CDAT  = SY-DATUM.

APPEND WA_VEN TO IT_VEN.

CLEAR WA_VEN.

 

CALL FUNCTION ‘GUI_DOWNLOAD’

EXPORTING

FILENAME                 = ‘C:\VENAUDIT.XLS’

APPEND                   = ‘X’

WRITE_FIELD_SEPARATOR    = ‘X’

TABLES

DATA_TAB                 = IT_VEN   .

REFRESH IT_VEN.

endmethod.

NOTE: APPEND = ‘X’ Is used to add the present record to the next sequential number in the excel sheet.

Save and activate.

That’s it.

Enjoy 🙂

Also Read:

BADI Real Time Scenarios.

What is BADI? How to Find BADI in SAP ABAP.

58 Flares Twitter 0 Facebook 55 Google+ 3 LinkedIn 0 Email -- Pin It Share 0 58 Flares ×