Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Accts Payable posting using BAPI..


I am using BAPI_ACC_DOCUMENT_POST to post acct payables. I have an input file which can have 1 header and multiple detail lines. My question is do I need to pass both accts payable and accts GL structures to this BAPI when i post accts payable data ?

Also I want to understand how many lines items need to be filled in these structures as I am getting an error that says "Line item entered several times" and I am not able to figure out whats the issue ?

Inclusing the currency structure currently I am populting lines 10 and 20 if there are 2 details lines, am I right ? Pl explain with an example.


Former Member
Former Member replied


Please do check this once again

Load v_lineitem = 1

Update AccountsPayable table and Currency Amount Table of BAPI

Load v_lineitem = 2

Update GLAccount table and Currency Amount Table of BAPI

Here if you see I have written currency structure at both the level.First time item_no(v_lineitem) is 1 with amount equals to header_amount.And second time item_no(v_lineitem) is 2 and the amount will be line item amount.

I know you have been confused just see the below sketch to understand better

line_number = 1.

accountspayable-itemno_acc = line_number .



append accountspayable.

currencyamount-itemno_acc = line_number .

currencyamount-amt_doccur = headeramount * -1.

append currencyamount.

accountgl-itemno_acc = line_number + 1.



append accountgl.

currencyamount-itemno_acc = wa_lineitem-invoice_line_number + 1.

currencyamount-amt_doccur = line_item_amount .

append currencyamount.

If you see now currency table you will find first row with line number 1 with header amount and from line 2 you will find line item amount .

Let me know if its clear to you now or no.



0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question