‎2007 Feb 13 4:35 PM
Hi,
I am posting a JV with respective to ASSET.
Linr item 1: which i was passing ASSET in place of GL number with posting key ANL. 70( debit).
Line item 2: I am passing normal GL number with posting key A00 40 (credit).
Here i am getting the problem is it is giving me the error that for 1st line item which i was passing the ASSET number 'GL number was not defined in chart of accounts'.
Please suggest me with sample code or any idea.
Unable to come out of this issue.
Thanks,
Deepak.
‎2007 Feb 13 4:56 PM
Did you do a conversion_alpha routine ?
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = i_indata-t_glacnt
IMPORTING
output = l_glacnt.
now use l_glacnt. Declare this as the bapi gl acnt type.
hope this helps. Award points if it helps.
‎2007 Feb 13 5:02 PM
Hi Vinni,
I have already took care of this.
Actually my problem is with posting key while passing to BAPI. I think so.
And in place of GL number i am passing the Asset number for a line item.
Please any suggestions reg this.
********************************************************
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 = '0000020002'. "credit GL#
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). "Asset #
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 = '0000020002'. "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.
‎2007 Feb 13 6:00 PM
Hey,
I don't think passing the gl account number with zeros is gud..use conversion_alpha routine. And I am not sure if you can use the asset no. for gl account.
Thanks.
Award points if it helps.