BAPI For Company Code Details

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

BAPI_COMPANYCODE_GETDETAIL is a standard SAP BAPI used to retrieve detailed information about a company code in the SAP system. It belongs to the FI (Financial Accounting) module and is often used in both custom SAP development and external integrations.

Purpose of BAPI_COMPANYCODE_GETDETAIL

The BAPI is used to:

  • Fetch detailed data for a given company code (BUKRS)
  • Display or use company code info in custom reports, applications, or interfaces
  • Validate that a company code exists and retrieve additional metadata
  • Support integration scenarios, such as external systems needing to display or process SAP company code info

What Data Does It Return?

The BAPI returns details like:

FieldDescription
Company nameLong and short names of the company
CountryCountry key of the company code
CityLocation of headquarters
CurrencyLocal currency used for transactions
LanguageCommunication language
Fiscal year variantControls fiscal period logic
Address detailsStreet, postal code, region, etc.

Basic BAPI Example

DATA: ls_detail TYPE bapi0012_cocode_detail,
      lt_return TYPE TABLE OF bapiret2,
      ls_return TYPE bapiret2.

CALL FUNCTION 'BAPI_COMPANYCODE_GETDETAIL'
  EXPORTING
    companycode      = '1000'
  IMPORTING
    companycodedetail = ls_detail
  TABLES
    return           = lt_return.

READ TABLE lt_return INTO ls_return WITH KEY type = 'E'.
IF sy-subrc = 0.
  WRITE: 'Error: Company code not found or invalid.'.
ELSE.
  WRITE: 'Company Code: ', ls_detail-comp_name,
         'Currency: ',     ls_detail-currency,
         'City: ',         ls_detail-city.
ENDIF.

Common Use Cases

Use CaseDescription
Master Data ReportsPull company code info into custom FI reports
Fiori/UI5 AppsDisplay company metadata in custom SAP UI
Interfaces/IntegrationsExternal systems can fetch company details via RFC or web service
Validation + Info RetrievalCombine data checks with descriptive metadata

Leave a Comment