Document Using BAPI

Post FI document using BAPI


The accounts record the change of values ​​in a code company, arising out of commercial transactions. They consist of one or more positions (reservations), booked from each of which a single transaction to an account. When posting an accounting document, the system updates the SAP transactions in the financial statements to which the accounting document posted. An document is a representation of the SAP (e.g. an invoice), which has enabled the booking.
BAPI 'BAPI_ACC_DOCUMENT_POST "acts as an interface between the code and standard transactions FB01/FB50.
This document describes the various phases, an FI document using BAPI 'BAPI_ACC_DOCUMENT_POST' from one place file. This Excel is useful for SAP Technical Consultants as to check the details of all the necessary parameters and data contained in document posting and validation, if the GL account in which we will publish the quantities available in the SAP database. Transaction code for the FI documents are FB01/FB50 (Create), FB02 (Change) and FB03 (Display). In a document cannot be booked more than 999 items, because BAPI can write up to 999 lines in a document. The file must be balanced so that the document will be published, i.e. the amount of the loan and the amount of debt must be equal. In FI document header table BKPF and BSEG table data element.


They are involved in various stages of the booking of a document from a file:
1 Loading Data from Excel file described in an internal table using FM ‘GUI_UPLOAD’ as explained in subroutine UPLOAD_FORM_EXCEL.
2 After you load Excel data into an internal table that we need, divide the data in the model field in the header data and item data, as explained in sub-program "SPLIT_INTO_RECORDS. This division is in my file format. In the data file header line # 2, the date and the code of the head detachment '.'S why I When using 2. And all the other information available to the lines described as CASE. Items details from line number 14, which is the reason LOOP AT t_upload IN w_upload OF 14is used. Users can split the data according to their file format.
3 After the division cycle of the table and the validation of account numbers GL entry. If you apply the GL accounts, please fill the position data in BAPI GL and currency tables add another GL account that the number of error messages table. This is declared in subroutines "VALIDATE_GL 'and' POPULATE_BAPI '.
4 In the case of inter company adjustments in the position and heading of the company codes are different. Discover postal company currency code and compare key if you specify the key element for the currency and the currency code header the same or different. If they are different, then we need to fill the area of ​​the table Currency 'exchange rate' if it is given in the file. Otherwise the BAPI you take the exchange rate between two currencies and conversion.
5 Before the step is necessary because a document stored in document 3 currencies currency, company code currency and the control area. In the case of intra-company code Ads all currencies are equal, so the quantities are the same in currencies all3. But in the case of inter-code records, the currencies are different, so the amounts are different. For this reason, we have to give, and the basis on which the exchange rate to convert amounts BAPI.
6 The next step in the posting document is to verify the data with BAPI 'BAPI_ACC_DOCUMEN_CHECK. If this BAPI does not return an error message, go to the next step otherwise given BAPI error message display.
7 Publish document with BAPI 'BAPI_ACC_DOCUMEN_POST. Check if sy-subrc when you begin, undertake the work with 'BAPI_TRANSACTION_COMMIT. This step is explained in POST_DOCUMENT subroutine. "'The provision of data header W_HEADER work does not offer OBJ_KEY, OBJ_TYPE and OBJ_SYS, are automatically filled by BAPI.


This document describes the various steps involved in the FI document posting from an Excel file. The main steps are involved, the uploading and sharing of data in internal table complete the data in tables and BAPI call to sign the documents and the transaction is committed. A sample source code specified for the reference.

Note: For messages intercompany code, if the exchange rate between two currencies in the file dates, programmers should be only given to the exchange rate. Currency conversion value will be guided by the BAPI. In addition, the configurations of group field status of the GL accounts are not considered to be bypassed as BAPI, but these are to be done at the time of booking with FB50.