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: 

Problems function BAPI_MATERIAL_SAVEDATA with Z-FIELDS

Former Member
0 Kudos

Hello,

I am a problem with the function BAPI_MATERIAL_SAVEDATA. I want to fill the Z-FIELDS but the function fill the field with space and i don't understand the problem.

My code is:

  • Header

bapi_head-material = et_datos-matnr.

bapi_head-mrp_view = 'X'.

bapi_marc-plant = et_datos-werks.

bapi_marcx-plant = et_datos-werks.

bapi_marc-abc_id = et_datos-maabc.

bapi_marcx-abc_id = 'X'.

bapi_marc-mrp_type = et_datos-dismm.

bapi_marcx-mrp_type = 'X'.

bapi_marc-mrp_ctrler = et_datos-dispo.

bapi_marcx-mrp_ctrler = 'X'.

bapi_marc-lotsizekey = et_datos-disls.

bapi_marcx-lotsizekey = 'X'.

bapi_marc-reorder_pt = et_datos-minbe.

bapi_marcx-reorder_pt = 'X'.

bapi_marc-fixed_lot = et_datos-bstfe.

bapi_marcx-fixed_lot = 'X'.

bapi_marc-minlotsize = et_datos-bstmi.

bapi_marcx-minlotsize = 'X'.

bapi_marc-maxlotsize = et_datos-bstma.

bapi_marcx-maxlotsize = 'X'.

bapi_marc-mrp_group = et_datos-disgr.

bapi_marcx-mrp_group = 'X'.

bapi_marc-round_val = et_datos-bstrf.

bapi_marcx-round_val = 'X'.

bapi_marc-proc_type = et_datos-beskz.

bapi_marcx-proc_type = 'X'.

bapi_marc-spproctype = et_datos-sobsl.

bapi_marcx-spproctype = 'X'.

bapi_marc-iss_st_loc = et_datos-lgpro.

bapi_marcx-iss_st_loc = 'X'.

bapi_marc-sloc_exprc = et_datos-lgfsb.

bapi_marcx-sloc_exprc = 'X'.

bapi_marc-backflush = et_datos-rgekz.

bapi_marcx-backflush = 'X'.

bapi_marc-inhseprodt = et_datos-dzeit.

bapi_marcx-inhseprodt = 'X'.

bapi_marc-plnd_delry = et_datos-plifz.

bapi_marcx-plnd_delry = 'X'.

bapi_marc-sm_key = et_datos-fhori.

bapi_marcx-sm_key = 'X'.

bapi_marc-serv_level = et_datos-lgrad.

bapi_marcx-serv_level = 'X'.

bapi_marc-period_ind = et_datos-perkz.

bapi_marcx-period_ind = 'X'.

bapi_marc-plan_strgp = et_datos-strgr.

bapi_marcx-plan_strgp = 'X'.

bapi_marc-consummode = et_datos-vrmod.

bapi_marcx-consummode = 'X'.

bapi_marc-fwd_cons = et_datos-vint2.

bapi_marcx-fwd_cons = 'X'.

bapi_marc-bwd_cons = et_datos-vint1.

bapi_marcx-bwd_cons = 'X'.

bapi_marc-mixed_mrp = et_datos-miskz.

bapi_marcx-mixed_mrp = 'X'.

bapi_marc-alt_bom_id = et_datos-altsl.

bapi_marcx-alt_bom_id = 'X'.

bapi_marc-repmanprof = et_datos-sfepr.

bapi_marcx-repmanprof = 'X'.

bapi_marc-rep_manuf = et_datos-sauft.

bapi_marcx-rep_manuf = 'X'.

bapi_te_marc-plant = et_datos-werks.

bapi_te_marc-zzenvsip = et_datos-zzenvsip.

bapi_te_marcx-plant = et_datos-werks.

bapi_te_marcx-zzenvsip = 'X'.

it_bapiparex-structure = 'BAPI_TE_MARC'.

it_bapiparex-valuepart1 = bapi_te_marc.

APPEND it_bapiparex.**

it_bapiparexx-structure = 'BAPI_TE_MARCX'.

it_bapiparexx-valuepart1 = bapi_te_marcx.

APPEND it_bapiparexx.

CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'

EXPORTING

headdata = bapi_head

plantdata = bapi_marc

plantdatax = bapi_marcx

IMPORTING

return = bapi_return

TABLES

extensionin = it_bapiparex

extensioninx = it_bapiparexx.

IF bapi_return-type EQ 'E' OR r_test = 'X' OR p_p_modo = 'TEST'.

CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.

ELSE.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'.

ENDIF.

I have completed the structure BAPI_TE_MARC and BAPI_TE_MARCX with Z-FIELDS of MARC.

The material is created but the Z-FIELD no have a value.

Any idea???.

8 REPLIES 8

Former Member
0 Kudos

Hia,

I think you need to check the data movement inside the BAPI as the fields are custom fields there are chances of getting

lost during movement from field mappings inside the BAPI and Other function modules used inside the BAPI.

If they are getting lost due to standard field mappings may be you would need Enhancement spots or BADI to set this data.

Cheers,

R

Former Member
0 Kudos

Hi ,

In the BAPI (BAPI_MATERIAL_SAVEDATA )is there a table parameter EXTENSIONIN ,which you can use to pass the values for user defined fields to the BAPI. For Sample data check the Long text..of the table parameter.

Regards,

Rani

Former Member
0 Kudos

Hi ,

In the BAPI (BAPI_MATERIAL_SAVEDATA )is there a table parameter EXTENSIONIN ,which you can use to pass the values for user defined fields to the BAPI. For Sample data check the Long text..of the table parameter.

Regards,

Rani

Former Member
0 Kudos

Hi ,

first try to check the BAPI_MATERIAL_GETDATA.

and check how the data is populatingin custom zfields and strucutre..

and next try to pass the extension same in function BAPI_MATERIAL_SAVEDATA.

PrabhuD@s

0 Kudos

Hello PrabhuD@s,

Thanks for your reply.

I have executed the function 'BAPI_MATERIAL_GETALL' (the function 'BAPI_MATERIAL_GETDATA' no exist in my system). I have seen that the structure EXTENSIONOUT only have : BAPI_TE_MARA but not BAPI_TE_MARC. Maybe that is the reason why i can not update the Z-fields of MARC ?????.

Thanks !!!!!!.

0 Kudos

I have seen that the structure EXTENSIONOUT only have : BAPI_TE_MARA but not BAPI_TE_MARC. Maybe that is the reason why i can not update the Z-fields of MARC ?????.

Definitely not!!

You have to maintain some customizing for the custom fields to be updated. If i remember correctly you need to assign the custom fields to the required field selection group via trxn OMSR.

Further read on:

Cheers,

Suhas

0 Kudos

Exactly!!!!!!!,

I make a debugging of the function 'BAPI_MATERIAL_GETALL' and i have seen that it use table T130F to search the Z-fields. And my Z-fields not were. This table is completed with transaction OMSR.

My problem is solved.

Thanks!!!!!!!!!!!!!!!!!!!!!!

0 Kudos

Hi Suhas,

I have maintained that customizing too. But the custom fields are not updated. The problem is when i give any standard field and custom field, it gets updated But update of custom field only is not happening. Any pointers on this one.

Thanks in advance.

Regards,

Shreya