CLEAR:
ls_GENERALPOSTINGDATA,
ls_TRANSFERTODATA,
ls_TRANSFERPOSTINGDATA,
ls_FURTHERPOSTINGDATA,
lt_RETURN_ALL.
ls_GENERALPOSTINGDATA-DOC_DATE = '20231031'. "凭证日期
ls_GENERALPOSTINGDATA-PSTNG_DATE = '20231031'. "过账日期
* ls_GENERALPOSTINGDATA-TRANS_DATE = F_BUDAT. "资产价值日期
ls_GENERALPOSTINGDATA-COMP_CODE = '2006'. "公司代码
ls_GENERALPOSTINGDATA-ASSETMAINO = '160400000004'. "预转固资产号
ls_GENERALPOSTINGDATA-ASSETSUBNO = '0000'. "预转固资产子号
ls_TRANSFERPOSTINGDATA-VALUEDATE = '20231031'. "资产价值日期
ls_TRANSFERTODATA-PART_COMCO = '2006'. "公司代码
ls_TRANSFERTODATA-PART_ASSET = '160104000106 '."正式资产号
ls_TRANSFERTODATA-PART_SUBNO = '0000'."正式资产子号
ls_FURTHERPOSTINGDATA-HEADER_TXT = '正式转资'. "凭证抬头文本
* ls_TRANSFERPOSTINGDATA-TRANSVAR = '1SAP'. "往来变式
ls_TRANSFERPOSTINGDATA-AMOUNT = '1000'. "本年度价值
ls_TRANSFERPOSTINGDATA-CURRENCY = 'CNY'. "货币
ls_TRANSFERPOSTINGDATA-NEW_ACQ_IN = ''.
CALL FUNCTION 'BAPI_ASSET_TRANSFER_CHECK'
EXPORTING
GENERALPOSTINGDATA = ls_GENERALPOSTINGDATA
TRANSFERTODATA = ls_TRANSFERTODATA
TRANSFERPOSTINGDATA = ls_TRANSFERPOSTINGDATA
FURTHERPOSTINGDATA = ls_FURTHERPOSTINGDATA
TABLES
RETURN_ALL = lt_RETURN_ALL.
READ TABLE lt_RETURN_ALL INTO ls_RETURN_ALL WITH KEY TYPE = 'E'.
IF SY-SUBRC <> 0.
CALL FUNCTION 'BAPI_ASSET_TRANSFER_POST'
EXPORTING
GENERALPOSTINGDATA = ls_GENERALPOSTINGDATA
TRANSFERTODATA = ls_TRANSFERTODATA
TRANSFERPOSTINGDATA = ls_TRANSFERPOSTINGDATA
FURTHERPOSTINGDATA = ls_FURTHERPOSTINGDATA
TABLES
RETURN_ALL = lt_RETURN_ALL.
READ TABLE lt_RETURN_ALL INTO ls_RETURN_ALL WITH KEY TYPE = 'S' ID = 'FAA_POST' .
IF SY-SUBRC = 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
* REC_out7-GDATUM1 = F_BUDAT.
* REC_out7-BELNR1 = ls_RETURN_ALL-MESSAGE_V2 .
* MOVE-CORRESPONDING REC_out7 TO REC_ZFI0067T.
* MODIFY TAB_out7 FROM REC_out7 INDEX L_TABIX.
* MODIFY ZFI0067T FROM REC_ZFI0067T.
*
* MOVE-CORRESPONDING REC_out7 TO REC_ZFI0068T.
* MODIFY ZFI0068T FROM REC_ZFI0068T.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
ENDIF.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
ENDIF.
SAP 固定资产转固定资产
于 2023-10-31 14:40:36 首次发布