咨詢或探討sap相關(guān)的學(xué)習(xí),、就業(yè),、技術(shù)問題! 聲明:本文僅代表作者觀點(diǎn)和立場,不代表任何公司,!僅用于SAP軟件應(yīng)用學(xué)習(xí)參考,。SAP固定資產(chǎn)的報(bào)廢在前臺通過tcode ABAVN執(zhí)行相關(guān)業(yè)務(wù)的操作。 比如如下操作,。 事務(wù)類型:選擇如下,,可以根據(jù)實(shí)際要求選擇
填寫完成必填相關(guān)參數(shù)后,最后點(diǎn)擊保存即可,。 這個(gè)Tcode對應(yīng)的BAPI: BAPI_ASSET_RETIREMENT_POST 主要參數(shù)的錄入說明見如下示例程序:
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)."會計(jì)期間 ls_generalpostingdata-trans_date = c_alv-budat. "換算日期 ls_generalpostingdata-comp_code = c_alv-bukrs. "公司代碼 ls_generalpostingdata-assetmaino = c_alv-anln1. "主資產(chǎn)號 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)."當(dāng)年的用250 ls_generalpostingdata-assettrtyp = '250'. ELSE. ls_generalpostingdata-assettrtyp = '200'."往年的用200 ENDIF. " 如果 標(biāo)志: 記帳全部報(bào)廢 = X 則金額,報(bào)廢百分比,數(shù)量不用輸入值,,否則報(bào)錯(cuò):不允許使用此組合表目 " 注意如下金額,報(bào)廢百分比,數(shù)量只能輸其中一個(gè)值,不然會報(bào)錯(cuò):不允許使用此組合表目 ls_retirementdata-valuedate = c_alv-aktiv."參考日期 ls_furtherpostingdata-header_txt = c_alv-sgtxt."將文本寫入報(bào)廢會計(jì)憑證的抬頭文本 ls_retirementdata-compl_ret = 'X'."標(biāo)志: 記帳全部報(bào)廢 * ls_retirementdata-quantity = c_alv-menge. "數(shù)量,,有報(bào)廢數(shù)量時(shí)報(bào)廢單位必輸 * ls_retirementdata-base_uom = c_alv-meins."單位 * ls_retirementdata-amount = c_alv-amount. "金額,,有報(bào)廢金額金額時(shí)報(bào)廢金額幣別必輸 * ls_retirementdata-currency = 'RMB'. * ls_retirementdata-perc_rate = '100' "報(bào)廢百分比
CALL FUNCTION 'BAPI_ASSET_RETIREMENT_POST' EXPORTING generalpostingdata = ls_generalpostingdata retirementdata = ls_retirementdata furtherpostingdata = ls_furtherpostingdata IMPORTING documentreference = ls_doc return = ls_return. IF ls_return-type = 'S'. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' EXPORTING wait = 'X'. IF ls_return-number = '374' AND ls_return-id = 'AA'. c_alv-xblnr = ls_return-message_v2."報(bào)廢會計(jì)憑證號 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.
|