固定资产创建BAPI_FIXEDASSET_CREATE--含扩展结构字段EXTENSIONIN
REPORT ZTIMEZONES . "输出 DATA:LS_RETURN TYPE BAPIRET2. DATA:LS_COMPANY TYPE BAPI1022_1."公司代码填制 DATA:LS_GENERALDATA TYPE BAPI1022_FEGLG001."资产基本信息填制 DATA:LS_GENERALDATAX TYPE BAPI1022_FEGLG001X."资产基本信息更新 DATA:LS_TIMEDEPENDENTDATA TYPE BAPI1022_FEGLG003."资产与时间相关信息更新 DATA:LS_TIMEDEPENDENTDATAX TYPE BAPI1022_FEGLG003X."资产与时间相关信息更新 DATA:LT_DEPRECIATIONAREAS TYPE STANDARD TABLE OF BAPI1022_DEP_AREAS."折旧信息填制 DATA:LS_DEPRECIATIONAREAS LIKE LINE OF LT_DEPRECIATIONAREAS."折旧信息填制 DATA:LT_DEPRECIATIONAREASX TYPE STANDARD TABLE OF BAPI1022_DEP_AREASX."折旧信息信息更新 DATA:LS_DEPRECIATIONAREASX LIKE LINE OF LT_DEPRECIATIONAREASX."折旧信息信息更新 DATA:LS_ASSETCREATED TYPE BAPI1022_REFERENCE. DATA:LS_MESSAGE TYPE STRING. DATA:LS_EXTENSIONIN TYPE BAPIPAREX. DATA:LT_EXTENSIONIN TYPE STANDARD TABLE OF BAPIPAREX. DATA: LS_ANLU TYPE BAPI_TE_ANLU. DATA:LS_ORIGIN TYPE BAPI1022_FEGLG009."资产源相关信息 DATA:LS_ORIGINX TYPE BAPI1022_FEGLG009X."资产源相关更新 LS_COMPANY-COMP_CODE = '8000'. LS_GENERALDATA-ASSETCLASS = 'HC104'. LS_GENERALDATAX-ASSETCLASS = 'X'. LS_GENERALDATA-DESCRIPT = '测试OA生成固定资产'. LS_GENERALDATAX-DESCRIPT = 'X'. LS_GENERALDATA-MAIN_DESCRIPT = '测试OA生成固定资产111'. LS_GENERALDATAX-MAIN_DESCRIPT = 'X'. LS_TIMEDEPENDENTDATA-COSTCENTER = '809001'. *LS_TIMEDEPENDENTDATA-COSTCENTER = '809022201'. LS_TIMEDEPENDENTDATAX-COSTCENTER = 'X'. LS_GENERALDATA-QUANTITY = 1. LS_GENERALDATAX-QUANTITY = 'X'. LS_GENERALDATA-BASE_UOM = 'TAI'. LS_GENERALDATAX-BASE_UOM = 'X'. LS_ORIGIN-VENDOR_NO = '100078'. LS_ORIGINX-VENDOR_NO = 'X'. ***折旧范围 LS_DEPRECIATIONAREAS-AREA = '01'. LS_DEPRECIATIONAREAS-DEP_KEY = 'Z100'. APPEND LS_DEPRECIATIONAREAS TO LT_DEPRECIATIONAREAS. LS_DEPRECIATIONAREASX-AREA = '01'. LS_DEPRECIATIONAREASX-DEP_KEY = 'X'. APPEND LS_DEPRECIATIONAREASX TO LT_DEPRECIATIONAREASX. CLEAR:LS_DEPRECIATIONAREAS,LS_DEPRECIATIONAREASX. LS_DEPRECIATIONAREAS-AREA = '02'. LS_DEPRECIATIONAREAS-DEP_KEY = 'Z100'. APPEND LS_DEPRECIATIONAREAS TO LT_DEPRECIATIONAREAS. LS_DEPRECIATIONAREASX-AREA = '02'. LS_DEPRECIATIONAREASX-DEP_KEY = 'X'. APPEND LS_DEPRECIATIONAREASX TO LT_DEPRECIATIONAREASX. CLEAR:LS_DEPRECIATIONAREAS,LS_DEPRECIATIONAREASX. LS_DEPRECIATIONAREAS-AREA = '03'. LS_DEPRECIATIONAREAS-DEP_KEY = 'Z100'. APPEND LS_DEPRECIATIONAREAS TO LT_DEPRECIATIONAREAS. LS_DEPRECIATIONAREASX-AREA = '03'. LS_DEPRECIATIONAREASX-DEP_KEY = 'X'. APPEND LS_DEPRECIATIONAREASX TO LT_DEPRECIATIONAREASX. CLEAR:LS_DEPRECIATIONAREAS,LS_DEPRECIATIONAREASX. "增强字段传值 CLEAR LS_ANLU. LS_ANLU-COMP_CODE = '8000'. "公司 LS_ANLU-ZCONTRACT_NO = '4500003944'. LS_ANLU-ZASSET_STATUS = '在用'. "资产状态 LS_EXTENSIONIN-STRUCTURE = 'BAPI_TE_ANLU'. LS_EXTENSIONIN-VALUEPART1 = LS_ANLU. APPEND LS_EXTENSIONIN TO LT_EXTENSIONIN. CALL FUNCTION 'BAPI_FIXEDASSET_CREATE' EXPORTING COMPANYCODE = LS_COMPANY-COMP_CODE GENERALDATA = LS_GENERALDATA GENERALDATAX = LS_GENERALDATAX TIMEDEPENDENTDATA = LS_TIMEDEPENDENTDATA TIMEDEPENDENTDATAX = LS_TIMEDEPENDENTDATAX ORIGIN = LS_ORIGIN ORIGINX = LS_ORIGINX IMPORTING ASSETCREATED = LS_ASSETCREATED RETURN = LS_RETURN TABLES DEPRECIATIONAREAS = LT_DEPRECIATIONAREAS DEPRECIATIONAREASX = LT_DEPRECIATIONAREASX EXTENSIONIN = LT_EXTENSIONIN. IF LS_ASSETCREATED IS NOT INITIAL. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'. IF LS_RETURN IS NOT INITIAL. MESSAGE ID LS_RETURN-ID TYPE LS_RETURN-TYPE NUMBER LS_RETURN-NUMBER WITH LS_RETURN-MESSAGE_V1 LS_RETURN-MESSAGE_V2 LS_RETURN-MESSAGE_V3 LS_RETURN-MESSAGE_V4 INTO LS_MESSAGE. ENDIF. WRITE:/ LS_RETURN-MESSAGE_V1. ELSE. CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'. IF LS_RETURN IS NOT INITIAL. MESSAGE ID LS_RETURN-ID TYPE LS_RETURN-TYPE NUMBER LS_RETURN-NUMBER WITH LS_RETURN-MESSAGE_V1 LS_RETURN-MESSAGE_V2 LS_RETURN-MESSAGE_V3 LS_RETURN-MESSAGE_V4 INTO LS_MESSAGE. ENDIF. ENDIF.
扩展字段应用参见:http://www.baidusap.com/abap/6286