‎2014 Feb 24 1:11 PM
Hi ,
How to do asset posting with BAPI BAPI 'BAPI_ACC_DOCUMENT_POST'.
I have tried with various post on SDN but still not found answer to this.
Can anyone help on this.
Regards,
Priyaranjan
‎2014 Feb 24 1:38 PM
Hello Priyaranjan,
Refer to the test program (ACC_BAPI_TEST_DOCUMENT) in SE38 available in SAP system on how to pass vaues to the BAPI "BAPI_ACC_DOCUMENT_POST".
In the line number 117 you can find the BAPI called to post.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
documentheader = gd_documentheader
customercpd = gd_customercpd
contractheader = gd_fica_hd
IMPORTING
obj_type = l_type
obj_key = l_key
obj_sys = l_sys
TABLES
accountgl = it_accountgl
accountreceivable = it_accountreceivable
accountpayable = it_accountpayable
accounttax = it_accounttax
currencyamount = it_currencyamount
criteria = it_criteria
valuefield = it_valuefield
extension1 = it_ext
return = it_return
paymentcard = it_paymentcard
contractitem = it_fica_it
extension2 = it_ext2
realestate = it_re.
Regards,
Thanga
‎2014 Feb 24 1:45 PM
Please post your Code or the actual error you are facing during this BAPI call for Asset posting.
Cheers,
Prakash
‎2014 Feb 25 4:13 AM
Hi ,
I am getting below error.
Enter another transaction type (Transaction type does not exist)
Regards,
Priyaranjan
‎2014 Feb 25 4:30 AM
Hi,
For asset posting , I tried putting asset no in the gl_account field.
In that case i am getting error G/L account 1200057 is not defined in chart of accounts Z001
Below is my code
*fill header
gd_documentheader-username = sy-uname.
gd_documentheader-header_txt = 'Test'.
gd_documentheader-comp_code = p_ccode.
gd_documentheader-doc_date = sy-datum.
gd_documentheader-pstng_date = sy-datum.
gd_documentheader-doc_type = 'KR'.
gd_documentheader-ref_doc_no = p_xblnr.
gd_documentheader-bus_act = 'RMWE'.
*fill AP (line 1) - vendor related data
SELECT SINGLE zterm FROM lfb1 INTO p_zterm WHERE lifnr = p_lifnr.
it_accountpayable-itemno_acc = 1.
it_accountpayable-pmnttrms = p_zterm.
it_accountpayable-vendor_no = p_lifnr.
*it_accountpayable-item_text = 'Test 1'.
it_accountpayable-pymt_meth = p_pmet.
APPEND it_accountpayable.
it_accountgl-itemno_acc = 2.
it_accountgl-gl_account = p_asset. "asset number
it_accountgl-costcenter = p_cc.
*it_accountgl-wbs_element = p_posid.
*it_accountgl-asset_no = p_asset.
*it_accountgl-CS_TRANS_T = '100'.
it_accountgl-acct_type = 'A'.
it_accountgl-comp_code = p_ccode.
it_accountgl-tax_code = p_txcd.
it_accountgl-pstng_date = sy-datum.
it_accountgl-fisc_year = sy-datum(4).
APPEND it_accountgl.
*fill currency ammounts for lines 1 & 2
it_currencyamount-currency = p_waers.
it_currencyamount-itemno_acc = 1.
*it_currencyamount-AMT_BASE = p_ttax.
it_currencyamount-amt_doccur = - p_totamt.
APPEND it_currencyamount.
CLEAR it_currencyamount-amt_base .
it_currencyamount-itemno_acc = 2.
it_currencyamount-amt_base = p_ttax.
it_currencyamount-amt_doccur = p_lamt + p_ttax.
APPEND it_currencyamount.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
documentheader = gd_documentheader
* CUSTOMERCPD =
* CONTRACTHEADER =
IMPORTING
OBJ_KEY = wa_obj_key
tables
ACCOUNTGL = it_accountgl
ACCOUNTPAYABLE = it_accountpayable
currencyamount = it_currencyamount
* CRITERIA =
* VALUEFIELD =
* EXTENSION1 =
return = it_return
.
 
COMMIT WORK.
‎2014 Feb 25 4:43 AM
Hello Priyaranjan,
While sending data to the table "ACCOUNTGL" check the transaction type your are passing in the field CS_TRANS_T - Transaction Type. You can check the allowed transaction type values in the table "T856". Check are you passing the transaction type other than that in the table T856.
Regards,
Thanga
‎2014 Feb 25 5:24 AM
Hi Thanga,
Transaction type 100 is available in table T856.
Regards,
Priyaranjan
‎2014 Feb 25 8:23 AM
Issue resolved.
Passed asset sub number also ant it worked.
Thanks all.
Regards,
Priyaranjan
‎2014 Feb 25 10:30 AM
Hello Priyaranjan,
That's great. Please close the thread if the issue is solved.
Kindly raise a new thread whenever any help is required.
Regards,
Thanga