Application Development 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: 

JV-Acc document post via BAPI.

Former Member
0 Kudos
474

Hi,

I am posting a JV on ASSET through BAPI 'BAPI_ACC_DOCUMENT_POST'.

I am getting a error that GL account in not defined in chart of accounts.

To GL accnt I am passing ASSET number which id debit side and credit side will be the normal GL accnt.

If any body have suggestion or sample code please...

Thanks in advance,

Deepak.

2 REPLIES 2

aaron_morden2
Contributor
0 Kudos
150

Deepak,

Please make sure that your GL account you're passing is 10 bytes with leading zeros.

For example, if you're GL account is 123456:

wa_accountgl-gl_account   = '0000123456'.

- Aaron

0 Kudos
150

Hi,

In that ACCOUNTGL-gl_account i am passing ASSET number for which i have to post JV.

It is throughing error that 'GL_ACCOUNT is not defined in chart of accounts'.

please suggest.

****************************************

on change of it_polin-recpid.

  • write it_po-budat to date yymmdd.

clear jv_po. "

line_item = 0.

clear v_bktxt.

concatenate it_polin-recpid it_polin-bukrs

it_po-budat(04) into v_bktxt.

  • Header Data " Sending comp code

it_hdr-comp_code = it_polin-bukrs.

it_hdr-doc_date = it_po-budat.

it_hdr-pstng_date = sy-datum.

it_hdr-doc_type = v_blart.

it_hdr-ref_doc_no = it_polin-recpid.

it_hdr-BUS_ACT = 'RMWA'.

it_hdr-USERNAME = sy-uname.

it_hdr-header_txt = v_bktxt.

append it_hdr.

move: it_polin-recpid to jv_po-mblnr,

it_polin-bukrs to jv_po-bukrs,

it_polin-ebeln to jv_po-ebeln,

it_amr-anln1 to jv_po-anln1.

endon.

line_item = line_item + 1.

if not it_sactno-aufnr is initial.

clear: v_sgtxt.

concatenate it_sactno-recpid '/' it_sactno-rclno into v_sgtxt.

  • First Item

  • Account number

it_gl-itemno_acc = line_item.

it_gl-gl_account = '0000020010'. "credit

it_gl-ASSET_NO = it_amr-anln1.

it_gl-item_text = v_sgtxt.

it_gl-COSTCENTER = it_sactno-kostl.

it_gl-ACCT_TYPE = 'S'.

it_gl-PSTNG_DATE = sy-datum.

it_gl-acct_key = 'A00'.

it_gl-CS_TRANS_T = '100'.

append it_gl.

  • Set amount

it_curr-itemno_acc = line_item.

it_curr-currency = it_polin-waers.

it_curr-amt_doccur = it_polin-wrbtr.

it_curr-amt_doccur = it_curr-amt_doccur * -1.

append it_curr.

  • **********Balancing the line item amnt

line_item = line_item + 1.

clear it_gl.

it_gl-itemno_acc = line_item.

  • it_gl-gl_account = it_amr-anln1+2(10).

it_gl-ASSET_NO = it_amr-anln1.

it_gl-item_text = v_sgtxt.

it_gl-COSTCENTER = it_sactno-kostl.

it_gl-ACCT_TYPE = 'A'.

it_gl-PSTNG_DATE = sy-datum.

it_gl-acct_key = 'ANL'.

it_gl-CS_TRANS_T = '100'.

append it_gl.

  • Set amount

clear it_curr.

it_curr-itemno_acc = line_item.

it_curr-currency = it_polin-waers.

it_curr-amt_doccur = it_polin-wrbtr.

append it_curr.

endif.

if it_sactno-aufnr = space.

clear: v_sgtxt.

concatenate it_polin-recpid '/' it_polin-rclno into v_sgtxt.

  • First Item

  • Account number

it_gl-itemno_acc = line_item.

it_gl-gl_account = it_sactno-genlg.

it_gl-item_text = v_sgtxt.

it_gl-COSTCENTER = it_sactno-kostl.

it_gl-ACCT_TYPE = 'S'.

it_gl-PSTNG_DATE = sy-datum.

it_gl-acct_key = 'A00'.

append it_gl.

  • Set amount

it_curr-itemno_acc = line_item.

it_curr-currency = it_polin-waers.

it_curr-amt_doccur = it_polin-wrbtr.

append it_curr.

  • **********Balancing the line item amnt

clear it_gl.

line_item = line_item + 1.

it_gl-itemno_acc = line_item.

it_gl-gl_account = '0000020010'. "credit

it_gl-item_text = v_sgtxt.

it_gl-COSTCENTER = it_sactno-kostl.

it_gl-ACCT_TYPE = 'S'.

it_gl-PSTNG_DATE = sy-datum.

it_gl-acct_key = 'A00'.

append it_gl.

  • Set amount

clear it_curr.

it_curr-itemno_acc = line_item.

it_curr-currency = it_polin-waers.

it_curr-amt_doccur = it_polin-wrbtr.

it_curr-amt_doccur = it_curr-amt_doccur * -1.

append it_curr.

endif.

at end of recpid.

refresh t_result. clear t_result.

call function 'BAPI_ACC_DOCUMENT_CHECK'

exporting

documentheader = it_hdr

tables

accountgl = it_gl

  • ACCOUNTPAYABLE = act_pay

currencyamount = it_curr

return = t_result.

loop at t_result where ( type = 'E' or

type = 'A' ).

exit.

endloop.

if sy-subrc <> 0.

refresh t_result.

call function 'BAPI_ACC_DOCUMENT_POST'

exporting

documentheader = it_hdr

tables

accountgl = it_gl

  • ACCOUNTPAYABLE = act_pay

currencyamount = it_curr

return = t_result.

*

call function 'BAPI_TRANSACTION_COMMIT'.

endif.

****************************************

Thanks,

Deepak.

Message was edited by:

KDeepak