‎2009 Apr 01 2:52 PM
Hello,
I am trying to use the bapi in the subject following other post on the sdn, but I get this error message:
Error in document: 200111 AC_DOC_NO
E
Required field OBJ_TYPE was not transferred in parameter DOCUMENTHEADER
E
Required field OBJ_KEY was not transferred in parameter DOCUMENTHEADER
E
Required field OBJ_SYS was not transferred in parameter DOCUMENTHEADER
I think I have to initialize some fields, but I don't know how.
Can anybody pleas help me or explain me what is missing and how can I fix it?
thanks in advance
Gabriele
‎2009 Apr 01 2:55 PM
DOCUMENTHEADER is a mandatory structure, so pass all the values, its asking for.
‎2009 Apr 01 3:22 PM
yes,
but how should I fill the three field mentioned above? I don't know if there are known values or they depends from something. Please be patient with me I am new in this world (that is very very wide)
this are the fields I set in header:
x_invheader-bus_act = 'RFBU'. "Business Transaction
x_invheader-username = sy-uname. "User name
x_invheader-header_txt = 'prova bapi'. "Document Header Text
x_invheader-comp_code = 'TES1'. "Company Code
x_invheader-doc_date = '20090401'. "Document Date in Document
x_invheader-pstng_date = '20090401'. "Posting Date in the Document
x_invheader-doc_type = '01'. "Reference Document Number
x_invheader-ref_doc_no = 'FATT'. "Reference Document Number
x_invheader-ac_doc_no = '200115'.
x_invheader-fisc_year = '2009'.thanks
Gabriele
Edited by: Gabriele Montori on Apr 1, 2009 4:24 PM
Edited by: Gabriele Montori on Apr 1, 2009 4:25 PM
‎2009 Apr 01 4:01 PM
your functional consultant should provide you some test data to test it...
‎2009 Apr 01 2:58 PM
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.source: http://sap.ittoolbox.com/groups/technical-functional/sap-dev/bapi_acc_document_post-622561