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

Help with bapi_acc_document_post

Former Member
0 Likes
1,380

Hello, i´m working with bapi_acc_document_post.

I need to post this document:

Position 1: vendor 1000 usd

Posicion2: vat 1000 usd

but the bapi does not post it correctly.

Does anyone knows how to fill the internal tables to post it?

Thanks!

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
826

search the forum..u can find sample programs.

3 REPLIES 3
Read only

pramodu
Active Participant
0 Likes
826

You can try to Fill

CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'

EXPORTING

documentheader = lx_head

TABLES

accountgl = li_gl

accountreceivable = li_ar

currencyamount = li_cr

return = li_ret.

Fill All the paramerters as below

Header contruction to be done based on retireval as per your reuirement

lx_head-bus_act = 'RFBU'

lx_head-username = sy-uname.

lx_head-header_txt = 'abcd'

lx_head-comp_code = bukrs.

lx_head-doc_date = budat.

lx_head-pstng_date = budat.

lx_head-fisc_year = year.

lx_head-fis_period = monat.

lx_head-doc_type = blart.

lx_head-ref_doc_no = rebzg.

SELECT *

INTO TABLE li_bseg

FROM bseg

WHERE bukrs = Compnay Code

AND belnr = BELNR

AND gjahr = Fiscal Year

CLEAR lx_ar.

lx_ar-itemno_acc = " Fill First item count from BSEG.

lx_ar-customer = lx_bseg-kunnr.

lx_ar-sp_gl_ind = lx_bseg-umskz.

lx_ar-gl_account = x_zfipr2-hkont1.

lx_ar-ref_key_1 = lx_bseg-xref1.

lx_ar-ref_key_3 = lx_bseg-rebzg.

lx_ar-comp_code = lx_bseg-bukrs.

lx_ar-alloc_nmbr = lx_bseg-zuonr.

lx_ar-item_text = lx_bseg-sgtxt.

APPEND lx_ar TO li_ar.

fill GL account data li_gl based on BSEG data

Fill amount /Documen tcurrency /Currency /Item no_acc into li_cr. This can be done agin with BSEG data

~Pramod

Read only

Former Member
0 Likes
826

Hello PKUPADHYAY

the code you post works fine, but the vat line is posted as GL line, and not as a VAT line, so the VAT report doesn´t show this document, and it can´t be accepted by customer.

Thanks!

Read only

Former Member
0 Likes
827

search the forum..u can find sample programs.