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 customerXD01 Create Customer Complete
XD02 Change Customer Complete
XD03 Display Customer Complete
XD02 Change Customer Complete
XD03 Display Customer Complete
VD01 Create Customer Sales and Distribution
VD02 Change Customer Sales and Distribution
VD03 Display Customer Sales and Distribution
VD02 Change Customer Sales and Distribution
VD03 Display Customer Sales and Distribution
KNBK-Customer Master (Bank Details)
ADRC- Addresses (central address admin.)
KNA1-General Data in Customer Master
KNB1-Customer Master (Company Code)
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.
Data: int_knbk like ty_knbk occurs 0.
CALL FUNCTION 'BAPI_CUSTOMER_GETDETAIL2'
EXPORTING
CUSTOMERNO = p_kunnr
COMPANYCODE = p_bukrs
IMPORTING
CUSTOMERADDRESS = wa_custadd
CUSTOMERGENERALDETAIL = wa_custgendet
CUSTOMERCOMPANYDETAIL = wa_custcompdet
RETURN = d_ret
TABLES
CUSTOMERBANKDETAIL = int_knbk .
if sy-subrc = 0.
Endif.
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.
Data: int_knbk like ty_knbk occurs 0.
CALL FUNCTION 'BAPI_CUSTOMER_GETDETAIL2'
EXPORTING
CUSTOMERNO = p_kunnr
COMPANYCODE = p_bukrs
IMPORTING
CUSTOMERADDRESS = wa_custadd
CUSTOMERGENERALDETAIL = wa_custgendet
CUSTOMERCOMPANYDETAIL = wa_custcompdet
RETURN = d_ret
TABLES
CUSTOMERBANKDETAIL = int_knbk .
if sy-subrc = 0.
Endif.
No comments:
Post a Comment