09-20-2006 12:57 PM
When We try to post a document thru BAPI_ACC_DOCUMENT_POST the System gives a blank screen and does not post the document. We were able post a document in Development but unable to do in testing.
Any ideas why this is happening??
Appreciate any help on this .
Thanks.
sivaram
09-20-2006 1:03 PM
Check the below code:
data: wa_dh type bapiache09.
data:
t_ap type standard table of bapiacap09 with header line,
t_ret type standard table of bapiret2 with header line,
t_amt type standard table of bapiaccr09 with header line,
t_gl type standard table of bapiacgl09 with header line.
wa_dh-doc_date = ll_a00-creation_date.
wa_dh-obj_key = ll_i04-inv_number. "Inv ref
wa_dh-ref_doc_no = ll_i04-inv_number. "Inv ref
wa_dh-header_txt = co_headtext. "'BAPI-IDE'
wa_dh-pstng_date = sy-datum.
wa_dh-doc_type = co_doctype. "KR
wa_dh-obj_type = co_objecttype. "'IDOC'
wa_dh-obj_sys = v_sen_ls(10).
wa_dh-username = sy-uname.
wa_dh-bus_act = co_businessact. "'RFBU'
t_gl-itemno_acc = v_item_readcount.
t_gl-item_text = wa_acc_values-code.
append t_gl.
t_ap-itemno_acc = v_item_readcount.
t_ap-vendor_no = v_vendor_account.
t_ap-bline_date = v_base_date.
append t_ap.
t_amt-itemno_acc = v_item_readcount.
t_amt-currency = v_currency.
t_amt-amt_doccur = wa_vat-vatamt.
Get the Base amount from the header table
if wa_vat-vatamt lt 0.
read table t_inv into wa_inv
with key type = 'C'.
else.
read table t_inv into wa_inv
with key type = 'I'.
endif.
t_amt-amt_base = wa_inv-inv.
append t_amt.
Call the BAPI to post the Invoice.
call function 'BAPI_ACC_DOCUMENT_POST'
exporting
documentheader = wa_dh
tables
accountgl = t_gl
accountpayable = t_ap
currencyamount = t_amt
return = t_ret.
Check for errors (filter for E & A)
loop at t_ret into ll_result.
if ll_result-type = 'E'
or ll_result-type = 'A'.
append ll_result to lt_result_tmp.
endif.
endloop.
Regards,
Prakash.
09-20-2006 1:11 PM