Asset Upload BAPI

This code will be helpful in uploading assets and deprecation data of asset which is created using AS01 and AS91

DATA :
“Local Variable
lv_cc           TYPE bapi1022_1comp_code,
lv_asset        TYPE bapi1022_1assetmaino,
lv_subnumber    TYPE bapi1022_1assetsubno,
lv_assetcreated TYPE bapi1022_reference,
“Local Tables
ls_key          TYPE bapi1022_key,         “Assest Details
ls_return       TYPE bapiret2,
ls_gd           TYPE bapi1022_feglg001,    “General Data
ls_gdx          TYPE bapi1022_feglg001x,   “General Data Fields Updating
ls_time         TYPE bapi1022_feglg003,    “Time Dependent
ls_timex        TYPE bapi1022_feglg003x,   “Time Dependent Fields Updating
ls_allo         TYPE bapi1022_feglg004,    “Allocation Data
ls_allox        TYPE bapi1022_feglg004x,   “Allocation Data fields Updating
ls_dep          TYPE bapi1022_dep_areas,   “Depreciation Areas
ls_depx         TYPE bapi1022_dep_areasx,  “Depreciation Areas Fields Update
“Local Internal Table
lt_dep          TYPE STANDARD TABLE OF bapi1022_dep_areas,   “Depreciation Areas
lt_depx         TYPE STANDARD TABLE OF bapi1022_dep_areasx.

ls_keycompanycode   . “Company Code
“General Data
ls_gdassetclass    .
ls_gddescript      ‘Test 1’.
ls_gdquantity      1.
ls_gdbase_uom      ‘EA’.
ls_gdmain_descript ‘Test 1’.

ls_gdxassetclass =
ls_gdxdescript   =
ls_gdxquantity   =
ls_gdxbase_uom   =
ls_gdxmain_descript abap_true.

“Time Dependent Enter as per you company records 
ls_timebus_area   .
ls_timecostcenter .
ls_timeplant      .
ls_timelocation   .

*ls_timex-FROM_DATE  =
*ls_timex-TO_DATE    =
ls_timexbus_area   =
ls_timexcostcenter =
ls_timexplant      =
ls_timexlocation   =
abap_true.

“Allocation
ls_alloevalgroup5 .
ls_alloxevalgroup5 abap_true.


ls_deparea      ’01’.
ls_depdep_key   ‘I000’.
ls_depulife_yrs ‘020’.
ls_depulife_prds ’09’.
APPEND ls_dep TO lt_dep.

ls_depxarea      ’01’.
ls_depxdep_key   =
ls_depxulife_yrs =
ls_depxulife_prds abap_true.
APPEND ls_depx TO lt_depx.

ls_deparea      ’31’.
ls_depdep_key   ‘A000’.
ls_depulife_yrs ‘020’.
ls_depulife_prds ’09’.
APPEND ls_dep TO lt_dep.

ls_depxarea      ’31’.
ls_depxdep_key   =
ls_depxulife_yrs =
ls_depxulife_prds abap_true.
APPEND ls_depx TO lt_depx.

CALL FUNCTION ‘BAPI_FIXEDASSET_CREATE1’
EXPORTING
key                ls_key
*   REFERENCE          =
*   CREATESUBNUMBER    =
*   POSTCAP            =
*   CREATEGROUPASSET   =
*   TESTRUN            =
generaldata        ls_gd
generaldatax       ls_gdx
*   INVENTORY          =
*   INVENTORYX         =
*   POSTINGINFORMATION =
*   POSTINGINFORMATIONX        =
timedependentdata  ls_time
timedependentdatax ls_timex
allocations        ls_allo
allocationsx       ls_allox
*   ORIGIN             =
*   ORIGINX            =
*   INVESTACCTASSIGNMNT        =
*   INVESTACCTASSIGNMNTX       =
*   NETWORTHVALUATION  =
*   NETWORTHVALUATIONX =
*   REALESTATE         =
*   REALESTATEX        =
*   INSURANCE          =
*   INSURANCEX         =
*   LEASING            =
*   LEASINGX           =
IMPORTING
companycode        lv_cc
asset              lv_asset
subnumber          lv_subnumber
assetcreated       lv_assetcreated
return             ls_return
TABLES
depreciationareas  lt_dep
depreciationareasx lt_depx
*   INVESTMENT_SUPPORT =
*   EXTENSIONIN        =
.

CALL FUNCTION ‘BAPI_TRANSACTION_COMMIT’
* EXPORTING
*   WAIT          =
* IMPORTING
*   RETURN        =
.

Leave a Reply

Your email address will not be published. Required fields are marked *