Skip to Content
0
Former Member
May 19, 2005 at 02:50 PM

Problems with 'BAPI_ACC_DOCUMENT_POST'

759 Views

Hi there !!

I got this problem , from a report I need to simulate the FB01 transactio to crate a document, I tried the 2 bapi

'BAPI_ACC_DOCUMENT_POST'

'BAPI_ACC_GL_POSTING_POST'

but seems that there is some problem and no documents aer created , can someone help me ,

After the bapi's launch in the return table I found this 2 lines of errors:

E - RW - 609 - Error in document: BKPFF 164356

E - F5 - 702 - Balance in transaction currency

**********************************************************

  • THIS THE SOURCE CODE

**********************************************************

data: tb_header like bapiache09 occurs 0 with header line,

tb_return like bapiret2 occurs 0 with header line,

tb_camount like bapiaccr09 occurs 0 with header line,

tb_account like bapiacgl09 occurs 0 with header line.

  • header

move: 'D1' to tb_header-doc_type,

'BKPFF' to tb_header-obj_type,

sy-uzeit to tb_header-obj_key,

sy-datum to tb_header-doc_date,

'XXXX' to tb_header-comp_code,

sy-uname to tb_header-username,

'RFBU' to tb_header-bus_act,

sy-datum to tb_header-pstng_date .

append tb_header.

***

  • amount

move: 1 to tb_camount-itemno_acc,

"my_amount" to tb_camount-amt_doccur,

'EUR' to tb_camount-currency.

append tb_camount. clear tb_camount.

*

move: 2 to tb_camount-itemno_acc,

"my_amount" to tb_camount-amt_doccur,

'EUR' to tb_camount-currency.

append tb_camount.clear tb_camount.

***

  • Item

call function 'CONVERSION_EXIT_ALPHA_INPUT'

exporting

input = pr_hkonp

importing

output = tb_account-gl_account.

move: 1 to tb_account-itemno_acc,

sy-datum to tb_account-pstng_date,

'40' to tb_account-acttype.

append tb_account.clear tb_account.

*

call function 'CONVERSION_EXIT_ALPHA_INPUT'

exporting

input = pr_hkonr

importing

output = tb_account-gl_account.

***

move: 2 to tb_account-itemno_acc,

pr_hkonr to tb_account-gl_account,

sy-datum to tb_account-pstng_date,

pr_aufnr to tb_account-orderid,

'50' to tb_account-acttype.

append tb_account.clear tb_account.

*

call function 'BAPI_ACC_DOCUMENT_POST'

exporting

documentheader = tb_header

importing

obj_type = va_obj_type

obj_key = va_obj_key

tables

accountgl = tb_account

currencyamount = tb_camount

return = tb_return.

*

if va_obj_key ne '$'.

call function 'BAPI_TRANSACTION_COMMIT'

importing

return = return.

endif.

*