Application Development and Automation 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: 
Read only

Customer Fields with BAPI_FIXEDASSET_CREATE1

Former Member
0 Likes
3,887

Hello, everyone.

I'm using BAPI_FIXEDASSET_CREATE1 do create asset master data.

We have extended asset master data with some customer fields by means of customer include CI_ANLU.

Now i need to fill information for our customer fields when creating assets with the above BAPI.

As i understood, i need to fill this info using table EXTENSIONIN on BAPI interface.

Problem is don't understand how to do it ...

I was trying like this ...

CLEAR: lt_extension[].

lt_extension-structure = 'BAPI_TE_ANLU'.

lt_extension-valuepart1 = 'ZZAREA_TOTAL'.

lt_extension-valuepart2 = wt_data-area_total.

APPEND lt_extension.

lt_extension-structure = 'BAPI_TE_ANLU'.

lt_extension-valuepart1 = 'ZZAREA_SUB'.

lt_extension-valuepart2 = wt_data-area_expropriar.

APPEND lt_extension.

lt_extension-structure = 'BAPI_TE_ANLU'.

lt_extension-valuepart1 = 'ZZVAL_AVAL_SUB'.

lt_extension-valuepart2 = wt_data-valor_avaliacao.

APPEND lt_extension.

CALL FUNCTION 'BAPI_FIXEDASSET_CREATE1'

EXPORTING

key = ls_key

testrun = p_test

generaldata = ls_gendata

generaldatax = ls_gendatax

timedependentdata = ls_timedata

timedependentdatax = ls_timedatax

allocations = ls_alloc

allocationsx = ls_allocx

origin = ls_origin

originx = ls_originx

investacctassignmnt = ls_accassign

investacctassignmntx = ls_accassignx

networthvaluation = ls_netweval

networthvaluationx = ls_netwevalx

IMPORTING

asset = lv_asset

subnumber = lv_subnr

return = ls_return

TABLES

extensionin = lt_extension.

Gives me an error saying i can't have more than one line on this table lt_extension (line should be BAPI_TE_ANLU).

Then i left only one line on the table with the reference to the extended table struture BAPI_TE_ANLU, but no information is being passed on to my customer fields ... since o don't know how.

May someone help me on this?

Thanks,

Mário Semedo

1 ACCEPTED SOLUTION
Read only

former_member156446
Active Contributor
7 REPLIES 7
Read only

former_member156446
Active Contributor
Read only

0 Likes
2,585

Thanks for your input.

my customer fields are as follow (structure BAPI_TE_ANLU):

.INCLUDE BAPI1022_1 0 0

COMP_CODE BUKRS CHAR 4 0

ASSETMAINO BF_ANLN1 CHAR 12 0

ASSETSUBNO BF_ANLN2 CHAR 4 0

.INCLUDE CI_ANLU 0 0

ZZfield01 ZDATAELEM01 UNIT 3 0

ZZfield02 ZDATAELEM02 QUAN 13 3

ZZfield03 ZDATAELEM03 UNIT 3 0

ZZfield04 ZDATAELEM04 QUAN 13 3

ZZfield05 ZDATAELEM05 CURR 13 2

ZZfield06 ZDATAELEM06 DATS 8 0

So I'm trying to do on creation:

DATA: lv_area_total like bapi_te_anlu-zzarea_total.

move: 100 to lv_area_total.

lt_extension-structure = 'BAPI_TE_ANLU'.

lt_extension-valuepart1+00(04) = p_bukrs.

lt_extension-valuepart1+20(03) = 'HAR'.

lt_extension-valuepart1+23(07) = lv_area_total.

lt_extension-valuepart1+30(03) = 'UN'.

lt_extension-valuepart1+62(08) = sy-datum.

Quantity fields are interpreted as P fields upon filling the ANLU structure based on lt_extension.

All non type P fields are filled correctly.

Value 100 is being saved as 3.130.302.230,303 ... Any reason for this?

Please, give me some help here.

Thanks

Mário

Read only

0 Likes
2,585

HI,

even if you only want to add only one Z field, all the fields that you transfer in ExtensionIn must be filled.

Regards,

Ihsen ABROUG

Read only

Former Member
0 Likes
2,585

Hi

Here is a sample code I had written for material savedata. all BAPI use same logic for extention to std Tables. see if this helps.

BAPI_MATERIAL_SAVEDATA.

&----


*& Report Z_VMA_MARA_EXT

*& written by : Vivek Amrute.Tested on ECC6 :

*& Updating values of custom fields added to MARA.

REPORT z_vma_mara_ext.

TABLES : mara, marc.

DATA : rex LIKE bapiparex OCCURS 0 WITH HEADER LINE,

rexx LIKE bapiparexx OCCURS 0 WITH HEADER LINE,

header LIKE bapimathead OCCURS 0 WITH HEADER LINE,

makt1 LIKE bapi_makt OCCURS 0 WITH HEADER LINE,

zbapiret2 LIKE bapiret2 OCCURS 0 WITH HEADER LINE.

PARAMETERS : material LIKE mara-matnr,

val1 TYPE aktvt,

val2 TYPE actname_kk,

val3 TYPE aktvt,

new_desc TYPE maktx.

header-material = material.

rex-structure = 'BAPI_TE_MARA'.

CONCATENATE material val1 val2 val3 INTO rex-valuepart1 RESPECTING BLANKS.

APPEND rex.

rexx-structure = 'BAPI_TE_MARAX'.

CONCATENATE material 'XXX' INTO rexx-valuepart1 RESPECTING BLANKS.

APPEND rexx.

makt1-langu = 'E'.

makt1-langu_iso = 'EN'.

makt1-matl_desc = new_desc.

APPEND makt1.

CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'

EXPORTING

headdata = header

IMPORTING

return = zbapiret2

TABLES

materialdescription = makt1

extensionin = rex

extensioninx = rexx.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

******End of Program *********************

Read only

Former Member
0 Likes
2,585

Hi I am also facing the same type of problem. I have added three C type fields each length is 240 charecter.Can any one please advise me how I will update those three fields (CI_ANLU) while creating the asset using bapi.

Read only

0 Likes
2,585

Hi,

I am using the below codes:

DATA: lv_ZZINVNR1 like bapi_te_anlu-ZZINVNR1,

lv_ZZINVNR2 like bapi_te_anlu-ZZINVNR1,

lv_ZZINVNR3 like bapi_te_anlu-ZZINVNR1.

lv_ZZINVNR1 = 'aaaa'.

lv_ZZINVNR2 = 'bbb'.

lv_ZZINVNR3 = 'ccc'.

lt_extension-STRUCTURE = 'BAPI_TE_ANLU'.

lt_extension-valuepart1 = lv_ZZINVNR1.

lt_extension-valuepart2 = lv_ZZINVNR2 .

lt_extension-valuepart3 = lv_ZZINVNR3.

APPEND lt_extension.

Then running the BAPI.

It's creating the the asset but my customize fields are not updated.

Please advise.

Thanks,

Read only

0 Likes
2,585

Hi,

check the function module EXIT_SAPL1022_001 and itu2019s documentation.

To allow the BAPIs to change the customers fields the command

E_ANLU = I_ANLU

is necessary.

Maybe this could be a reason.

Greetings Eva