In case you wish to extract the Bank Data for a particular customer, you can use the following BAPI. This BAPI extracts the Customer's Address, General Data, Company Code Data and the Bank Details.
SAP ABAP to get customer Bank Details
BAPI_CUSTOMER_GETDETAIL2
For reference please find below the transaction codes to Create/Change/Display a customer
VD01 Create Customer Sales and Distribution VD02 Change Customer Sales and Distribution VD03 Display Customer Sales and Distribution
Also Find below the tables related to the BAPI BAPI_CUSTOMER_GETDETAIL2
KNBK-Customer Master (Bank Details) ADRC- Addresses (central address admin.) KNA1-General Data in Customer Master KNB1-Customer Master (Company Code)
The following code extracts the above mentioned details from the SAP R/3 System
REPORT ZEX_CUSTOMERBANK .
Parameters: p_kunnr like BAPICUSTOMER_ID-CUSTOMER, p_bukrs like BAPICUSTOMER_ID-COMP_CODE.
Data: ty_knbk type knbk, ty_custadd type BAPICUSTOMER_04, ty_custgendet type BAPICUSTOMER_KNA1, ty_custcompdet type BAPICUSTOMER_05, d_ret like BAPIRET1.
Data: wa_custadd like ty_custadd, wa_custgendet like ty_custgendet, wa_custcompdet like ty_custcompdet.
Always use Pretty Printer and Extended Program Check before releasing the code.
Do not leave unused code in the program. Comment the code thoroughly. Align the comments and the Code. Follow the SAP Standards and SAP Best Practices guidelines. It’s a good practice to take a dump of the code on your local drive.
No comments:
Post a Comment