BAPI for List of Company Codes

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

BAPI_COMPANYCODE_GETLIST is a standard SAP BAPI used to retrieve a list of all company codes available in the SAP system. It’s part of the FI (Financial Accounting) module and is typically used when you want to present a list of valid company codes for selection, reporting, or integration purposes.

Purpose of BAPI_COMPANYCODE_GETLIST

The primary purpose of this BAPI is to:

  • Fetch all company codes configured in the system
  • Provide a list for dropdowns, selection screens, or external applications
  • Initialize data for reports or batch programs
  • Serve as a master data source for integration with third-party systems

What Data Does It Return?

It returns a table of basic company code data:

FieldDescription
COMP_CODECompany Code key (e.g., 1000, 2000)
COMP_NAMECompany Code name (short description)

ABAP Example for BAPI_COMPANYCODE_GETLIST

DATA: lt_company_list TYPE TABLE OF bapi0012_companycode_list,
      ls_company      TYPE bapi0012_companycode_list.

CALL FUNCTION 'BAPI_COMPANYCODE_GETLIST'
  TABLES
    companycode_list = lt_company_list.

LOOP AT lt_company_list INTO ls_company.
  WRITE: / 'Company Code:', ls_company-comp_code,
           'Name:',         ls_company-comp_name.
ENDLOOP.

Typical Use Cases For BAPI_COMPANYCODE_GETLIST

Use CaseDescription
Dropdown listsPopulate company code selectors in SAP GUI, Web Dynpro, or Fiori apps
Reporting toolsUse as a source for reporting filters or initial selections
System integrationSupply valid company code options to external systems
Master data validationList available company codes for internal consistency checks

BAPI_COMPANYCODE_GETLIST is the go-to BAPI for retrieving a list of company codes. It’s simple, fast, and essential when building:

  • Selection UIs
  • Report filters
  • Integration tools
  • Data validation features

If you’re working with company codes in any scalable or dynamic context, this BAPI is one of the first tools you’ll want to use.

Leave a Comment