Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to use this two bapi:BAPI_ACC_DOCUMENT_POST and BAPI_ACC_GL_POSTING_POST

former_member189009
Active Participant
0 Kudos

As far as I know this two bapi used to create accounting document. But how do we use them ? and what's the different between them?

The most important thing is in what condition we use which bapi to post accounting doc?

Such as there is one requirement to post accounting doc though t-code F-02 in BDC, but how do I know whether I can use this two bapi to replace the BDC?

BAPI_ACC_DOCUMENT_POST

BAPI_ACC_GL_POSTING_POST

4 REPLIES 4

former_member223133
Active Participant
0 Kudos

Hi,

BAPI_ACC_DOCUMENT_POST can be used to post for the below combinations.

  • G/L to G/L Postings
  • G/L to Customer Postings
  • G/L to Vendor Postings

BAPI_ACC_GL_POSTING_POST can be used for only G/L to G/L postings and cannot be used either for G/L to Customer or for G/L to Vendor Postings.

For F-02 transaction, you can proceed with BAPI_ACC_DOCUMENT_POST.

Regards

Gangadhar

former_member201275
Active Contributor
0 Kudos

If you go to SE37 and enter these, then click on "display", then on the top right hand side of the menu bar click on "Function Module Documentation" and you can read how to use these.


Former Member
0 Kudos

Hello,

how we use BAPI_ACC_DOCUMENT_POST:

...

...

   gs_documentheader-ref_doc_no = .... your document number (from number range)

   gs_documentheader-bus_act = 'RFBU'.

   gs_documentheader-username = sy-uname.

   gs_documentheader-header_txt = .... your header text

   gs_documentheader-comp_code = '0001'.

   gs_documentheader-doc_date = ..... date

   gs_documentheader-pstng_date = .... date

   gs_documentheader-fisc_year =.... year

   gs_documentheader-fis_period = .... period

   gs_documentheader-doc_type = 'BS'.

   loop at ... items ... assigning <belpos_line>.

     gs_accountgl-itemno_acc = <belpos_line>-posnr. "10 digits !

     gs_accountgl-bus_area = ... your business area

     gs_accountgl-tax_code = <belpos_line>-tax_code.

     gs_accountgl-gl_account = <belpos_line>-gl_account.

     gs_accountgl-comp_code = ... your company code.

     gs_accountgl-alloc_nmbr = ... some identity number

     gs_accountgl-item_text = .... item text

     gs_accountgl-costcenter = <belpos_line>-kostl.

     gs_accountgl-plant = .... werks

     append gs_accountgl to gt_accountgl.

     gs_currencyamount-itemno_acc = <belpos_line>-posnr.

     gs_currencyamount-currency = ... waers

     gs_currencyamount-amt_doccur = .... waers

     append gs_currencyamount to gt_currencyamount.

   endloop.

   call function 'BAPI_ACC_DOCUMENT_POST'

     exporting

       documentheader = gs_documentheader

     importing

       obj_type       = gd_obj_type

       obj_key        = gd_obj_key

       obj_sys        = gd_obj_sys

     tables

       accountgl      = gt_accountgl

       currencyamount = gt_currencyamount

       return         = gt_return.

...

...

Regards

atul_mohanty
Active Contributor
0 Kudos

Hi -

I believe you want to post GL posting through F-02. You can use 'BAPI_ACC_DOCUMENT_POST'.

Also the 'BAPI_ACC_GL_POSTING_POST' is specifc for GL posting. I have used this FM for FB50 transaction in past.

The BAPI_ACC_GL_POSTING_POST have less parameters in comparison to 'BAPI_ACC_DOCUMENT_POST.

Check in F-02, if you have COPA fields, if that is the case you need to use 'BAPI_ACC_DOCUMENT_POST. Also check for all other fields in F-02 that you are doing in BDC to the 'BAPI_ACC_DOCUMENT_POST.

Please check the documentation for both of these function modules in SE37 transaction, you can have the details there.

BAPI_ACC_DOCUMENT_POST :

Using this method you can create a posing in accounting for certain business transactions.

Possible ( Business Transactions😞

  • Postings that generally only affect the general ledger. (RFBU)
  • Billing: For billing in Sales and Distribution, accounting is supplied with the relevant billing data. (SD00) Billing Document
  • Accounting can use the data of a logistics system that result from an Invoice Receipt. (RMRP)
  • Goods Movement are triggered by transactions in Sales and Distribution or by inventory postings. Within logistics, they lead to a change in the warehouse stocks of <DS:GLOS.Inventory Management>Inventory Management. This results in a posting in accounting. This is why accounting is supplied with the relevant data from logistics. (RMWA)

BAPI_ACC_GL_POSTING_POST :

Accounting: General G/L Account Posting Functionality

You can use this method to update business transactions in Accounting which mainly affect the general ledger and are definitely not updated in subledgers which are relevant to the balance sheet.

An example of this is a provision posting for an expected guarantee service.

This can be produce debit or credit entries to balances which are not managed in one of the subledgers relevant to the balance sheet. This is especially applicable if the balances cannot be represented as assets, customers/vendors, materials, loans, etc.

An example of this is a provision posting for an expected guarantee. However, this can also involve depreciation or write-ups in which values have a higher level of summarization than in the corresponding subledger relevant to the balance sheet in which they are managed.

An example of this is foreign currency revaluation for receivables/ payables caused by considerable exchange rate fluctuations which is not updated in accounts payable or accounts receivable.

A similar transaction may come about when revaluating balances for raw materials if the revaluation takes place at a corresponding level of summarization.

The third cateogry is the reclassification of items to balance sheet accounts or income statement accounts, which is only undertaken in the general ledger in order to balance accounts (values are then finally reassigned to financial statement items).