2012 Sep 19 3:21 PM
Hi SAP Gurus,
We've created an interface that posts customer invoice via BAPI_ACC_DOCUMENT_POST (ala FB70). However, I kept encountering the "Inconsistent FI/CO document header data for updating" error.
Prior to providing further details, here's what I've already done while trying to look for a solution:
- Passed all the information into the BAPI_ACC_DOCUMENT_CHECK FM. No errors were encountered there.
- Directly ran my test data in the posting BAPI via SM37. Got the same "inconsistent" error there.
- Tried posting the test data at FB70. Worked without any problems.
- Ensured that the document type I've been passing is really for customer invoices.
- Checked that there is no need for me to provide a different posting key aside from the default.
- Alternatively tried providing and not providing the object type (BKPFF), key ('$'), and system.
- Alternatively tried providing and not providing the fiscal year and period at the header details.
- Made sure that all of the company codes in my line items are the same as that provided in the header table.
- Made sure that all values that need to be padded with 0s at the front (such as GL accounts and customer number) have them.
-----
In a nutshell, the data that I am trying to post is roughly as follows:
| Posting Key | Comp Code | Account | Text | Currency | Tax Code | Amount | Profit Center |
|---|---|---|---|---|---|---|---|
| 01 | 1000 | 100000 | Customer entry (w/ tax) | USD | O1 | 1,000,000.00 | |
| 50 | 1000 | 2101001 | Customer entry (tax amt) | USD | O1 | 10,000.00- | |
| 50 | 1000 | 4104001 | GL entry 1 (no tax) | USD | O1 | 500,000.00- | DUMMY |
| 50 | 1000 | 4104020 | GL entry 2 (no tax) | USD | 490,000.00- | DUMMY |
GL account 4104020 cannot accept tax codes.
I've filled up the BAPI tables as such:
-----
Document header (minus object type, key, and system):
| Bus Act | Username | Text | Comp Code | Doc Date | Posting Date | Doc Type | Ref Doc |
|---|---|---|---|---|---|---|---|
| RFBU | sy-uname | BAPI Test | 1000 | 20120919 | 20120919 | DR | REFDOCII |
-----
AR Table:
| Item No | Customer No. | Comp Code | Tax Code |
|---|---|---|---|
| 10 | 100000 | 1000 | O1 |
I've also already tried providing the GL account and the payment terms allotted to the customer into this table, just in case the BAPI couldn't retrieve them. Didn't work as well.
-----
Tax Table:
| Item No | GL Account | Tax Code |
|---|---|---|
| 20 | 2101001 | O1 |
-----
GL Table:
| Item No | GL Account | Comp Code | Posting Date | Tax Code | Profit Center |
|---|---|---|---|---|---|
| 30 | 4104001 | 1000 | 20120919 | O1 | DUMMY |
| 40 | 4104020 | 1000 | 20120919 | DUMMY |
-----
Amounts Table:
| Item No | Currency | Base Amount |
|---|---|---|
| 10 | USD | 1,000,000.00 |
| 20 | USD | 10,000.00- |
| 30 | USD | 500,000.00- |
| 40 | USD | 490,000.00- |
I feel like I'm missing something so incredibly simple and that I'd feel silly once I find out, but for the moment, I would really appreciate any thoughts you may have as I continue to search for answers...
Thank you so much!
2012 Sep 19 3:34 PM
Hi
What are you moving in the tax line? Which is the base amount?
Max
2012 Sep 19 4:08 PM
Hi Max,
The 10,000- stored in the base amount is the amount that is passed in the tax line.
I forgot to mention, but I had also wondered if it had anything to do with the other amount fields not being filled up. I'm no longer connected to the system, but If I can recall correctly, I've tried something that roughly looks like this, using the FM that retrieves amounts based on net and gross (I simplified the values here for our convenience):
| Item No | Currency | Doc Amt | Base Amt |
|---|---|---|---|
| 10 | USD | 1,000,000.00 | 990,000.00 |
| 20 | USD | 10,000.00- | 9900.00- |
| 30 | USD | 500,000.00- | 495,000.00- |
| 40 | USD | 490,000.00- | 485,100.00- |
But for some reason, I remember this giving me an error pertaining to transaction amount balances.
2012 Sep 19 4:12 PM
2012 Sep 19 4:15 PM
2012 Sep 19 4:34 PM
Hi
U should move the base amount in the CURRENCYAMOUNT for tax line only.
I usually use the fm CALCULATE_TAX_FROM_NET_AMOUNT or CALCULATE_TAX_FROM_GROSS_AMOUNT
in order to get the right data for tax line:
if base amount is 9900.00, tax amount shouldn't be 10,000.00?
Max
2012 Sep 20 3:24 AM
Hi Max,
The value should definitely be 10,000 (provided by the incoming file).
Still, we've played around with your suggestion that the tax line should contain the 10k value for the amount, and we finally got it. Turns out that for the two GL accounts, I should have entered the gross amount in both document and base fields in the table instead of entering gross and net respectively.
Thanks for your help!
Jay
2012 Sep 19 3:46 PM
Try using the BAPI in a report program and also at the end use FM 'BAPI_TRANSACTION_COMMIT'. Sometimes BAPI's don't work correctly when ran through SE37.
best regards,
swanand
2012 Sep 19 4:14 PM
Hi Swanand,
Unfortunately, that was the first we had done - the BAPI was originally in a report program, with the BAPI commit FM at the end. I also receive the same error at the return table there when I attempt to post (while the FM that conducts checks states that it encountered no errors).