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

BAPI_ACC_INVOICE_RECEIPT_POST balance error

Former Member
0 Likes
1,042

Hi.

I've read all the posts I can find about this BAPI. I want to post an invoice, but seem to be a problem somewhere.. Is there anyone who had such a problem or can help me please? Thanks.

The header is like this:

gd_documentheader-obj_type = 'BKPFF'.

gd_documentheader-obj_key = ref_key.

gd_documentheader-username = sy-uname.

gd_documentheader-header_txt = 'HD BAPI Test'.

gd_documentheader-comp_code = '4020'.

gd_documentheader-doc_date = sy-datum.

gd_documentheader-pstng_date = sy-datum.

gd_documentheader-ref_doc_no = 'ttt'.

where i generate a random key for ref_key.

The account payable is like with corresponding currency amount:

it_accountpayable-itemno_acc = 1.

it_accountpayable-vendor_no = '2000001010'.

it_accountpayable-item_text = 'Test'.

APPEND it_accountpayable.

it_currencyamount-itemno_acc = 1.

it_currencyamount-curr_type = '00'.

it_currencyamount-currency = 'EUR'.

it_currencyamount-amt_doccur = -100.

APPEND it_currencyamount.

The account is:

it_accountgl-itemno_acc = 2.

it_accountgl-gl_account = '0064414401'.

it_accountgl-doc_type = 'KR'.

it_accountgl-tax_code = 'GQ'.

it_accountgl-item_text = 'Test'.

it_accountgl-orderid = '405200BE0800'.

it_accountgl-fisc_year = '2005'.

it_accountgl-fis_period = '07'.

APPEND it_accountgl.

it_currencyamount-itemno_acc = 2.

it_currencyamount-curr_type = '00'.

it_currencyamount-currency = 'EUR'.

it_currencyamount-amt_doccur = 100.

APPEND it_currencyamount.

And the tax:

it_accounttax-itemno_acc = 3.

it_accounttax-gl_account = '0062212201'.

it_accounttax-tax_code = 'GQ'.

it_accounttax-acct_key = 'VST'.

it_currencyamount-itemno_acc = 3.

it_currencyamount-curr_type = '00'.

it_currencyamount-currency = 'EUR'.

it_currencyamount-amt_doccur = 100.

The bapi will keep giving me the "Balance in current transaction" error, unless I remove the doc type KR in the header.

Many thanks in advance.

Tiago.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
746

Hi Tagio,

I think the problem lies with the amount for the tax.

With item 3 try to use field "AMT_BASE" instead of "AMT_DOCCUR".

This is the base amount on wich the tax should be calculated.

Regards,

Arjan

5 REPLIES 5
Read only

Former Member
0 Likes
747

Hi Tagio,

I think the problem lies with the amount for the tax.

With item 3 try to use field "AMT_BASE" instead of "AMT_DOCCUR".

This is the base amount on wich the tax should be calculated.

Regards,

Arjan

Read only

0 Likes
746

Thank you Arjan!

But I've got the same message when using the "AMT_BASE" instead of "AMT_DOCCUR".

I can post, but in a strange way..

If i do this, then i have 2 documents posted. A KR and an AB. But then, when i try to pass the BSCHL with the extends section in the BAPI i get wrong bschl error in the bapi...

it_accountpayable-itemno_acc = 1.

it_accountpayable-vendor_no = '2000001075'.

it_accountpayable-item_text = 'AP BAPI Test'.

APPEND it_accountpayable.

it_currencyamount-itemno_acc = 1.

it_currencyamount-curr_type = '00'.

it_currencyamount-currency = 'EUR'.

it_currencyamount-amt_doccur = -100.

APPEND it_currencyamount.

it_accountpayable-itemno_acc = 3.

it_accountpayable-vendor_no = '2000001075'.

it_accountpayable-item_text = 'AP BAPI Test'.

APPEND it_accountpayable.

it_currencyamount-itemno_acc = 3.

it_currencyamount-curr_type = '00'.

it_currencyamount-currency = 'EUR'.

it_currencyamount-amt_doccur = 100.

APPEND it_currencyamount.

  • fill GL (line 2)

it_accountgl-itemno_acc = 2.

it_accountgl-gl_account = '0062212201'.

it_accountgl-doc_type = 'KR'.

it_accountgl-tax_code = 'GQ'.

it_accountgl-item_text = 'GL BAPI Test'.

it_accountgl-orderid = '402500VE0800'.

it_accountgl-fisc_year = '2005'.

it_accountgl-fis_period = '07'.

APPEND it_accountgl.

it_currencyamount-itemno_acc = 2.

it_currencyamount-curr_type = '00'.

it_currencyamount-currency = 'EUR'.

it_currencyamount-amt_doccur = 100.

APPEND it_currencyamount.

it_accountgl-itemno_acc = 4.

it_accountgl-gl_account = '0062212201'.

it_accountgl-doc_type = 'KR'.

it_accountgl-tax_code = 'GQ'.

it_accountgl-item_text = 'GL BAPI Test'.

it_accountgl-orderid = '402500VE0800'.

APPEND it_accountgl.

it_currencyamount-itemno_acc = 4.

it_currencyamount-curr_type = '00'.

it_currencyamount-currency = 'EUR'.

it_currencyamount-amt_doccur = -100.

APPEND it_currencyamount.

Read only

0 Likes
746

I changed all AMT_DOCCUR to AMT_BASE and i had success, but i can't see any document.. i do a BAPI_TRANSACTION_COMMIT after the BAPI_ACC_INVOICE_POST.

Read only

0 Likes
746

Hi Kiran,

I think it should be like this:

item 1 = vendor item

AMT_DOCCUR = 100

item 2 = GL item

AMT_DOCCUR = -100

item 3 = tax item

AMT_BASE = -100

(Do you really need this item?)

Regards,

Arjan

Read only

0 Likes
746

No good I tried with the tax, without the tax, changing accounts. When I use this solution (docccur, doccur, base -> vendor, gl, tax ) the bapi returns Balance error. When i use all the base, it seems to post ok, but no document, even with a bapi_transaction_commit..