cancel
Showing results for 
Search instead for 
Did you mean: 

DOCUMENT NUMBER GENERATION USING BAPI_ACC_DOCUMENT_POST.

Basant_Joshi
Participant
1,683

INTRODUCTION

BAPI_ACC_DOCUMENT_POST is a standard SAP interface that allows you to post financial documents directly from an external system (like a non-SAP system) into SAP. This BAPI (Business Application Programming Interface) is primarily used for integrating external systems with SAP's Financial Accounting (FI) module.

Here are some common purposes for using BAPI_ACC_DOCUMENT_POST:

  1. Integration: It enables seamless integration between SAP and non-SAP systems for financial document posting. This is particularly useful when companies have legacy systems or third-party applications that need to interact with SAP FI.

  2. Automation: The BAPI allows for automating the posting of financial documents, reducing manual effort and potential errors. This is useful for high-volume transaction environments where manual entry is impractical.

  3. Data Consistency: By using BAPIs, companies can ensure data consistency between SAP and other systems. This helps in maintaining accurate financial records across the organization.

  4. Real-time Processing: BAPI_ACC_DOCUMENT_POST facilitates real-time posting of financial documents, ensuring that transactions are reflected immediately in the SAP system. This supports timely decision-making and reporting.

  5. Custom Applications: Developers can leverage this BAPI to build custom applications that interact with SAP FI, tailored to specific business needs.

  6. Batch Processing: While it supports real-time processing, the BAPI can also be used for batch processing of financial documents, allowing for efficient handling of large volumes of data.

IMPLEMENTATION

STEP 1 :-  Go to tcode - se37 (Function Builder)

 

  • In se37 we will display our Bapi  BAPI_ACC_DOCUMENT_POST.

 

Basant_Joshi_0-1712148296636.png

 

  •  Execute The Source Code.

 

  • Screenshot 2024-04-03 181824.pngA new window will appear where now we have to enter data to generate the document number. 

 

Basant_Joshi_1-1712148395864.png

 

 

STEP 2) :-  ENTER THE MANDATORY FIELDS REQUIRED TO POST THE DOCUMENT NUMBER IN BKPF TABLE.

IMPORTING PARAMETERS

Header Data

All mandatory fields are required in the Document header.

FIELD NAME

User Name

USNAM

Company Code

COMP_CODE

Document Date

DOC_DATE

Posting Date

PSTING_DATE

Document Type

DOC_TYPE

 

TEST DATA:

USNAM

COMP_CODE

DOC_DATE

PSTING_DATE

DOC_TYPE

BASANTJ

1710

13.03.2024

13.03.2024

RV

 

Basant_Joshi_2-1712149353489.png

 

 

TABLES:

 

1)      ACCOUNTGL 

Description

Parameter for transferring G/L account line items

The following field must be filled out:

The currency fields are not contained in this parameter. They must be transferred separately in the parameter CurrencyAmount for the various currency types and currencies. The system creates a link to the relevant line item via the line item number ITEMNO_ACC, which for this reason must be unique for each line item.

FIELD NAME

Item account number

ITEMNO_ACC

GL account

GL_ACCOUNT

Item text

ITEM_TEXT

Company code

COMP_CODE

Posting date

PSTNG_DATE

 

TEST DATA

ITEMNO_ACC

GL_ACCOUNT

ITEM_TEXT

COMP_CODE

PSTNG_DATE

0000000001

10010001

LINE ITEM 1

1710

13.03.2024

 

Basant_Joshi_3-1712149371497.png

2)      Account receivable

Description

Parameter for transferring customer line items

If the CUSTOMER number is not given, only the general ledger is updated. In this case, an entry must be made in the field GL_ACCOUNT (G/L account for general ledger accounting).

The currency fields are not contained in this parameter. They must be transferred separately in the parameter CurrencyAmount for the various currency types and currencies. The system creates a link to the relevant line item via the line item number ITEMNO_ACC, which for this reason must be unique for each line item.

 

FIELD NAME

Item account number

ITEMNO_ACC

Customer number

CUSTOMER

Reference key

REF_KEY_1

Company code

COMP_CODE

Item text

ITEM_TEXT

 

TEST DATA

ITEMNO_ACC

CUSTOMER

REF_KEY_1

COMP_CODE

ITEM_TEXT

0000000002

17100001

XYZ_TEST_2

1710

CUSTOMER ENTRY

 

Basant_Joshi_4-1712149452757.png

3)      Currency Amount

 

Description

This parameter describes the currency fields for a particular line item.
The parameter is a required field for the method POST. If the parameter is not maintained for the method CHECK, only a general account assignment check is carried out. Individual line items or several documents can be checked at once in this way.

The following fields must be filled out:

Value range

The field CURR_TYPE  (currency type) describes the role played by a currency in the SAP System.
The currency type can take on the following values, for example:

  • 00      Transaction currency
  • 10      Company code currency
  • 20      Controlling area currency
  • 30      Group currency
  • 40      Hard currency
  • 50      Index-based currency
  • 60      Global company currency

If an entry is not made in the field CURR_TYPE , the default value "00" is retained.

If only one data record is transferred in transaction currency for each line item, the field CURR_TYPE does not need to be filled out. If several data records are transferred for each line item, the currency type must be entered for each record.

FIELD NAME

Items account number

ITEMNO_ACC

Currency

CURRENCY

Amount

AMT_DOCCUR

 

TEST DATA

ITEMNO_ACC

CURRENCY

AMT_DOCCUR

0000000001

USD

2.000,0000-

0000000002

USD

  2.000,0000

 

Basant_Joshi_5-1712149452760.png

 

Exporting Parameters.

The information from this document must be transferred when the FI/CO interface is called up. The source information is updated in all accounting documents, and is made up of the following fields.

The reference key is made up of:

    • AWREF Reference document number (10 digits)
      Source document number
    • AWORG Reference organizational unit (10 digits)
      Number range ID (if required)

 

Basant_Joshi_6-1712149452762.png

 

Posting Document Number.

  1. First go to se37 and click on function module.

Screenshot 2024-04-03 183908.png

 

Screenshot 2024-04-03 184011.png

Screenshot 2024-04-02 153942.png

 

 

  • Upload Your test data directory and execute it press back and again execute it to final commit the changes in BKPF table ( For which we used BAPI_TRANSACTION_COMMIT ).

 

Basant_Joshi_8-1712149452774.png

  • Now go to BKPF Table To find the entry.
  • Further Odata can be created using BKPF and BSEG tables.

The Data will be stored in BKPF and BSEG  table.

Basant_Joshi_9-1712149452792.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Accepted Solutions (0)

Answers (2)

Answers (2)

SapnaChauhan
Explorer
0 Kudos

Great  !!!

Basant_Joshi
Participant
0 Kudos
Thanks
Chetan_Bhatt
Explorer
0 Kudos

Stuck in this BAPI, Now I think I can resolve the issue

Basant_Joshi
Participant
0 Kudos
Thanks for the response.