Hello Dear folks, If you are looking for BAPI of Vendor matchcode | BAPI for Vendor matchcode | BAPI Vendor matchcode Tutorial Step by Step in SAP ABAP | List of BAPIs for Vendor matchcode | What is the BAPI to Vendor matchcode then you will get all the details here in this blog post.
BAPI_CREDITOR_FIND is a standard SAP Business Application Programming Interface (BAPI) used to search for vendors (creditors) based on various search criteria such as vendor number, name, tax number, or other key identifiers. This BAPI is particularly useful in scenarios where you need to dynamically retrieve vendor information without knowing the exact vendor number, making it ideal for lookup functionalities in custom SAP applications or interfaces.
Key Features of BAPI_CREDITOR_FIND
- Flexible Search Criteria – Allows searching by vendor number, name, tax ID, postal code, and more.
- Multiple Output Options – Returns a list of matching vendors with key details.
- Pagination Support – Can limit the number of results returned for performance optimization.
- Integration-Friendly – Works well in custom ABAP programs, Fiori apps, and middleware integrations.
Technical Details
Input Parameters
Parameter | Description |
---|---|
SEARCH_TERM | General search term (e.g., vendor name or partial number) |
MAX_ROWS | Maximum number of results to return (prevents excessive data retrieval) |
COMPANYCODE | Filters vendors by company code |
POSTALCODE | Searches by postal code |
CITY | Searches by city |
TAX_NUMBER | Searches by tax identification number |
Output Structure
The BAPI returns a table CREDITOR_LIST
containing:
Field | Description |
---|---|
CREDITOR | Vendor account number |
NAME | Vendor name |
CITY | Vendor city |
POSTAL_CODE | Postal code |
STREET | Street address |
COUNTRY | Country code |
TAX_NUMBER | Tax identification number |
Additionally, the RETURN
parameter provides status messages (success/error).
Common Use Cases
- Vendor Search in Custom Transactions – Enables users to search for vendors in custom ABAP reports or dialog programs.
- Data Migration & Validation – Helps verify vendor data during migration projects.
- Integration with External Systems – Used in middleware (e.g., SAP PI/PO, CPI) to fetch vendor details.
- Fiori Apps & Web Services – Supports vendor lookups in SAPUI5 or REST APIs.
ABAP Code Example BAPI_CREDITOR_FIND
Below is a sample ABAP program demonstrating how to use BAPI_CREDITOR_FIND
:
REPORT Z_VENDOR_SEARCH.
DATA:
lt_creditor_list TYPE TABLE OF BAPI_CREDITOR_FIND_LIST,
ls_creditor TYPE BAPI_CREDITOR_FIND_LIST,
ls_return TYPE BAPIRET2,
lv_max_rows TYPE I VALUE 100.
PARAMETERS: p_search TYPE STRING LOWER CASE DEFAULT '*'.
START-OF-SELECTION.
CALL FUNCTION 'BAPI_CREDITOR_FIND'
EXPORTING
SEARCH_TERM = p_search
MAX_ROWS = lv_max_rows
IMPORTING
RETURN = ls_return
TABLES
CREDITOR_LIST = lt_creditor_list.
IF ls_return-type = 'E'.
WRITE: / 'Error:', ls_return-message.
ELSE.
IF lt_creditor_list IS INITIAL.
WRITE: / 'No vendors found matching the search criteria.'.
ELSE.
LOOP AT lt_creditor_list INTO ls_creditor.
WRITE: /
'Vendor:', ls_creditor-CREDITOR,
'Name:', ls_creditor-NAME,
'City:', ls_creditor-CITY,
'Country:', ls_creditor-COUNTRY.
ENDLOOP.
ENDIF.
ENDIF.
Explanation of the Code:
- Input Handling – The program accepts a search term (
p_search
) which can be a partial vendor name or number. - BAPI Call – Executes
BAPI_CREDITOR_FIND
with the search term and a row limit. - Output Handling – Displays vendor details if found, or an error message if no results are available.
BAPI_CREDITOR_FIND
is a powerful tool for vendor lookups in SAP, enabling dynamic searches based on various criteria. By integrating it into custom ABAP programs or interfaces, businesses can enhance user experience and streamline vendor data retrieval.