Skip to Content
0

Issue in BAPI_ACC_DOCUMENT_POST for one taxcode, multiple tax lines

Sep 15, 2017 at 06:46 PM

750

avatar image
Former Member

Hi Experts,

I am facing issue while doing a Financial posting via BAPI using a tax code with multiple condition types. To avoid redundant answers, let me add more details -

1. I know how to pass tax data in this BAPI and normal tax postings are working fine where 1 tax code is 1 conditing type (1 rate).

2. Only issue is in BAPI when 1 tax code is having multiple condition types (3 different rates). Example B1 tax code. If I use same tax code in FB01, it works fine, I enter only 1 time B1 tax code, nothing else, no GLAcc, no Acc key etc ...FB01 auto posts 3 lines in document for tax data with all 3 rates properly applied.

3. My scenario is that tax is calculated from different system outside SAP and hence I cant use 'Calculate_Tax_XXX' functions in SAP. I only have tax code B1 and 3 tax amounts(suppose 100$,5$,5$). Don't have Gl account or Acc key etc....

4. If I pass 3 lines in ACCOUNTTAX table with B1 and 3 corresponding lines for tax data in CURRENCYAMOUNT, I get error in BAPI. If I total the tax amounts (150$) and pass only 1 line for tax data in CURRENCYAMOUNT, still same error.

5. In a way, I already know the solution that if I pass 'Acct_Key' values also in ACCOUNTTAX table, then BAPI posts fine. But since my tax data is coming from an external system which doesn't have Acct_Key value, I am unable to pass this field. What I am unable to understand is that if FB01 can auto split B1 taxcode and 150$ tax amount in 3 lines in document, then why BAPI cannot do it.

BAPI error -

Posted directly by FB01, just gave B1 and 150$ as tax amount -

I have read many threads already posted on similar lines but didn't get any solution. Please provide inputs, thanks.

1.jpg (161.7 kB)
2.jpg (85.5 kB)
3.jpg (40.0 kB)
4.jpg (98.3 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

6 Answers

avatar image
Former Member Sep 18, 2017 at 07:13 AM
0

Experts, Any advice/suggestion on it will be highly appreciated.

Share
10 |10000 characters needed characters left characters exceeded
Raymond Giuseppi
Sep 18, 2017 at 08:46 AM
0

Did you try to set the ACCT_KEY value to value like 'VST', 'MW1' or 'MW2' Or even map results of CALCULATE_TAX_FROM_GROSSAMOUNT to your tax items in the ACCOUNTTAX parameter.

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Sep 18, 2017 at 09:41 AM
0

Hi Raymond,

Thanks for reply. As I had written earlier, I already know that if I pass ACCT_KEY in BAPI in ACCOUNTTAX table, then posting works fine as expected.

But since tax is calculated from external system ARIBA, they dont have that ACCT_KEY info. Hence is there a way that BAPI could work without such info, since FB01 can work without it.

Regards.

Show 4 Share
10 |10000 characters needed characters left characters exceeded

As FB01 is able to calculate the tax, could you try (SE37) to call CALCULATE_TAX_FROM_GROSSAMOUNT and check its result?

0
Former Member

Hi Raymond,

I cant use this function due to reason that tax amounts will be calculated in external system and need to be followed in SAP. So if SAP calculated tax would have been 100$, but ext system sends 101$, I need to follow 101$.

if I feed 150$ tax amount to FB01 (without break-up) (without any GL acc or Acct key) (Without CALCULATE_TAX tick), it still posts fine. Since I have amounts coming from ext system like 140,5,5....if I use calculate tax amount function, I will get Acct_Keys but I wont know that which amount to match with which key before sending to BAPI.

Hope I am able to make myself clear. Is there a way that without feeding Acct_key, BAPI can post with tax amounts provided by me.

Regards

0

You should analyze again data (cXML?) received from Ariba for more available information or use a simple rule of three to match amount received and result of the FM to map it to BAPI parameter.

0
Former Member

Hi Raymond,

OK understand, you mean that there is no way to make it work without feeding any extra information to BAPI.

Let me try and see if I can get GL acc for these tax components from Ariba and then using that GL account + tax amount, I can retrieve Acc key from SAP and pass to BAPI.

I was just hoping that I might be missing anything and BAPI can work without passing any Acc key since FB01 can work that way. Thanks for your valuable inputs.

0
avatar image
Former Member Sep 19, 2017 at 02:53 AM
0

Any suggestion from anyone. Looking for a solution on this asap.

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Sep 20, 2017 at 04:39 AM
0

Any help will be appreciated, if something is not clear, please feel free to ask.

Share
10 |10000 characters needed characters left characters exceeded
pradeep reddy Sep 21, 2017 at 08:10 AM
0

Hi Diwakar,

In ACCOUNTTAX parameter pass G/L account and account key for all three tax components. With out passing account key and G/l account BAPI will not work

Show 3 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Yes Pradeep I noticed same. But for tax code with a single component, bapi works fine without any GL and Acct key.

Also, for multiple cond types tax codes, FB01 posts fine by just entering tax code only and tax amount. I cannot believe that BAPI doesn't work same way as online tcode. It has become a big issue now for us as getting Acct key from external system is a major change to interface.

0

For BAPI we need to fill G/l and account key before passing to BAPI. For me BAPI is throwing error for single component if am not passing a

ccount key.

debugger.png (23.5 kB)
0

or else pass cond_key(KSCHL). My case if I pass KSCHL BAPI internally filling G/L account and account key

0