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: 

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

former_member184566
Active Contributor
0 Kudos

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

3 REPLIES 3

former_member184566
Active Contributor
0 Kudos

Solved it

0 Kudos

Hi Louis, I'm facing the same error message.. how did you solve it?

Thanks

/AD

0 Kudos

my error was due to an internal table wasn't getting cleaned before the next call.

source: http://www.codemare.blogspot.com