赞
踩
固定资产调拨
BAPI:BAPI_FIXEDASSET_CHANGE
以下代码供参考:
"BAPI导入参数 DATA: LV_COMPANYCODE LIKE BAPI1022_1-COMP_CODE, "公司代码 LV_ASSET LIKE BAPI1022_1-ASSETMAINO, "主资产号 LV_SUBNUMBER LIKE BAPI1022_1-ASSETSUBNO, "资产次级编号 LV_GROUPASSET LIKE BAPI1022_MISC-XANLGR, "标识:资产是集团公司资产 LS_GENERALDATA LIKE BAPI1022_FEGLG001, "逻辑字段组 001 - 通用数据 LS_GENERALDATAX LIKE BAPI1022_FEGLG001X, LS_INVENTORY LIKE BAPI1022_FEGLG011, LS_INVENTORYX LIKE BAPI1022_FEGLG011X, LS_POSTINGINFORMATION LIKE BAPI1022_FEGLG002, LS_POSTINGINFORMATIONX LIKE BAPI1022_FEGLG002X, LS_TIMEDEPENDENTDATA LIKE BAPI1022_FEGLG003, "逻辑字段组003 - 时间相关的数据 LS_TIMEDEPENDENTDATAX LIKE BAPI1022_FEGLG003X, LS_ALLOCATIONS LIKE BAPI1022_FEGLG004, "逻辑字段组004 - 分配 LS_ALLOCATIONSX LIKE BAPI1022_FEGLG004X, LS_ORIGIN LIKE BAPI1022_FEGLG009, "逻辑字段组009 - 原件 LS_ORIGINX LIKE BAPI1022_FEGLG009X, LS_INVESTACCTASSIGNMNT LIKE BAPI1022_FEGLG010, LS_INVESTACCTASSIGNMNTX LIKE BAPI1022_FEGLG010X, LS_NETWORTHVALUATION LIKE BAPI1022_FEGLG006, LS_NETWORTHVALUATIONX LIKE BAPI1022_FEGLG006X, LS_REALESTATE LIKE BAPI1022_FEGLG007, LS_REALESTATEX LIKE BAPI1022_FEGLG007X, LS_INSURANCE LIKE BAPI1022_FEGLG008, LS_INSURANCEX LIKE BAPI1022_FEGLG008X, LS_LEASING LIKE BAPI1022_FEGLG005, LS_LEASINGX LIKE BAPI1022_FEGLG005X, LS_GLO_TIME_DEP LIKE BAPI1022_GLO_TIME_DEP. "Globalization fields: Date interval of time-dependent data "BAPI导出参数 DATA: LS_RETURN LIKE BAPIRET2. "返回参数 "BAPI表参数 DATA: LT_DEPRECIATIONAREAS LIKE STANDARD TABLE OF BAPI1022_DEP_AREAS, LT_DEPRECIATIONAREASX LIKE STANDARD TABLE OF BAPI1022_DEP_AREASX, LT_INVESTMENT_SUPPORT LIKE STANDARD TABLE OF BAPI1022_INV_SUPPORT, LT_EXTENSIONIN LIKE STANDARD TABLE OF BAPIPAREX. DATA: LS_DEPRECIATIONAREAS LIKE BAPI1022_DEP_AREAS, LS_DEPRECIATIONAREASX LIKE BAPI1022_DEP_AREASX, LS_INVESTMENT_SUPPORT LIKE BAPI1022_INV_SUPPORT, LS_EXTENSIONIN LIKE BAPIPAREX. DATA: LS_ANLU TYPE BAPI_TE_ANLU. DATA: LT_DATA TYPE TABLE OF TY_ALV. DATA: LS_DATA TYPE TY_ALV. LT_DATA[] = GT_ALV[]. DELETE LT_DATA WHERE SEL NE 'X'. DELETE LT_DATA WHERE ICON NE ''. "状态灯不为空说明校验不通过 LOOP AT LT_DATA ASSIGNING FIELD-SYMBOL(<LW_DATA>). "清空BAPI参数 CLEAR:LV_COMPANYCODE,LV_ASSET,LV_SUBNUMBER,LV_GROUPASSET, LS_GENERALDATA,LS_GENERALDATAX,LS_INVENTORY,LS_INVENTORYX,LS_POSTINGINFORMATION, LS_POSTINGINFORMATIONX, LS_TIMEDEPENDENTDATA,LS_TIMEDEPENDENTDATAX,LS_ALLOCATIONS,LS_ALLOCATIONSX,LS_ORIGIN,LS_ORIGINX, LS_INVESTACCTASSIGNMNT,LS_INVESTACCTASSIGNMNTX,LS_NETWORTHVALUATION,LS_NETWORTHVALUATIONX,LS_REALESTATE,LS_REALESTATEX, LS_INSURANCE,LS_INSURANCEX,LS_LEASING,LS_LEASINGX,LS_GLO_TIME_DEP. CLEAR:LS_RETURN. CLEAR:LS_DEPRECIATIONAREAS,LS_DEPRECIATIONAREASX,LS_INVESTMENT_SUPPORT,LS_EXTENSIONIN. FREE:LT_DEPRECIATIONAREAS,LT_DEPRECIATIONAREASX,LT_INVESTMENT_SUPPORT,LT_EXTENSIONIN. <LW_DATA>-ANLN1 = |{ <LW_DATA>-ANLN1 ALPHA = IN }|. <LW_DATA>-KOSTL = |{ <LW_DATA>-KOSTL ALPHA = IN }|. <LW_DATA>-KOSTLV = |{ <LW_DATA>-KOSTLV ALPHA = IN }|. * Company code LV_COMPANYCODE = <LW_DATA>-BUKRS. LV_ASSET = <LW_DATA>-ANLN1. IF <LW_DATA>-ZCHG_ANLZ EQ 'X'. * Cost center LS_TIMEDEPENDENTDATA-COSTCENTER = <LW_DATA>-KOSTL. LS_TIMEDEPENDENTDATAX-COSTCENTER = 'X'. * Cost center responsible for asset LS_TIMEDEPENDENTDATA-RESP_CCTR = <LW_DATA>-KOSTLV. LS_TIMEDEPENDENTDATAX-RESP_CCTR = 'X'. "有效期起始日期 LS_TIMEDEPENDENTDATA-FROM_DATE = <LW_DATA>-ADATU."有效期起始日期 LS_TIMEDEPENDENTDATAX-FROM_DATE = 'X'. "资产停用 LS_TIMEDEPENDENTDATA-SHUTDOWN = <LW_DATA>-XSTIL."资产停用 LS_TIMEDEPENDENTDATAX-SHUTDOWN = 'X'. ENDIF. IF <LW_DATA>-ZCHG_ANLU EQ 'X'. CLEAR LS_ANLU. LS_ANLU-COMP_CODE = <LW_DATA>-BUKRS. LS_ANLU-ASSETMAINO = <LW_DATA>-ANLN1. LS_ANLU-ZSTATUS = <LW_DATA>-ZSTATUS. "资产状态 LS_EXTENSIONIN-STRUCTURE = 'BAPI_TE_ANLU'. LS_EXTENSIONIN-VALUEPART1 = LS_ANLU. APPEND LS_EXTENSIONIN TO LT_EXTENSIONIN. ENDIF. IF <LW_DATA>-ZCHG_ANLH EQ 'X'. LS_GENERALDATA-MAIN_DESCRIPT = <LW_DATA>-ANLHTXT. "资产主号说明 LS_GENERALDATAX-MAIN_DESCRIPT = 'X'. ENDIF. CALL FUNCTION 'BAPI_FIXEDASSET_CHANGE' EXPORTING COMPANYCODE = LV_COMPANYCODE ASSET = LV_ASSET SUBNUMBER = LV_SUBNUMBER GROUPASSET = LV_GROUPASSET GENERALDATA = LS_GENERALDATA GENERALDATAX = LS_GENERALDATAX INVENTORY = LS_INVENTORY INVENTORYX = LS_INVENTORYX POSTINGINFORMATION = LS_POSTINGINFORMATION POSTINGINFORMATIONX = LS_POSTINGINFORMATIONX TIMEDEPENDENTDATA = LS_TIMEDEPENDENTDATA TIMEDEPENDENTDATAX = LS_TIMEDEPENDENTDATAX ALLOCATIONS = LS_ALLOCATIONS ALLOCATIONSX = LS_ALLOCATIONSX ORIGIN = LS_ORIGIN ORIGINX = LS_ORIGINX INVESTACCTASSIGNMNT = LS_INVESTACCTASSIGNMNT INVESTACCTASSIGNMNTX = LS_INVESTACCTASSIGNMNTX NETWORTHVALUATION = LS_NETWORTHVALUATION NETWORTHVALUATIONX = LS_NETWORTHVALUATIONX REALESTATE = LS_REALESTATE REALESTATEX = LS_REALESTATEX INSURANCE = LS_INSURANCE INSURANCEX = LS_INSURANCEX LEASING = LS_LEASING LEASINGX = LS_LEASINGX GLO_TIME_DEP = LS_GLO_TIME_DEP IMPORTING RETURN = LS_RETURN TABLES DEPRECIATIONAREAS = LT_DEPRECIATIONAREAS DEPRECIATIONAREASX = LT_DEPRECIATIONAREASX INVESTMENT_SUPPORT = LT_INVESTMENT_SUPPORT EXTENSIONIN = LT_EXTENSIONIN. IF SY-SUBRC EQ 0. IF LS_RETURN-TYPE EQ 'S'. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' EXPORTING WAIT = 'X'. CALL FUNCTION 'MESSAGE_TEXT_BUILD' EXPORTING MSGID = LS_RETURN-ID MSGNR = LS_RETURN-NUMBER MSGV1 = LS_RETURN-MESSAGE_V1 MSGV2 = LS_RETURN-MESSAGE_V2 MSGV3 = LS_RETURN-MESSAGE_V3 MSGV4 = LS_RETURN-MESSAGE_V4 IMPORTING MESSAGE_TEXT_OUTPUT = <LW_DATA>-MESSAGE. <LW_DATA>-ICON = ICON_GREEN_LIGHT. ELSE. CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'. CALL FUNCTION 'MESSAGE_TEXT_BUILD' EXPORTING MSGID = LS_RETURN-ID MSGNR = LS_RETURN-NUMBER MSGV1 = LS_RETURN-MESSAGE_V1 MSGV2 = LS_RETURN-MESSAGE_V2 MSGV3 = LS_RETURN-MESSAGE_V3 MSGV4 = LS_RETURN-MESSAGE_V4 IMPORTING MESSAGE_TEXT_OUTPUT = <LW_DATA>-MESSAGE. <LW_DATA>-ICON = ICON_RED_LIGHT. ENDIF. ELSE. <LW_DATA>-ICON = ICON_RED_LIGHT. <LW_DATA>-MESSAGE = '调拨失败,未传入数据'. ENDIF. ENDLOOP.
OVER…
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。