‎2008 Dec 10 11:10 AM
Hi,
I am using the BAPI_ACC_DOCUMENT_POST in down payment for creating an down payment document.(Similar to F-47 transaction).
Here i am only filling the header and the vendor(ACCOUNTPAYABLE), currency(CURRENCYAMOUNT) structures...(With only one line item)..
I am getting an error: balance in transaction currency..
Can you help?
Regards
Shiva
‎2008 Dec 10 11:15 AM
Use this code might help you
LOOP AT gt_data INTO gw_data.
MOVE gw_data TO lw_data.
AT NEW posnr.
MOVE sy-tabix TO from_row.
gw_header-comp_code = lw_data-bukrs.
gw_header-doc_type = lw_data-blart.
gw_header-pstng_date = lw_data-budat.
gw_header-doc_date = lw_data-bldat.
gw_header-username = sy-uname.
gw_header-bus_act = 'RFBU'.
gw_header-ref_doc_no = lw_data-xblnr.
gw_header-header_txt = lw_data-bktxt.
ENDAT.
MOVE sy-tabix TO to_row.
APPEND lw_data TO lt_errdata.
gw_acgl-itemno_acc = gw_acgl-itemno_acc + 1.
IF gw_data-koart = 'C'.
gw_acre-itemno_acc = gw_acgl-itemno_acc.
WRITE gw_data-hkont TO gw_acre-customer.
gw_acre-comp_code = lw_data-bukrs.
gw_acre-bus_area = gw_data-gsber.
gw_acre-item_text = gw_data-sgtxt.
gw_acre-alloc_nmbr = gw_data-zuonr.
gw_acre-tax_code = gw_data-mwskz.
APPEND gw_acre TO gt_acre.
ELSEIF gw_data-koart = 'V'.
gw_acpa-itemno_acc = gw_acgl-itemno_acc.
WRITE gw_data-hkont TO gw_acpa-vendor_no.
gw_acpa-comp_code = lw_data-bukrs.
gw_acpa-bus_area = gw_data-gsber.
gw_acpa-item_text = gw_data-sgtxt.
gw_acpa-alloc_nmbr = gw_data-zuonr.
gw_acpa-tax_code = gw_data-mwskz.
APPEND gw_acpa TO gt_acpa.
ELSEIF gw_data-koart = 'G'.
WRITE gw_data-hkont TO gw_acgl-gl_account.
gw_acgl-bus_area = gw_data-gsber.
IF gw_data-kostl IS INITIAL.
CLEAR gw_acgl-costcenter.
ELSE.
WRITE gw_data-kostl TO gw_acgl-costcenter.
ENDIF.
gw_acgl-tax_code = gw_data-mwskz.
gw_acgl-orderid = gw_data-vbel2.
IF gw_data-projk IS INITIAL.
CLEAR gw_acgl-wbs_element.
ELSE.
gw_acgl-wbs_element = gw_data-projk.
ENDIF.
gw_acgl-item_text = gw_data-sgtxt.
gw_acgl-alloc_nmbr = gw_data-zuonr.
APPEND gw_acgl TO gt_acgl.
ENDIF.
gw_amt-itemno_acc = gw_acgl-itemno_acc.
gw_amt-currency = gw_data-waers.
gw_amt-amt_doccur = gw_data-wrbtr.
gw_amt-amt_base = gw_data-wmwst.
APPEND gw_amt TO gt_amt.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
documentheader = gw_header
TABLES
accountgl = gt_acgl
accountreceivable = gt_acre
accountpayable = gt_acpa
currencyamount = gt_amt
return = gt_ret.
‎2008 Dec 10 11:15 AM
Use this code might help you
LOOP AT gt_data INTO gw_data.
MOVE gw_data TO lw_data.
AT NEW posnr.
MOVE sy-tabix TO from_row.
gw_header-comp_code = lw_data-bukrs.
gw_header-doc_type = lw_data-blart.
gw_header-pstng_date = lw_data-budat.
gw_header-doc_date = lw_data-bldat.
gw_header-username = sy-uname.
gw_header-bus_act = 'RFBU'.
gw_header-ref_doc_no = lw_data-xblnr.
gw_header-header_txt = lw_data-bktxt.
ENDAT.
MOVE sy-tabix TO to_row.
APPEND lw_data TO lt_errdata.
gw_acgl-itemno_acc = gw_acgl-itemno_acc + 1.
IF gw_data-koart = 'C'.
gw_acre-itemno_acc = gw_acgl-itemno_acc.
WRITE gw_data-hkont TO gw_acre-customer.
gw_acre-comp_code = lw_data-bukrs.
gw_acre-bus_area = gw_data-gsber.
gw_acre-item_text = gw_data-sgtxt.
gw_acre-alloc_nmbr = gw_data-zuonr.
gw_acre-tax_code = gw_data-mwskz.
APPEND gw_acre TO gt_acre.
ELSEIF gw_data-koart = 'V'.
gw_acpa-itemno_acc = gw_acgl-itemno_acc.
WRITE gw_data-hkont TO gw_acpa-vendor_no.
gw_acpa-comp_code = lw_data-bukrs.
gw_acpa-bus_area = gw_data-gsber.
gw_acpa-item_text = gw_data-sgtxt.
gw_acpa-alloc_nmbr = gw_data-zuonr.
gw_acpa-tax_code = gw_data-mwskz.
APPEND gw_acpa TO gt_acpa.
ELSEIF gw_data-koart = 'G'.
WRITE gw_data-hkont TO gw_acgl-gl_account.
gw_acgl-bus_area = gw_data-gsber.
IF gw_data-kostl IS INITIAL.
CLEAR gw_acgl-costcenter.
ELSE.
WRITE gw_data-kostl TO gw_acgl-costcenter.
ENDIF.
gw_acgl-tax_code = gw_data-mwskz.
gw_acgl-orderid = gw_data-vbel2.
IF gw_data-projk IS INITIAL.
CLEAR gw_acgl-wbs_element.
ELSE.
gw_acgl-wbs_element = gw_data-projk.
ENDIF.
gw_acgl-item_text = gw_data-sgtxt.
gw_acgl-alloc_nmbr = gw_data-zuonr.
APPEND gw_acgl TO gt_acgl.
ENDIF.
gw_amt-itemno_acc = gw_acgl-itemno_acc.
gw_amt-currency = gw_data-waers.
gw_amt-amt_doccur = gw_data-wrbtr.
gw_amt-amt_base = gw_data-wmwst.
APPEND gw_amt TO gt_amt.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
documentheader = gw_header
TABLES
accountgl = gt_acgl
accountreceivable = gt_acre
accountpayable = gt_acpa
currencyamount = gt_amt
return = gt_ret.
‎2008 Dec 10 11:20 AM
Hi,
You can check F-47; At a time you can post a document with only one line item(vendor)..
if i use the same data in F-47 to post using the BAPI it is not working..
Regards
Shiva
‎2008 Dec 10 11:29 AM
Hi
It can't use this BAPI to post down payment: there's no fields in the BAPI structure to transfer the Target Special G/L Indicator.
Anyway try to use the structure for extension in order to transfer that Target Special G/L Indicator.
Max
Edited by: max bianchi on Dec 10, 2008 12:36 PM
‎2008 Dec 10 11:49 AM
Is there any FM or BAPI to create downpayment document similar to F-47?
‎2010 Sep 03 2:01 PM
‎2008 Dec 10 11:20 AM
Hi
U need to transfer at least two items to the BAPI and the total of amounts of those 2 items has to be 0.
Only if you need to post NOTED ITEM u can transfer only 1 item, but u need to use particular document types.
Max
‎2008 Dec 10 11:25 AM