Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Error: BAPI_ACC_DOCUMENT_POST in down payment

Former Member
0 Likes
1,860

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,284

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.

7 REPLIES 7
Read only

Former Member
0 Likes
1,285

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.

Read only

0 Likes
1,284

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

Read only

0 Likes
1,284

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

Read only

0 Likes
1,284

Is there any FM or BAPI to create downpayment document similar to F-47?

Read only

0 Likes
1,284

Try using BADI suggested in this message:

For us it is working, but our problem now is that even the document posted is statistical, the G/L account balance is updated (FS10N)

Read only

Former Member
0 Likes
1,284

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

Read only

0 Likes
1,284

I am using the document type KA...