‎2009 Nov 02 8:28 PM
Dear Experts,
I am trying to post for FB50 using BAPI_ACC_DOCUMENT_POST. In return i am getting a message Document posted successfully: BKPFF 010000641159702009 SA1CLNT100
But this document 0100006411 is not saved into the database. I checked in BKPF and this does not exist. I called BAPI_TRANSACTION_COMMIT after calling the actual BAPI. Here's my piece of code. This looks like a weird problem, i am not getting any error messages or update termination messages. In return table it is showing the document number but its not saved in the database. I dont have any issues doing it manual through FB50.
Has anyone come across this error. Please suggest me how to fix this. Thanks in advance.
fs_documentheader-doc_date = sy-datum.
fs_documentheader-pstng_date = sy-datum.
fs_documentheader-username = sy-uname.
fs_documentheader-comp_code = '5970'.
fs_documentheader-bus_act = 'RFBU'.
fs_documentheader-doc_type = 'SA'.
wf_item = '0000000001'.
fs_accountgl-itemno_acc = wf_item.
fs_accountgl-gl_account = 'S240079000'.
fs_accountgl-doc_type = 'SA'.
fs_accountgl-comp_code = '5970'.
fs_accountgl-plant = '5971'.
APPEND fs_accountgl TO int_accountgl.
CLEAR fs_accountgl.
wf_item = '0000000002'.
fs_accountgl-itemno_acc = wf_item.
fs_accountgl-gl_account = 'S441101209'.
fs_accountgl-doc_type = 'SA'.
fs_accountgl-comp_code = '5970'.
fs_accountgl-plant = '5971'.
APPEND fs_accountgl TO int_accountgl.
CLEAR fs_accountgl.
fs_currencyamount-itemno_acc = '0000000001'.
fs_currencyamount-currency = 'EUR'.
fs_currencyamount-amt_base = '1.00'.
APPEND fs_currencyamount TO int_currencyamount.
CLEAR fs_currencyamount.
fs_currencyamount-itemno_acc = '0000000002'.
fs_currencyamount-currency = 'EUR'.
fs_currencyamount-amt_base = '- 1.00'.
APPEND fs_currencyamount TO int_currencyamount.
CLEAR fs_currencyamount.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
documentheader = fs_documentheader
TABLES
accountgl = int_accountgl
currencyamount = int_currencyamount
return = int_return.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
‎2009 Nov 02 8:47 PM
‎2009 Dec 04 4:33 PM
Hi can you give a brief summary on how you solved this problem yourself. because I am facing the same issue.
Regards
O'Jasvita
‎2009 Dec 04 6:21 PM
I was passing wrong values to wrong fields in item table parameter CURRENCYAMOUNT. The amount was passed to the wrong field, instead of passing it to amt_doccur i was passing to amt_base. Hope this should solve your problem if you have coded as i did previously.
I changed by code from below
fs_currencyamount-itemno_acc = '0000000001'.
fs_currencyamount-currency = 'EUR'.
fs_currencyamount-amt_base = '1.00'.
APPEND fs_currencyamount TO int_currencyamount.
CLEAR fs_currencyamount.
fs_currencyamount-itemno_acc = '0000000002'.
fs_currencyamount-currency = 'EUR'.
fs_currencyamount-amt_base = '- 1.00'.
APPEND fs_currencyamount TO int_currencyamount.
CLEAR fs_currencyamount.to
* Currency Amount for debit item
fs_currencyamount-itemno_acc = '0000000001'.
fs_currencyamount-currency = 'EUR'.
fs_currencyamount-curr_type = '00'.
fs_currencyamount- amt_doccur = '1.00'.
APPEND fs_currencyamount TO int_currencyamount.
CLEAR fs_currencyamount.
* Currency Amount for credit item
fs_currencyamount-itemno_acc = '0000000002'.
fs_currencyamount-currency = 'EUR'.
fs_currencyamount-curr_type = '00'.
fs_currencyamount- amt_doccur = '- 1.00'.
APPEND fs_currencyamount TO int_currencyamount.
CLEAR fs_currencyamount.
‎2014 Apr 02 2:20 PM