BAPI For Vendor Details

Hello Dear folks, If you are looking for BAPI of Vendor Details | BAPI for Vendor Details | BAPI Vendor Details Tutorial Step by Step in SAP ABAP | List of BAPIs for Vendor Details | What is the BAPI to Vendor Details then you will get all the details here in this blog post.

BAPI_CREDITOR_GETDETAIL is a standard SAP BAPI used to fetch detailed information about a vendor (creditor) from the SAP system. This BAPI is essential for applications that require complete vendor master data, such as financial reporting, procurement systems, and vendor management tools.

Key Features

  • Retrieves complete vendor master data (general, company code, and purchasing data).
  • Supports multiple views (accounting, purchasing, banking, etc.).
  • Returns structured data in easy-to-use tables and structures.
  • Works seamlessly in ABAP programs, Fiori apps, and middleware integrations.

Technical Overview

Input Parameters

ParameterDescription
CREDITORVendor account number (required)
COMPANYCODECompany code (optional, filters company-specific data)

Output Structures & Tables

Structure/TableDescription
GENERAL_DATABasic vendor details (name, address, contact)
COMPANY_DATACompany code-specific data (payment terms, reconciliation account)
BANK_DATAVendor bank details
RETURNStatus messages (success/error)

Common Use Cases

  1. Vendor Master Data Display – Fetching vendor details for display in custom reports.
  2. Data Migration & Validation – Verifying vendor data during system migrations.
  3. Integration with External Systems – Sending vendor details to third-party applications.
  4. Automated Vendor Processing – Using vendor data in workflows or approval processes.

ABAP Code Example BAPI_CREDITOR_GETDETAIL

Sample Program to Fetch Vendor Details

REPORT Z_GET_VENDOR_DETAILS.

* Data Declarations
DATA:
  lv_vendor      TYPE BAPI_CREDITOR-creditor,
  ls_general     TYPE BAPI_CREDITOR_GENERAL,
  ls_company     TYPE BAPI_CREDITOR_COMPANY,
  lt_bank_data   TYPE TABLE OF BAPI_CREDITOR_BANK,
  ls_bank        TYPE BAPI_CREDITOR_BANK,
  lt_return      TYPE TABLE OF BAPIRET2,
  ls_return      TYPE BAPIRET2.

* Input Parameter
PARAMETERS p_vendor TYPE LFA1-LIFNR DEFAULT '0000100000'.

START-OF-SELECTION.
  lv_vendor = p_vendor.

* Call BAPI to fetch vendor details
  CALL FUNCTION 'BAPI_CREDITOR_GETDETAIL'
    EXPORTING
      creditor     = lv_vendor
    IMPORTING
      general_data = ls_general
      company_data = ls_company
    TABLES
      bank_data    = lt_bank_data
      return       = lt_return.

* Error Handling
  READ TABLE lt_return INTO ls_return WITH KEY type = 'E'.
  IF sy-subrc = 0.
    WRITE: / 'Error:', ls_return-message.
  ELSE.
* Display Vendor General Data
    WRITE: / 'Vendor Details:', /.
    WRITE: / 'Vendor Number:', ls_general-creditor.
    WRITE: / 'Name:', ls_general-name.
    WRITE: / 'Street:', ls_general-street.
    WRITE: / 'City:', ls_general-city.
    WRITE: / 'Country:', ls_general-country.

* Display Company Code Data (if provided)
    IF ls_company IS NOT INITIAL.
      WRITE: / / 'Company Code Data:', /.
      WRITE: / 'Company Code:', ls_company-companycode.
      WRITE: / 'Payment Terms:', ls_company-payment_terms.
      WRITE: / 'Reconciliation Account:', ls_company-reconciliation_acct.
    ENDIF.

* Display Bank Details (if available)
    IF lt_bank_data IS NOT INITIAL.
      WRITE: / / 'Bank Details:', /.
      LOOP AT lt_bank_data INTO ls_bank.
        WRITE: / 'Bank Key:', ls_bank-bank_key.
        WRITE: / 'Bank Account:', ls_bank-bank_account.
        WRITE: / 'Bank Name:', ls_bank-bank_name.
        WRITE: / 'IBAN:', ls_bank-iban.
        WRITE: / 'SWIFT/BIC:', ls_bank-swift_code.
        WRITE: / '-----------------------------------'.
      ENDLOOP.
    ENDIF.
  ENDIF.

Explanation of the Code

  1. Input Handling – The program accepts a vendor number (p_vendor) as input.
  2. BAPI Call – Executes BAPI_CREDITOR_GETDETAIL to fetch vendor details.
  3. Output Processing – Displays:
    • General data (name, address, country)
    • Company code data (payment terms, reconciliation account)
    • Bank details (IBAN, SWIFT, bank account)
  4. Error Handling – Checks for errors in the RETURN table.

BAPI_CREDITOR_GETDETAIL is a powerful tool for retrieving complete vendor master data in SAP. It is widely used in custom reports, interfaces, and data migration scenarios.

For bulk operations, consider combining it with:

  • BAPI_CREDITOR_GETLIST (to fetch multiple vendors)
  • BAPI_TRANSACTION_COMMIT (if updating vendor data)

Leave a Comment