Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

CREATING ASSET USING BAPI 'BAPI_FIXEDASSET_CREATE1'

Former Member
0 Kudos

HI GUYS,

I AM ABLE TO CREATE THE ASSET WHEN I RUN THE FUNCTION MODULE 'BAPI_FIXEDASSET_CREATE1' ITS SHOWING THAT THE ASSET HAS BEEN CREATED BUT WHEN I GO TO TRANSACTION AS03 THE SYSTEM THROWS AN ERROR STATING THAT THE ASSET NOT IN THE COMPANY CODE

WHAT IS THE SOLUTION TO THIS ERROR?

AND IF ANYONE HAS A SAMPLE CODE FOR CREATING ASSET USING 'BAPI_FIXEDASSET_CREATE1'

PLEASE MENTION THE LINKS .

THANKS.

3 REPLIES 3

Former Member

Hi,

You have to use 'BAPI_FIXEDASSET_CREATE1' to upload fixed assets.Try this code :

FORM zf_bapi_call USING ps_ls_asset TYPE t_asset

CHANGING ps_ls_asset_created TYPE bapi1022_reference

ps_ws_error TYPE string.

DATA:

ls_key TYPE bapi1022_key,

ls_general_data TYPE bapi1022_feglg001,

ls_general_data_x TYPE bapi1022_feglg001x,

ls_inventory TYPE bapi1022_feglg011,

ls_inventory_x TYPE bapi1022_feglg011x,

ls_posting_information TYPE bapi1022_feglg002,

ls_posting_information_x TYPE bapi1022_feglg002x,

ls_time_dependent_data TYPE bapi1022_feglg003,

ls_time_dependent_data_x TYPE bapi1022_feglg003x,

ls_allocations TYPE bapi1022_feglg004,

ls_allocations_x TYPE bapi1022_feglg004x,

ls_origin TYPE bapi1022_feglg009,

ls_origin_x TYPE bapi1022_feglg009x,

ls_invest_acct_assignmnt TYPE bapi1022_feglg010,

ls_invest_acct_assignmnt_x TYPE bapi1022_feglg010x,

ls_real_estate TYPE bapi1022_feglg007,

ls_real_estate_x TYPE bapi1022_feglg007x,

ls_return TYPE bapiret2.

Required fields - Create internal asset number *****

Company code

ls_key-companycode = ps_ls_asset-bukrs.

Asset class

ls_general_data-assetclass = ps_ls_asset-anlkl.

ls_general_data_x-assetclass = c_updated.

Required fields - General Mills *****

Asset Description

ls_general_data-descript = ps_ls_asset-txt50.

ls_general_data_x-descript = c_updated.

Cost center

ls_time_dependent_data-costcenter = ps_ls_asset-kostl.

ls_time_dependent_data_x-costcenter = c_updated.

Plant

ls_time_dependent_data-plant = ps_ls_asset-werks.

ls_time_dependent_data_x-plant = c_updated.

Asset location

ls_time_dependent_data-location = ps_ls_asset-stort.

ls_time_dependent_data_x-location = c_updated.

Smart entity

ls_allocations-evalgroup2 = ps_ls_asset-ord42.

ls_allocations_x-evalgroup2 = c_updated.

Tax Facility Code

ls_allocations-evalgroup5 = ps_ls_asset-gdlgrp.

ls_allocations_x-evalgroup5 = 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 number

ls_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 number

ls_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 Area

ls_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.

Room

ls_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.

Platform

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_CREATE1'

EXPORTING

key = ls_key

TESTRUN = 'X'

generaldata = ls_general_data

generaldatax = ls_general_data_x

inventory = ls_inventory

inventoryx = ls_inventory_x

postinginformation = ls_posting_information

postinginformationx = ls_posting_information_x

timedependentdata = ls_time_dependent_data

timedependentdatax = ls_time_dependent_data_x

allocations = ls_allocations

allocationsx = ls_allocations_x

origin = ls_origin

originx = ls_origin_x

investacctassignmnt = ls_invest_acct_assignmnt

investacctassignmntx = ls_invest_acct_assignmnt_x

realestate = ls_real_estate

realestatex = ls_real_estate_x

IMPORTING

assetcreated = ps_ls_asset_created

return = ls_return.

IF ls_return-type = 'S'.

COMMIT WORK.

ELSE.

CLEAR: ps_ls_asset_created.

ps_ws_error = ls_return-message.

ENDIF.

ENDFORM. " zf_bapi_call

Now, use the bapi BAPI_FIXEDASSET_OVRTAKE_CREATE

Regards,

Deepthi.

0 Kudos

why do we use BAPI_FIXEDASSET_OVRTAKE_CREATE bapi

0 Kudos

Hi Nishant,

You have used the right bapi just check once that you have used BAPI_TRANSACTION_COMMIT after BAPI_FIXEDASSET_CREATE1 if not you need to use this before checking with asset details.

Thanks

Sudharshan