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: 

Calculating Extended Withholding Tax and Sales Tax in an Invoice BAPI

gordon_tobias
Explorer
0 Kudos

Hi all,

I am trying to use a BAPI to process an invoice receipt, with the calculation of Extended Withholding Tax. I am running ECC 6.

After reading many of the posts on this subject, I have managed to get Extended Withholding Tax calculated correctly using BAPI_ACC_INVOICE_RECEIPT_POST, and populating the EXTENSION1 table that is passed to the BAPI. When I look up the posted document in FB03, it looks good at first glance, but when I click on the Tax Data button, I see that the sales tax amounts are not being stored in the BSET table correctly.

In another test, I have been able to post these invoice receipts using BAPI_ACC_DOCUMENT_POST, and it does populate BSET with the correct sales tax amounts, but it does not calculate the Extended Withholding Tax. All the reading that I have done on Extended Withholding Tax suggests that BAPI_ACC_DOCUMENT_POST does not calculate it, even with the EXTENSION1 table.

In both these examples, I am using function CALCULATE_TAX_FROM_GROSSAMOUNT to calculate the taxes, and feeding the output from that function into the BAPI call.

It seems to me as though the reason that BAPI_ACC_INVOICE_RECEIPT_POST does not populate BSET properly may be because the ACCOUNTTAX table definition for that BAPI (structure bapiactx01) does not have the ITEMNO_TAX field that the ACCOUNTTAX table definition for the other BAPI has (structure bapiactx09).

Does anybody have any suggestions on how I can process an invoice receipt via a BAPI, and calculate both the Extended Withholding Taxes, and the sales taxes, correctly?

Gord

Edited by: Gordon Tobias on Jun 7, 2011 5:39 PM

1 ACCEPTED SOLUTION

gordon_tobias
Explorer
0 Kudos

I got this working, so I will answer my own post with an explanation of the solution, in case it benefits anyone else.

There are numerous posts in the forum about calculating Extended Withholding Tax through a BAPI, and the solutions given tend to suggest that BAPI_ACC_DOCUMENT_POST will not work with EWT, but BAPI_ACC_INVOICE_RECEIPT_POST will work if you activate the user exit EXIT_SAPLACC4_001.

In investigating this, I found the following OSS notes most helpful:

OSS Note 306504 - Collective note: BAPIs for the AC Interface

OSS Note 556311 - BAPI in the extended withholding tax

OSS Note 487722 - Using EXTENSION1 for accounting BAPIs

Note 556311 explains how to implement extended withholding tax with BAPI_ACC_INVOICE_POST, by implementing a user exit that processes the EXTENSION1 parameter, and it provides sample EWT logic for that user exit. However, note 487722 explains how to implement Business Transaction Event RWBAPI01, to process the EXTENSION1 table from BAPI_ACC_DOCUMENT_POST.

By implementing the user exit logic from note 556311, in the BTE described in note 487722, the extended withholding tax was calculated correctly from BAPI_ACC_DOCUMENT_POST.

1 REPLY 1

gordon_tobias
Explorer
0 Kudos

I got this working, so I will answer my own post with an explanation of the solution, in case it benefits anyone else.

There are numerous posts in the forum about calculating Extended Withholding Tax through a BAPI, and the solutions given tend to suggest that BAPI_ACC_DOCUMENT_POST will not work with EWT, but BAPI_ACC_INVOICE_RECEIPT_POST will work if you activate the user exit EXIT_SAPLACC4_001.

In investigating this, I found the following OSS notes most helpful:

OSS Note 306504 - Collective note: BAPIs for the AC Interface

OSS Note 556311 - BAPI in the extended withholding tax

OSS Note 487722 - Using EXTENSION1 for accounting BAPIs

Note 556311 explains how to implement extended withholding tax with BAPI_ACC_INVOICE_POST, by implementing a user exit that processes the EXTENSION1 parameter, and it provides sample EWT logic for that user exit. However, note 487722 explains how to implement Business Transaction Event RWBAPI01, to process the EXTENSION1 table from BAPI_ACC_DOCUMENT_POST.

By implementing the user exit logic from note 556311, in the BTE described in note 487722, the extended withholding tax was calculated correctly from BAPI_ACC_DOCUMENT_POST.