SAP固定资产报废BAPI_ASSET_RETIREMENT_POST的主要参数说明<转载>
原文链接:https://mp.weixin.qq.com/s/bzuK0PUfY7Zb-AoAIeWKiQ
SAP固定资产的报废在前台通过tcode ABAVN执行相关业务的操作。
比如如下操作。
事务类型:选择如下,可以根据实际要求选择
填写完成必填相关参数后,最后点击保存即可。
这个Tcode对应的BAPI:
BAPI_ASSET_RETIREMENT_POST
主要参数的录入说明见如下示例程序:
FORM frm_asset_retire CHANGING c_alv TYPE gty_alv.DATA: ls_generalpostingdata TYPE bapifapo_gen_info,ls_retirementdata TYPE bapifapo_ret,ls_doc TYPE bapifapo_doc_ref,ls_return TYPE bapiret2,ls_furtherpostingdata TYPE bapifapo_add_info.ls_generalpostingdata-username = sy-uname.ls_generalpostingdata-doc_date = c_alv-bldat."凭证中的凭证日期ls_generalpostingdata-pstng_date = c_alv-budat."凭证中的过账日期ls_generalpostingdata-fis_period = c_alv-budat+4(2)."会计期间ls_generalpostingdata-trans_date = c_alv-budat. "换算日期ls_generalpostingdata-comp_code = c_alv-bukrs. "公司代码ls_generalpostingdata-assetmaino = c_alv-anln1. "主资产号ls_generalpostingdata-assetsubno = '0000'.SELECT SINGLE zujhr INTO c_alv-zujhr FROM anla WHERE anln1 = c_alv-anln1 AND bukrs = c_alv-bukrs.IF c_alv-zujhr = sy-datum+0(4)."当年的用250ls_generalpostingdata-assettrtyp = '250'.ELSE.ls_generalpostingdata-assettrtyp = '200'."往年的用200ENDIF." 如果 标志: 记帐全部报废 = X 则金额,报废百分比,数量不用输入值,否则报错:不允许使用此组合表目 " 注意如下金额,报废百分比,数量只能输其中一个值,不然会报错:不允许使用此组合表目 ls_retirementdata-valuedate = c_alv-aktiv."参考日期ls_furtherpostingdata-header_txt = c_alv-sgtxt."将文本写入报废会计凭证的抬头文本ls_retirementdata-compl_ret = 'X'."标志: 记帐全部报废
* ls_retirementdata-quantity = c_alv-menge. "数量,有报废数量时报废单位必输
* ls_retirementdata-base_uom = c_alv-meins."单位
* ls_retirementdata-amount = c_alv-amount. "金额,有报废金额金额时报废金额币别必输
* ls_retirementdata-currency = 'RMB'.
* ls_retirementdata-perc_rate = '100' "报废百分比CALL FUNCTION 'BAPI_ASSET_RETIREMENT_POST'EXPORTINGgeneralpostingdata = ls_generalpostingdataretirementdata = ls_retirementdatafurtherpostingdata = ls_furtherpostingdataIMPORTINGdocumentreference = ls_docreturn = ls_return.IF ls_return-type = 'S'.CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'EXPORTINGwait = 'X'.IF ls_return-number = '374' ANDls_return-id = 'AA'.c_alv-xblnr = ls_return-message_v2."报废会计凭证号c_alv-done = 'X'.ENDIF.c_alv-light = icon_green_light.c_alv-msg = ls_return-message.ELSE.CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.c_alv-light = icon_red_light.c_alv-msg = ls_return-message.ENDIF.ENDFORM.