INTRODUCTION:
The accounting documents record changes in values in a company code arising from accounting transactions. They consist of one or more line items (postings), each of which represents an individual transaction posted to an account. When posting an accounting document, the SAP system updates the transaction figures in the accounts to which the document is posted.An accounting document is a representation within the SAP System of the document (for example, an invoice) that triggered the posting.
BAPI ‘BAPI_ACC_DOCUMENT_POST’ acts as the interface between your code and standard transactions FB01/FB50.
This document explains the various steps involved to post a FI document using BAPI ‘BAPI_ACC_DOCUMENT_POST’ from an excel file.This is helpful to SAP Technical consultants as it gives the details of all the required parameters and data in document posting and validation to check if the GL account in which we are posting amounts is present in SAP database. Transaction code for FI documents are FB01/FB50(Create), FB02(Change) and FB03(Display). In one document, more than 999 line item cannot be posted because BAPI can post up to 999 lines in one document. The file should be balanced for the document to be posted i.e. credit amount and debit amount should be equal. In FI, header table for document data is BKPF and line item table is BSEG.
BAPI ‘BAPI_ACC_DOCUMENT_POST’ acts as the interface between your code and standard transactions FB01/FB50.
This document explains the various steps involved to post a FI document using BAPI ‘BAPI_ACC_DOCUMENT_POST’ from an excel file.This is helpful to SAP Technical consultants as it gives the details of all the required parameters and data in document posting and validation to check if the GL account in which we are posting amounts is present in SAP database. Transaction code for FI documents are FB01/FB50(Create), FB02(Change) and FB03(Display). In one document, more than 999 line item cannot be posted because BAPI can post up to 999 lines in one document. The file should be balanced for the document to be posted i.e. credit amount and debit amount should be equal. In FI, header table for document data is BKPF and line item table is BSEG.
STEPS:
Various steps involved in posting a document from a file are:
1. Upload data from excel file into an internal table using FM ‘GUI_UPLOAD’ as explained in subroutine UPLOAD_FORM_EXCEL.
2. After we upload excel data into an internal table we need split the data into field patterns into header data and line item data as explained in subroutine ‘SPLIT_INTO_RECORDS’. This splitting is done according to my file format. In header data in the file in line no.2, posting date and header company code. That is why I have used case when 2. And all the other information is present at the lines as described by CASE statement. Line item details start from line number 14, that’s why LOOP AT t_upload INTO w_upload FROM 14is used. User can split the data according to their file format.
3. After the splitting, loop at the line item table and validate the GL account numbers. If the GL accounts are valid, Populate the line item data into BAPI GL and currency tables otherwise append that GL account number into error message table. This is explained in subroutines ‘VALIDATE_GL’ and ‘POPULATE_BAPI’.
4. In case of intercompany postings, in which line item and Header Company codes are different. Find out line item company code currency key and compare if the line item currency key and header currency key given is same or different. If these are different then we need to populate ‘EXCHANGE_RATE’ field of currency table if it is given in the file. Otherwise BAPI itself will fetch the exchange rate between 2 currencies and do the conversion.
5. Above step is required because a document is posted in 3 currencies document currency, company code currency and group currency. In case of the intra company code postings all the currencies are same so the amounts are same In all3 currencies. But in case of inter company code postings the currencies are different so the amounts are also different. Due to this we need to give and exchange rate base on which the BAPI will convert the amounts.
6. Next step in document posting is to check the data using BAPI ‘BAPI_ACC_DOCUMEN_CHECK’. If this BAPI do not return any error message, go to next step otherwise display error message given by BAPI.
7. Post the document using BAPI ‘BAPI_ACC_DOCUMEN_POST’. Check for sy-subrc, if initial; commit the work using ‘BAPI_TRANSACTION_COMMIT’. This step is explained in subroutine ‘POST_DOCUMENT’. While providing header data in W_HEADER work area do not provide OBJ_KEY, OBJ_TYPE and OBJ_SYS, these are automatically populated by BAPI.
SUMMARY:
This document explains the various steps involved in FI document posting from excel file. Main steps involved are uploading and splitting data into internal table, Populate data into BAPI tables and call BAPI to post the documents and committing the transaction. A sample source code is given for the references.
Note:In case of intercompany code postings, if the exchange rate between 2 currencies is given in the file, programmer should pass only the exchange rate given. Currency value conversions will be done by the BAPI. Also Field status group configurations of GL accounts are not considered by BAPI as it is bypassed by BAPI, but these are considered when doing posting using FB50.
Note:In case of intercompany code postings, if the exchange rate between 2 currencies is given in the file, programmer should pass only the exchange rate given. Currency value conversions will be done by the BAPI. Also Field status group configurations of GL accounts are not considered by BAPI as it is bypassed by BAPI, but these are considered when doing posting using FB50.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.