Application Development and Automation 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: 
Read only

Customer Invoice BAPI posting problem

Former Member
0 Likes
3,455

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 KeyComp CodeAccountTextCurrencyTax Code
AmountProfit Center
011000100000Customer entry (w/ tax)USDO11,000,000.00
5010002101001Customer entry (tax amt)USDO110,000.00-
5010004104001GL entry 1 (no tax)USDO1500,000.00-DUMMY
5010004104020GL 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 ActUsernameTextComp CodeDoc DatePosting Date
Doc TypeRef Doc
RFBUsy-unameBAPI Test10002012091920120919DRREFDOCII

-----

AR Table:

Item NoCustomer No.Comp CodeTax Code
101000001000O1

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 NoGL AccountTax Code
202101001O1

-----

GL Table:

Item NoGL AccountComp CodePosting DateTax CodeProfit Center
304104001100020120919O1DUMMY
404104020100020120919
DUMMY

-----

Amounts Table:

Item No
CurrencyBase Amount
10USD1,000,000.00
20USD10,000.00-
30USD500,000.00-
40USD490,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!

8 REPLIES 8
Read only

Former Member
0 Likes
1,983

Hi

What are you moving in the tax line? Which is the base amount?

Max

Read only

0 Likes
1,983

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 NoCurrencyDoc AmtBase Amt
10USD1,000,000.00990,000.00
20USD10,000.00-9900.00-
30USD500,000.00-495,000.00-
40USD490,000.00-485,100.00-

But for some reason, I remember this giving me an error pertaining to transaction amount balances.

Read only

0 Likes
1,983

But which is the percentage of tax code?

Max

Read only

0 Likes
1,983

Hi Max,

For the sample above, tax is around %1.01.

Read only

0 Likes
1,983

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

Read only

0 Likes
1,983

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

Read only

Former Member
0 Likes
1,983

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

Read only

0 Likes
1,983

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).