2008 Feb 26 9:06 AM
Hi all,
I have been trying to use standard bapi_acc_gl_posting_post to post G/L docs.
Even though I have a 'commit work' and the return message says that the transaction was successfull, I cannot see any new docs in table bkpf.
I read Oss note 306504 but the info is vague.
My header data is:
WA_DOCUMENTHEADER-OBJ_TYPE = 'ZTEST'.
WA_DOCUMENTHEADER-OBJ_KEY = SY-UZEIT.
WA_DOCUMENTHEADER-OBJ_SYS = 'T90CLNT090'.
*WA_DOCUMENTHEADER-AC_DOC_NO = '0100000146'.
WA_DOCUMENTHEADER-USERNAME = SY-UNAME.
WA_DOCUMENTHEADER-HEADER_TXT = 'TEST'.
WA_DOCUMENTHEADER-COMP_CODE = '3000'.
WA_DOCUMENTHEADER-FISC_YEAR = '2004'.
WA_DOCUMENTHEADER-DOC_DATE = SY-DATUM.
WA_DOCUMENTHEADER-PSTNG_DATE = SY-DATUM.
WA_DOCUMENTHEADER-FIS_PERIOD = '12'.
WA_DOCUMENTHEADER-DOC_TYPE = 'SA'.
WA_DOCUMENTHEADER-COMPO_ACC = 'FI'.
Any clue? Thanks,
2008 Feb 27 4:14 AM
report z_test_bapi_gl_ac_doc .
data:
obj_type like bapiache02-obj_type,
obj_key like bapiache02-obj_key,
obj_sys like bapiache02-obj_sys,
documentheader like bapiache08,
accountgl like bapiacgl08
occurs 0 with header line,
currencyamount like bapiaccr08
occurs 0 with header line,
return like bapiret2
occurs 0 with header line,
extension1 like bapiextc
occurs 0 with header line,
t_edidd like edidd occurs 0 with header line,
bapi_retn_info like bapiret2 occurs 0 with header line.
data: error_flag.
documentheader-username = sy-uname.
documentheader-header_txt = 'Test using BAPI'.
documentheader-comp_code = '1000'.
documentheader-doc_date = sy-datum.
documentheader-pstng_date = sy-datum.
documentheader-doc_type = 'SA'.
accountgl-itemno_acc = '1'.
accountgl-gl_account = '0000160100'.
accountgl-comp_code = '1000'.
accountgl-pstng_date = sy-datum.
accountgl-doc_type = 'SA'.
accountgl-profit_ctr = '0000010000'.
append accountgl.
accountgl-itemno_acc = '2'.
accountgl-gl_account = '0000160100'.
accountgl-comp_code = '1000'.
accountgl-pstng_date = sy-datum.
accountgl-doc_type = 'SA'.
accountgl-profit_ctr = '0000010000'.
append accountgl.
currencyamount-itemno_acc = '1'.
currencyamount-currency = 'GBP'.
currencyamount-amt_doccur = '100.00'.
append currencyamount.
currencyamount-itemno_acc = '2'.
currencyamount-currency = 'GBP'.
currencyamount-amt_doccur = '-100.00'.
append currencyamount.
call BAPI-function in this system *
call function 'BAPI_ACC_GL_POSTING_POST'
exporting
documentheader = documentheader
importing
obj_type = obj_type
obj_key = obj_key
obj_sys = obj_sys
tables
accountgl = accountgl
currencyamount = currencyamount
return = return
extension1 = extension1
exceptions
others = 1.
if sy-subrc <> 0.
message e999(re) with 'Problem occured'.
else.
loop at return.
if not return is initial.
clear bapi_retn_info.
move-corresponding return to bapi_retn_info.
if return-type = 'A' or return-type = 'E'.
error_flag = 'X'.
endif.
append bapi_retn_info.
endif.
endloop.
if error_flag = 'X'.
message e999(re) with 'Problem occured'.
rollback work.
else.
commit work.
endif.
endif
Hi all,
I have been trying to use standard bapi_acc_gl_posting_post to post G/L docs.
Even though I have a 'commit work' and the return message says that the transaction was successfull, I cannot see any new docs in table bkpf.
I read Oss note 306504 but the info is vague.
My header data is:
WA_DOCUMENTHEADER-OBJ_TYPE = 'ZTEST'.
WA_DOCUMENTHEADER-OBJ_KEY = SY-UZEIT.
WA_DOCUMENTHEADER-OBJ_SYS = 'T90CLNT090'.
*WA_DOCUMENTHEADER-AC_DOC_NO = '0100000146'.
WA_DOCUMENTHEADER-USERNAME = SY-UNAME.
WA_DOCUMENTHEADER-HEADER_TXT = 'TEST'.
WA_DOCUMENTHEADER-COMP_CODE = '3000'.
WA_DOCUMENTHEADER-FISC_YEAR = '2004'.
WA_DOCUMENTHEADER-DOC_DATE = SY-DATUM.
WA_DOCUMENTHEADER-PSTNG_DATE = SY-DATUM.
WA_DOCUMENTHEADER-FIS_PERIOD = '12'.
WA_DOCUMENTHEADER-DOC_TYPE = 'SA'.
WA_DOCUMENTHEADER-COMPO_ACC = 'FI'.
Any clue? Thanks,
2008 Feb 27 4:14 AM
report z_test_bapi_gl_ac_doc .
data:
obj_type like bapiache02-obj_type,
obj_key like bapiache02-obj_key,
obj_sys like bapiache02-obj_sys,
documentheader like bapiache08,
accountgl like bapiacgl08
occurs 0 with header line,
currencyamount like bapiaccr08
occurs 0 with header line,
return like bapiret2
occurs 0 with header line,
extension1 like bapiextc
occurs 0 with header line,
t_edidd like edidd occurs 0 with header line,
bapi_retn_info like bapiret2 occurs 0 with header line.
data: error_flag.
documentheader-username = sy-uname.
documentheader-header_txt = 'Test using BAPI'.
documentheader-comp_code = '1000'.
documentheader-doc_date = sy-datum.
documentheader-pstng_date = sy-datum.
documentheader-doc_type = 'SA'.
accountgl-itemno_acc = '1'.
accountgl-gl_account = '0000160100'.
accountgl-comp_code = '1000'.
accountgl-pstng_date = sy-datum.
accountgl-doc_type = 'SA'.
accountgl-profit_ctr = '0000010000'.
append accountgl.
accountgl-itemno_acc = '2'.
accountgl-gl_account = '0000160100'.
accountgl-comp_code = '1000'.
accountgl-pstng_date = sy-datum.
accountgl-doc_type = 'SA'.
accountgl-profit_ctr = '0000010000'.
append accountgl.
currencyamount-itemno_acc = '1'.
currencyamount-currency = 'GBP'.
currencyamount-amt_doccur = '100.00'.
append currencyamount.
currencyamount-itemno_acc = '2'.
currencyamount-currency = 'GBP'.
currencyamount-amt_doccur = '-100.00'.
append currencyamount.
call BAPI-function in this system *
call function 'BAPI_ACC_GL_POSTING_POST'
exporting
documentheader = documentheader
importing
obj_type = obj_type
obj_key = obj_key
obj_sys = obj_sys
tables
accountgl = accountgl
currencyamount = currencyamount
return = return
extension1 = extension1
exceptions
others = 1.
if sy-subrc <> 0.
message e999(re) with 'Problem occured'.
else.
loop at return.
if not return is initial.
clear bapi_retn_info.
move-corresponding return to bapi_retn_info.
if return-type = 'A' or return-type = 'E'.
error_flag = 'X'.
endif.
append bapi_retn_info.
endif.
endloop.
if error_flag = 'X'.
message e999(re) with 'Problem occured'.
rollback work.
else.
commit work.
endif.
endif
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |