Skip to Content
0
Sep 15, 2007 at 09:16 PM

BAPI 'BAPI_ACC_DOCUMENT_POST' Gives me Error when adding more than one

70 Views

Hi

I have created code that has a loop and adds GL Documents in SAP.

If I only add one document it works fine.

If I add more than one document, the first one goes through fine. The second and anything after fail. The ones that fail give the following error

"FI/CO interface: Line item entered several times"

Usually get this error if you define more than one row with the same row number, in other words they are not unique row n numbers.

But the first GL Document has row id 1 for the 1st row, row id 2 for the 2nd row.

the second GL Document has row id 1 for the 1st row, row id 2 for the 2nd row.

It should not conflict with each other as each document gets "commited" before I start with the next document.

The only thing I can think of is that after I commit the bapi it is not clearing the BAPI. Does one need to clear the BAPI before adding another GL Document??? How does one clear the BAPI???

Does anyone have a simple example using 'BAPI_ACC_DOCUMENT_POST' where you have a loop and add a GL Document a few times???

Any response is appreciated 😉