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

Few Issues Faced in BAPI_ACC_DOCUMENT_POST

Former Member
0 Likes
1,214

Dear All,

I'm using BAPI_ACC_DOCUMENT_POST to post Customer Invoice (F-22).

1)

When upload transaction with Special GL, program should not fill in the value in the field "Invoice Ref" as 'V'.

I saw this value in TCode FB03 with Account Document Number after Posting. It is coming in Down Payment Transaction.

2)

In my Data file, I have Tax Amount(BSEG-FWBAS) and Amount(BSEG-WRBTR).

I pass this value to CURRENCYAMOUNT-TAX_AMT and CURRENCYAMOUNT-AMT_DOCCUR in the Function Module BAPI_ACC_DOCUMENT_POST.

After posting, I want to check the Tax amount field in the Transaction FB03. It is not available. Only Amount field is coming.

But the exact value is available in the table BSEG against Account Document Number.

Can any one tell me the reason and help me to solve this?

Thanks & Regards,

Neeraj.

3 REPLIES 3
Read only

Former Member
0 Likes
656

REFRESH : i_accountgl,

i_accountreceivable,

i_currencyamount,

i_return.

CLEAR : wa_documentheader,

wa_accountgl,

wa_accountreceivable,

wa_currencyamount,

wa_return,

g_shipdate,

g_matdate,

g_amount.

*changing the format of the shipment date from MM/DD/YYYY TO YYYYMMDD

CONCATENATE p_wa_item-shipdate+6(4)

p_wa_item-shipdate+0(2)

p_wa_item-shipdate+3(2)

INTO g_shipdate.

*changing the format of the loan maturity date from MM/DD/YYYY TO YYYYMMDD

CONCATENATE p_wa_item-matdate+6(4)

p_wa_item-matdate+0(2)

p_wa_item-matdate+3(2)

INTO g_matdate.

*changing the format of the due date from MM/DD/YYYY TO YYYY.MM.DD

CONCATENATE p_wa_item-duedate+6(4)

c_dot

p_wa_item-duedate+0(2)

c_dot

p_wa_item-duedate+3(2)

INTO p_wa_item-duedate.

*assignment of credit/debit indicator and document type(invoice/credit memo)

IF p_wa_item-amount LT 0.

g_credeb_ind = c_debit -


S.

g_doctyp = c_doctypcreditmemo DG.

ELSE.

g_credeb_ind = c_credit H.

g_doctyp = c_doctypinvoice. DR

ENDIF.

wa_documentheader-bus_act = c_busact. RFBU

wa_documentheader-username = sy-uname.

wa_documentheader-comp_code = p_wa_item-compcode.

wa_documentheader-doc_date = g_shipdate.

wa_documentheader-pstng_date = p_posdat.

wa_documentheader-ref_doc_no = p_wa_item-docnum.

wa_documentheader-doc_type = g_doctyp.

wa_accountgl-itemno_acc = c_glitemno. 2

wa_accountgl-gl_account = p_saknr.

wa_accountgl-comp_code = p_wa_item-compcode.

wa_accountgl-de_cre_ind = g_credeb_ind.

APPEND wa_accountgl TO i_accountgl.

wa_accountreceivable-itemno_acc = c_hditemno. 1

wa_accountreceivable-customer = p_kunnr.

wa_accountreceivable-comp_code = p_wa_item-compcode.

wa_accountreceivable-bline_date = g_matdate.

wa_accountreceivable-pmnttrms = p_zterm.

wa_accountreceivable-pmnt_block = c_blockpayment.

APPEND wa_accountreceivable TO i_accountreceivable.

wa_currencyamount-itemno_acc = c_hditemno. 1

wa_currencyamount-curr_type = c_currtyp. 00

wa_currencyamount-amt_doccur = p_wa_item-amount.

wa_currencyamount-currency = p_wa_item-currency.

APPEND wa_currencyamount TO i_currencyamount.

g_amount = p_wa_item-amount.

IF p_wa_item-amount GT 0.

CONCATENATE c_minus p_wa_item-amount INTO p_wa_item-amount.

CONDENSE p_wa_item-amount NO-GAPS.

ELSE.

REPLACE FIRST OCCURRENCE OF c_minus IN p_wa_item-amount WITH space.

ENDIF.

wa_currencyamount-itemno_acc = c_glitemno.

wa_currencyamount-curr_type = c_currtyp.

wa_currencyamount-amt_doccur = p_wa_item-amount.

wa_currencyamount-currency = p_wa_item-currency.

APPEND wa_currencyamount TO i_currencyamount.

*bapi for posting the invoice and credit memo documents

CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'

EXPORTING

documentheader = wa_documentheader

TABLES

accountgl = i_accountgl

accountreceivable = i_accountreceivable

currencyamount = i_currencyamount

return = i_return.

check above fm for that fm..

But for F-22 i have used another function module

AC_DOCUMENT_DIRECT_INPUT

Read only

JozsefSzikszai
Active Contributor
0 Likes
656

hi Neeraj,

1. you have to modify your program...

2. in the CURRENCYAMOUNT table there should be three lines (one for customer, one for G/L account, one for tax account)

in the ACCOUNTTAX table there should be one line refering to the G/L line of the CURRENCYAMOUNT table. Pls. check this!

hope this helps

ec

Read only

0 Likes
656

Dear Eric,

Thanks for your reply.

2. In the CURRENCYAMOUNT table of BAPI_ACC_DOCUMENT_POST, only the following fields are available.

ITEMNO_ACC, CURR_TYPE, CURRENCY, CURRENCY_ISO, AMT_DOCCUR, EXCH_RATE, EXCH_RATE_V, AMT_BASE, DISC_BASE, DISC_AMT, TAX_AMT.

I passed the values for ITEMNO_ACC, CURRENCY, TAX_AMT and AMT_DOCCUR in the structure CURRENCYAMOUNT.

I also passed the values for ITEMNO_ACC, GL_ACCOUNT, TAX_CODE in the structure ACCOUNTTAX.

Still I could not make out.

Can you please help me to proceed further?

Thanks & Regards,

Neeraj