2007 Dec 27 6:30 AM
Dear Friends,
I am facing problem with BAPI_TRANSACTION_COMMIT.
I used BAPI_ACC_DOCUMENT_POST for accounting document posting. The document is created successful and the BAPI return table as well as the IMPORT paramters have the document number.
Then I used BAPI_TRANSACTION_COMMIT to commit the changes. This is also successful, ie.,
sy-subrc = 0, but i'm not able to view the document in FB03 as well in the database tables (BKPF, BSEG).
Whereas if I do manual posting via FB01, i'm able to view the doc. Kindly let me know what is wrong with this commit BAPI..
Thanks,
Nidhya
Hai,
Check the following code which is working fine:
l_documentheader LIKE bapiache08,
l_accountgl LIKE bapiacgl08 OCCURS 2 WITH HEADER LINE,
l_currencyamount LIKE bapiaccr08 OCCURS 2 WITH HEADER LINE,
l_return LIKE bapiret2 OCCURS 5 WITH HEADER LINE,
l_obj_type LIKE bapiache02-obj_type,
l_obj_key LIKE bapiache02-obj_key,
l_obj_sys LIKE bapiache02-obj_sys.
LOOP AT it_account_tab.
CLEAR:
g_fis_period,
g_pstng_date,
g_gl_account,
g_costcenter,
g_amt_doccur,
g_sign,
l_documentheader,
l_accountgl,
l_currencyamount,
l_return,
zbc_kto_conv.
REFRESH:l_accountgl,
l_currencyamount,
l_return.
g_fis_period = it_account_tab-line+0(6).
g_pstng_date = it_account_tab-line+6(8).
g_gl_account = it_account_tab-line+14(5).
g_costcenter = it_account_tab-line+19(6).
g_amt_doccur = it_account_tab-line+25(16).
g_sign = it_account_tab-line+41(1).
IF g_fis_period4(2) NE g_pstng_date4(2).
g_pstng_date4(2) = g_fis_period4(2).
ENDIF.
SELECT SINGLE * FROM zbc_kto_conv
WHERE zpoeskto = g_gl_account.
IF sy-subrc <> 0.
MOVE-CORRESPONDING it_account_tab TO it_error_acc_tab.
APPEND it_error_acc_tab.
CLEAR it_error_acc_tab.
CONTINUE.
ENDIF.
l_documentheader-username = sy-uname.
l_documentheader-comp_code = '1000'.
l_documentheader-fisc_year = g_fis_period(4).
l_documentheader-doc_date = sy-datum.
l_documentheader-pstng_date = g_pstng_date.
l_documentheader-fis_period = g_fis_period+4(2).
l_documentheader-doc_type = 'IP'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = zbc_kto_conv-pri_hkont
IMPORTING
output = zbc_kto_conv-pri_hkont.
l_accountgl-itemno_acc = '1'.
l_accountgl-gl_account = zbc_kto_conv-pri_hkont.
l_accountgl-comp_code = '1000'.
l_accountgl-pstng_date = g_pstng_date.
l_accountgl-fis_period = g_fis_period+4(2).
IF zbc_kto_conv-zkonv_kode = 'C'.
l_accountgl-costcenter = g_costcenter.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = l_accountgl-costcenter
IMPORTING
output = l_accountgl-costcenter.
ENDIF.
IF zbc_kto_conv-zkonv_kode = 'P'.
l_accountgl-profit_ctr = g_costcenter.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = l_accountgl-profit_ctr
IMPORTING
output = l_accountgl-profit_ctr.
ENDIF.
APPEND l_accountgl.
CLEAR: l_accountgl-costcenter,
l_accountgl-profit_ctr.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = zbc_kto_conv-mod_hkont
IMPORTING
output = zbc_kto_conv-mod_hkont.
l_accountgl-itemno_acc = '2'.
l_accountgl-gl_account = zbc_kto_conv-mod_hkont.
APPEND l_accountgl.
CLEAR l_accountgl.
l_currencyamount-itemno_acc = '1'.
l_currencyamount-currency = 'DKK'.
l_currencyamount-currency_iso = 'DKK'.
l_currencyamount-amt_doccur = g_amt_doccur.
l_currencyamount-amt_doccur = l_currencyamount-amt_doccur / 100.
IF g_sign = '-'.
l_currencyamount-amt_doccur = l_currencyamount-amt_doccur * -1.
ENDIF.
APPEND l_currencyamount.
l_currencyamount-itemno_acc = '2'.
l_currencyamount-amt_doccur = l_currencyamount-amt_doccur * -1.
APPEND l_currencyamount.
CLEAR l_currencyamount.
CALL FUNCTION 'BAPI_ACC_GL_POSTING_POST'
EXPORTING
documentheader = l_documentheader
IMPORTING
obj_key = l_obj_key
TABLES
accountgl = l_accountgl
currencyamount = l_currencyamount
return = l_return.
IF l_obj_key NE '$'.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
ELSE.
MOVE-CORRESPONDING it_account_tab TO it_error_acc_tab.
APPEND it_error_acc_tab.
CLEAR it_error_acc_tab.
ENDIF.
ENDLOOP.
2007 Dec 27 10:52 AM
Hai,
Check the following code which is working fine:
l_documentheader LIKE bapiache08,
l_accountgl LIKE bapiacgl08 OCCURS 2 WITH HEADER LINE,
l_currencyamount LIKE bapiaccr08 OCCURS 2 WITH HEADER LINE,
l_return LIKE bapiret2 OCCURS 5 WITH HEADER LINE,
l_obj_type LIKE bapiache02-obj_type,
l_obj_key LIKE bapiache02-obj_key,
l_obj_sys LIKE bapiache02-obj_sys.
LOOP AT it_account_tab.
CLEAR:
g_fis_period,
g_pstng_date,
g_gl_account,
g_costcenter,
g_amt_doccur,
g_sign,
l_documentheader,
l_accountgl,
l_currencyamount,
l_return,
zbc_kto_conv.
REFRESH:l_accountgl,
l_currencyamount,
l_return.
g_fis_period = it_account_tab-line+0(6).
g_pstng_date = it_account_tab-line+6(8).
g_gl_account = it_account_tab-line+14(5).
g_costcenter = it_account_tab-line+19(6).
g_amt_doccur = it_account_tab-line+25(16).
g_sign = it_account_tab-line+41(1).
IF g_fis_period4(2) NE g_pstng_date4(2).
g_pstng_date4(2) = g_fis_period4(2).
ENDIF.
SELECT SINGLE * FROM zbc_kto_conv
WHERE zpoeskto = g_gl_account.
IF sy-subrc <> 0.
MOVE-CORRESPONDING it_account_tab TO it_error_acc_tab.
APPEND it_error_acc_tab.
CLEAR it_error_acc_tab.
CONTINUE.
ENDIF.
l_documentheader-username = sy-uname.
l_documentheader-comp_code = '1000'.
l_documentheader-fisc_year = g_fis_period(4).
l_documentheader-doc_date = sy-datum.
l_documentheader-pstng_date = g_pstng_date.
l_documentheader-fis_period = g_fis_period+4(2).
l_documentheader-doc_type = 'IP'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = zbc_kto_conv-pri_hkont
IMPORTING
output = zbc_kto_conv-pri_hkont.
l_accountgl-itemno_acc = '1'.
l_accountgl-gl_account = zbc_kto_conv-pri_hkont.
l_accountgl-comp_code = '1000'.
l_accountgl-pstng_date = g_pstng_date.
l_accountgl-fis_period = g_fis_period+4(2).
IF zbc_kto_conv-zkonv_kode = 'C'.
l_accountgl-costcenter = g_costcenter.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = l_accountgl-costcenter
IMPORTING
output = l_accountgl-costcenter.
ENDIF.
IF zbc_kto_conv-zkonv_kode = 'P'.
l_accountgl-profit_ctr = g_costcenter.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = l_accountgl-profit_ctr
IMPORTING
output = l_accountgl-profit_ctr.
ENDIF.
APPEND l_accountgl.
CLEAR: l_accountgl-costcenter,
l_accountgl-profit_ctr.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = zbc_kto_conv-mod_hkont
IMPORTING
output = zbc_kto_conv-mod_hkont.
l_accountgl-itemno_acc = '2'.
l_accountgl-gl_account = zbc_kto_conv-mod_hkont.
APPEND l_accountgl.
CLEAR l_accountgl.
l_currencyamount-itemno_acc = '1'.
l_currencyamount-currency = 'DKK'.
l_currencyamount-currency_iso = 'DKK'.
l_currencyamount-amt_doccur = g_amt_doccur.
l_currencyamount-amt_doccur = l_currencyamount-amt_doccur / 100.
IF g_sign = '-'.
l_currencyamount-amt_doccur = l_currencyamount-amt_doccur * -1.
ENDIF.
APPEND l_currencyamount.
l_currencyamount-itemno_acc = '2'.
l_currencyamount-amt_doccur = l_currencyamount-amt_doccur * -1.
APPEND l_currencyamount.
CLEAR l_currencyamount.
CALL FUNCTION 'BAPI_ACC_GL_POSTING_POST'
EXPORTING
documentheader = l_documentheader
IMPORTING
obj_key = l_obj_key
TABLES
accountgl = l_accountgl
currencyamount = l_currencyamount
return = l_return.
IF l_obj_key NE '$'.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
ELSE.
MOVE-CORRESPONDING it_account_tab TO it_error_acc_tab.
APPEND it_error_acc_tab.
CLEAR it_error_acc_tab.
ENDIF.
ENDLOOP.
2007 Dec 27 10:55 AM
Have u called BAPI_TRANSACTION_COMMIT with commit?
If not try once.
Thanks
Edited by: chandra madapati on Dec 27, 2007 11:55 AM
2007 Dec 27 10:58 AM
2007 Dec 27 11:04 AM
Hi,
Are you executing the BAPI directly in SE37 or in your code?
If you are testing in SE37, You have to run as a sequences with a) BAPI_ACC_DOCUMENT_POST
b) BAPI_TRANSACTION_COMMIT
Then you can see the changes in FB03.
Regards,
Hk
| User | Count |
|---|---|
| 6 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |