‎2007 Nov 15 2:27 PM
Hello.
I've got some difficulties in using this BAPI.
Firstly, when I pass data in the STORAGETYPEDATA and STORAGETYPEDATAX the system falls in dump with the reason "Incorrect legth of the structure STORAGETYPEDATA".
Secondly, when I try to pass data in UNITSOFMEASURE (Alternative units of measurement) the FM returns error code 332 "Alternative Units are exactly the same as the Base Units". But they are not. The Base UM = 'ST' and Alt_UM = 'KG'. But this error appears only when I try to create a MMR, when I'm changing the MMR, which does exist in the system, everything is OK - alternative units become created. But running FM for two times is an idea, but I don't want to accept it.
I need some piece of advice. Has anyone faced such a problem and maybe found a solution?
‎2007 Nov 15 2:52 PM
hi
good
check this code
Define BAPI data.
data: mathead type bapimathead,
mara_data type bapi_mara,
mara_datax type bapi_marax,
wa_bapi_te_mara type bapi_te_mara,
wa_bapi_te_marax type bapi_te_marax,
wa_valuepart(960),
wa_valuepartx(960),
t_extin type table of bapiparex,
t_extinx type table of bapiparexx,
d_extin type bapiparex,
d_extinx type bapiparexx,
ret type bapiret2.
Fill header structure.
mathead-material = l_matnr.
mathead-basic_view = 'X'.
Fill Bespoke Input view fields for change.
wa_bapi_te_mara-material = l_matnr.
wa_bapi_te_marax-material = l_matnr.
wa_bapi_te_mara-zz_eflpkta = l_fptype.
wa_bapi_te_marax-zz_eflpkta = 'X'.
wa_bapi_te_mara-zz_eflpkt = l_fpoint.
wa_bapi_te_marax-zz_eflpkt = 'X'.
Fill remainder of structure/s.
wa_valuepart = wa_bapi_te_mara.
d_extin-structure = 'BAPI_TE_MARA'.
d_extin-valuepart1 = wa_valuepart(240).
d_extin-valuepart2 = wa_valuepart+240(240).
d_extin-valuepart3 = wa_valuepart+480(240).
d_extin-valuepart4 = wa_valuepart+720(240).
wa_valuepartx = wa_bapi_te_marax.
d_extinx-structure = 'BAPI_TE_MARAX'.
d_extinx-valuepart1 = wa_valuepartx(240).
d_extinx-valuepart2 = wa_valuepartx+240(240).
d_extinx-valuepart3 = wa_valuepartx+480(240).
d_extinx-valuepart4 = wa_valuepartx+720(240).
append d_extin to t_extin.
append d_extinx to t_extinx.
Update record via BAPI.
call function 'BAPI_MATERIAL_SAVEDATA'
exporting
headdata = mathead
clientdata = mara_data
clientdatax = mara_datax
importing
return = ret
tables
extensionin = t_extin
extensioninx = t_extinx.
thanks
mrutyun^
‎2007 Nov 15 3:32 PM