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: 

BAPI_ACC_DOCUMENT_POST

former_member729320
Discoverer
0 Kudos

I have been given excel sheet data with 1st line item with gl_account field & tax_code field filled and passing that entry into GLACCOUNT table and 2nd line item contains Vendor data filled and passing this entry into ACCOUNTPAYABLE table. The 1st line item derives multiple line items and passed them into ACCOUNTTAX table.

Now,

glaccount table has --->1 entry

accountpayable--->1 entry

taxaccount table --->2 entries

currencyamount table --> 4 entries( all the entries clubbed together) and passed them to BAPI_ACC_DOCUMENT_POST. along with document header and customercpd structures. But unable to find the derived line entries in BSEG table after committing the BAPI.

3 REPLIES 3

gurkanyilmaz
Explorer
0 Kudos

There is a good example for the BAPI call under this URL,

https://answers.sap.com/questions/3117081/sample-code-for-bapiaccdocumentpost.html

just check the return parameter after the call to see what is wrong.

DominikTylczyn
Active Contributor

Hello vamshisaichand23

The note 626235 - Tax postings with accounting BAPIs provides nice examples of how to fill the BAPI_ACC_DOCUMENT_POST. It also contains to sample reports.

Have a look.

Best regards

Dominik Tylczynski

raymond_giuseppi
Active Contributor

Nowadays SAP provided a method (fi_tax_services=>calculate, this method is also wrapped in FM FI_TAX_SERVICES_CALCULATE) that provides the required TAX records.

" Prepare parameters
" ...
" Evaluate Taxes
CALL METHOD fi_tax_services=>calculate
  EXPORTING
    documentheader    = documentheader
    taxamount         = l_amount
    accountpayable    = accountpayable
  IMPORTING
    return_code       = l_return_code
  CHANGING
    accountgl         = accountgl
    accounttax        = accounttax
    currencyamount    = currencyamount
    return            = return.
" Call BAPI
IF l_return_code = 0.
  CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'

Ref: Check OSS notes 1873588 'Filling tax information for BAPIs' and 2070697 'Filling tax information for BAPIs'