【样例代码】*X.TYPES : BEGIN OF T_ASSET,BUKRS TYPE ANLA-BUKRS,ANLKL TYPE ANLA-ANLKL,"资产分类TXT50 TYPE ANLA-TXT50,"资产描述TXA50 TYPE ANLA-TXA50,"附加资产说明KOSTL TYPE ANLZ-KOSTL,"成本中心WERKS TYPE ANLZ-WERKS,"工厂
【样例代码】*X.TYPES : BEGIN OF T_ASSET,BUKRS TYPE ANLA-BUKRS,ANLKL TYPE ANLA-ANLKL,"资产分类TXT50 TYPE ANLA-TXT50,"资产描述TXA50 TYPE ANLA-TXA50,"附加资产说明KOSTL TYPE ANLZ-KOSTL,"成本中心WERKS TYPE ANLZ-WERKS,"工厂STORT TYPE ANLZ-STORT,"资产地点ORD41 TYPE ANLA-ORD41,"评估组1AKTIV TYPE ANLA-AKTIV,"资本化日期SERNR TYPE ANLA-SERNR,"序列号INVNR TYPE ANLA-INVNR,"存货号GSBER TYPE ANLZ-GSBER,"业务范围RAUMN TYPE ANLZ-RAUMN,"房间MENGE TYPE ANLA-MENGE,"数量MEINS TYPE ANLA-MEINS,"单位END OF T_ASSET.START-OF-SELECTION.DATA : LW_ASSET TYPE T_ASSET.DATA : LS_ASSET_CREATED TYPE BAPI1022_REFERENCE.DATA : WS_ERROR TYPE STRING.CLEAR LW_ASSET.LW_ASSET-BUKRS CN40.LW_ASSET-ANLKL 00002205.LW_ASSET-TXT50 梅赛德斯奔驰S600 12缸.LW_ASSET-TXA50 梅赛德斯奔驰S600 12缸 2020 Version.LW_ASSET-KOSTL 0000111102.LW_ASSET-WERKS CN41.LW_ASSET-STORT 0001.LW_ASSET-ORD41 CN40.LW_ASSET-AKTIV SY-DATUM.LW_ASSET-SERNR S600.LW_ASSET-INVNR S600 12G.LW_ASSET-GSBER CN41.LW_ASSET-RAUMN ROOM.LW_ASSET-MENGE 1.LW_ASSET-MEINS EA.IF LW_ASSET IS NOT INITIAL.PERFORM ZF_BAPI_CALL USING LW_ASSET CHANGING LS_ASSET_CREATED WS_ERROR.ENDIF.* PS_LS_ASSET-BUKRS.* Asset classLS_GENERAL_DATA-ASSETCLASS PS_LS_ASSET-ANLKL.LS_GENERAL_DATA_X-ASSETCLASS C_UPDATED.***** Required fields - General Mills ****** ASSET DESCRIPTIONLS_GENERAL_DATA-DESCRIPT PS_LS_ASSET-TXT50.LS_GENERAL_DATA_X-DESCRIPT C_UPDATED.LS_GENERAL_DATA-QUANTITY PS_LS_ASSET-MENGE.LS_GENERAL_DATA_X-QUANTITY C_UPDATED.LS_GENERAL_DATA-BASE_UOM PS_LS_ASSET-MEINS.LS_GENERAL_DATA_X-BASE_UOM C_UPDATED.* Cost centerLS_TIME_DEPENDENT_DATA-COSTCENTER PS_LS_ASSET-KOSTL.LS_TIME_DEPENDENT_DATA_X-COSTCENTER C_UPDATED.* PlantLS_TIME_DEPENDENT_DATA-PLANT PS_LS_ASSET-WERKS.LS_TIME_DEPENDENT_DATA_X-PLANT C_UPDATED.* Asset locationLS_TIME_DEPENDENT_DATA-LOCATION PS_LS_ASSET-STORT.LS_TIME_DEPENDENT_DATA_X-LOCATION C_UPDATED.* Asset capitalization date* LS_POSTING_INFORMATION-CAP_DATE PS_LS_ASSET-AKTIV.* LS_POSTING_INFORMATION_X-CAP_DATE C_UPDATED.***** Optional fields ****** ASSET DESCRIPTION 2 附加资产描述LS_GENERAL_DATA-DESCRIPT2 PS_LS_ASSET-TXA50.LS_GENERAL_DATA_X-DESCRIPT2 C_UPDATED.* Serial numberLS_GENERAL_DATA-SERIAL_NO PS_LS_ASSET-SERNR.LS_GENERAL_DATA_X-SERIAL_NO C_UPDATED.* Asset is managed historically 历史性管理LS_GENERAL_DATA-HISTORY C_UPDATED.LS_GENERAL_DATA_X-HISTORY C_UPDATED.* Inventory numberLS_GENERAL_DATA-INVENT_NO PS_LS_ASSET-INVNR.LS_GENERAL_DATA_X-INVENT_NO C_UPDATED.* Last inventory date* LS_INVENTORY-DATE PS_LS_ASSET-IVDAT.* LS_INVENTORY_X-DATE C_UPDATED.* Supplementary inventory specifications* LS_INVENTORY-NOTE PS_LS_ASSET-INVZU.* LS_INVENTORY_X-NOTE C_UPDATED.* Inventory indicator* LS_INVENTORY-INCLUDE_IN_LIST C_UPDATED.* LS_INVENTORY_X-INCLUDE_IN_LIST C_UPDATED.* Business AreaLS_TIME_DEPENDENT_DATA-BUS_AREA PS_LS_ASSET-GSBER.LS_TIME_DEPENDENT_DATA_X-BUS_AREA C_UPDATED.* Cost center responsible for asset* LS_TIME_DEPENDENT_DATA-RESP_CCTR PS_LS_ASSET-KOSTLV.* LS_TIME_DEPENDENT_DATA_X-RESP_CCTR C_UPDATED.* RoomLS_TIME_DEPENDENT_DATA-ROOM PS_LS_ASSET-RAUMN.LS_TIME_DEPENDENT_DATA_X-ROOM C_UPDATED.* License plate no. of vehichle* LS_TIME_DEPENDENT_DATA-PLATE_NO PS_LS_ASSET-KFZKZ.* LS_TIME_DEPENDENT_DATA_X-LICENSE_PLATE_NO C_UPDATED.* PlatformLS_ALLOCATIONS-EVALGROUP1 PS_LS_ASSET-ORD41.LS_ALLOCATIONS_X-EVALGROUP1 C_UPDATED.* LS_ALLOCATIONS-EVALGROUP1 PS_LS_ASSET-ORD41.* LS_ALLOCATIONS_X-EVALGROUP1 C_UPDATED.* GMI Class Code* LS_ALLOCATIONS-EVALGROUP3 PS_LS_ASSET-ORD43.* LS_ALLOCATIONS_X-EVALGROUP3 C_UPDATED.* Location Type* LS_ALLOCATIONS-EVALGROUP4 PS_LS_ASSET-ORD44.* LS_ALLOCATIONS_X-EVALGROUP4 C_UPDATED.* Reason for investment* LS_ALLOCATIONS-INV_REASON PS_LS_ASSET-IZWEK.* LS_ALLOCATIONS_X-INV_REASON C_UPDATED.* Manufacturer of asset* LS_ORIGIN-MANUFACTURER PS_LS_ASSET-HERST.* LS_ORIGIN_X-MANUFACTURER C_UPDATED.* Name of asset supplier* LS_ORIGIN-VENDOR PS_LS_ASSET-LIEFE.* LS_ORIGIN_X-VENDOR C_UPDATED.* Asset type name* LS_ORIGIN-TYPE_NAME PS_LS_ASSET-TYPBZ.* LS_ORIGIN_X-TYPE_NAME C_UPDATED.* WBS element investment project - external key* LS_INVEST_ACCT_ASSIGNMNT-WBS_ELEMENT PS_LS_ASSET-POSID.* LS_INVEST_ACCT_ASSIGNMNT_X-WBS_ELEMENT C_UPDATED.* Local tax office* LS_REAL_ESTATE-TAX_OFFICE PS_LS_ASSET-FIAMT.* LS_REAL_ESTATE_X-TAX_OFFICE C_UPDATED.CALL FUNCTION BAPI_FIXEDASSET_CREATE1EXPORTINGKEY LS_KEY* TESTRUN XGENERALDATA LS_GENERAL_DATAGENERALDATAX LS_GENERAL_DATA_XINVENTORY LS_INVENTORYINVENTORYX LS_INVENTORY_XPOSTINGINFORMATION LS_POSTING_INFORMATIONPOSTINGINFORMATIONX LS_POSTING_INFORMATION_XTIMEDEPENDENTDATA LS_TIME_DEPENDENT_DATATIMEDEPENDENTDATAX LS_TIME_DEPENDENT_DATA_XALLOCATIONS LS_ALLOCATIONSALLOCATIONSX LS_ALLOCATIONS_XORIGIN LS_ORIGINORIGINX LS_ORIGIN_XINVESTACCTASSIGNMNT LS_INVEST_ACCT_ASSIGNMNTINVESTACCTASSIGNMNTX LS_INVEST_ACCT_ASSIGNMNT_XREALESTATE LS_REAL_ESTATEREALESTATEX LS_REAL_ESTATE_XIMPORTINGASSETCREATED PS_LS_ASSET_CREATEDRETURN LS_RETURN.IF LS_RETURN-TYPE S.COMMIT WORK.WRITE : 资产创建成功,PS_LS_ASSET_CREATED-COMPANYCODE,PS_LS_ASSET_CREATED-ASSET,PS_LS_ASSET_CREATED-SUBNUMBER.ELSE.CLEAR: PS_LS_ASSET_CREATED.PS_WS_ERROR LS_RETURN-MESSAGE.WRITE : PS_WS_ERROR.ENDIF.ENDFORM. " zf_bapi_call
【效果展示】