BAPI for Company Code: Posting Date

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

BAPI_COMPANYCODE_GET_PERIOD is a standard SAP BAPI that allows you to retrieve the open posting periods for a specific company code. This BAPI is primarily used in the Financial Accounting (FI) module to get information about the periods in which financial transactions can be posted. It’s useful for ensuring that a transaction or entry can be posted within a valid open period.

Purpose of BAPI_COMPANYCODE_GET_PERIOD

The BAPI’s main use is to:

  • Get the list of open posting periods for a given company code
  • Ensure that transactions or documents are posted within open accounting periods
  • Validate whether a posting period is open or closed, which is critical for accounting accuracy
  • Retrieve fiscal period details for reporting, validation, or auditing purposes

What Data Does It Return?

The function returns details about the open posting periods for the specified company code.

Key data typically includes:

FieldDescription
COMP_CODECompany Code (BUKRS)
FISC_YEARFiscal year for the open period
PERIODThe period number (1-12 for monthly periods)
OPEN_PERIODIndicator for whether the period is open or closed
FROM_DATEStart date of the period
TO_DATEEnd date of the period

ABAP Code Example of BAPI_COMPANYCODE_GET_PERIOD

DATA: lt_periods TYPE TABLE OF bapi_fiscper_period,
      ls_period  TYPE bapi_fiscper_period.

CALL FUNCTION 'BAPI_COMPANYCODE_GET_PERIOD'
  EXPORTING
    companycode = '1000'  " Specify the company code
  TABLES
    period_list = lt_periods.

LOOP AT lt_periods INTO ls_period.
  WRITE: / 'Company Code:', ls_period-comp_code,
         'Fiscal Year:', ls_period-fisc_year,
         'Period:', ls_period-period,
         'Open Period:', ls_period-open_period.
ENDLOOP.
  • companycode: The company code whose open periods you want to check.
  • period_list: The table where the function returns the list of open posting periods for the specified company code.
  • open_period: This indicates whether the period is open (X = open, blank = closed).

Use Cases of BAPI_COMPANYCODE_GET_PERIOD

Use CaseDescription
Transaction validationEnsure that users can only post transactions to open periods
Period controlAllow or restrict posting based on company code and fiscal period
Reporting and auditingGenerate reports showing open and closed periods for different company codes
Integration with external systemsSync period information with external financial systems or third-party applications

BAPI_COMPANYCODE_GET_PERIOD is a highly useful tool in SAP to:

  • Verify open posting periods for transactions
  • Validate that entries are posted within the correct fiscal periods
  • Provide period details for reporting and external integrations

By leveraging this BAPI, you can build better controls and validations around period management, ensuring that your financial transactions are always aligned with the correct fiscal periods.

Leave a Comment