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: 

actualize EAN data using BAPI_MATERIAL_SAVEDATA

Former Member
0 Kudos

Hi,

I've tried to insert EAN barcode data using BAPI_MATERIAL_SAVEDATA to modify material master data, however without success. I get an error saying that i should specify the EAN for the base unit first.

Initially i was just passing the table INTERNATIONALARTNOS, but then i've started also passing UNITSOFMEASURE and UNITSOFMEASUREX:

CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'

EXPORTING

HEADDATA = header

TABLES

UNITSOFMEASURE = ti_marm

UNITSOFMEASUREX = ti_marmx

INTERNATIONALARTNOS = ti_mean

RETURNMESSAGES = mensagens

Can anyone help me with this one? Does anyone have some sample code for such a case?

Thanks

1 ACCEPTED SOLUTION

christian_wohlfahrt
Active Contributor
0 Kudos

Hi Bruno!

I hope you try to maintain an EAN for the base unit, not an alternative unit...

At least in Retail it's a little bit nasty: first EAN should be maintained via MARM structure, all additional EANs should come with MEAN structure.

Maybe you start with a test of just one EAN in MARM(X) on base unit level.

Regards,

Christian

6 REPLIES 6

christian_wohlfahrt
Active Contributor
0 Kudos

Hi Bruno!

I hope you try to maintain an EAN for the base unit, not an alternative unit...

At least in Retail it's a little bit nasty: first EAN should be maintained via MARM structure, all additional EANs should come with MEAN structure.

Maybe you start with a test of just one EAN in MARM(X) on base unit level.

Regards,

Christian

Former Member
0 Kudos

Hi Christian,

I've tried just passing MARM:

header-material = material.

header-BASIC_VIEW = 'X'.

ti_marm-ean_upc = codigos-codigo_barras.

ti_marm-alt_unit = 'KI'.

append ti_marm.

ti_marmx-ean_upc = 'X'.

ti_marmx-alt_unit = 'X'.

append ti_marmx.

CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'

EXPORTING

HEADDATA = header

TABLES

UNITSOFMEASURE = ti_marm

UNITSOFMEASUREX = ti_marmx

RETURNMESSAGES = mensagens

.

and as a result it does no modifications of the material master data. Can't understand what's missing.

regards,

Bruno

0 Kudos

are you using BAPI_TRANSACTION_COMMIT.

if not use that FM, after the BAPI_MATERIAL_SAVEDATA.

thanks

vijay

Former Member
0 Kudos

Hi Vijay,

The problem is not at that level, since it's BAPI_MATERIAL_SAVEDATA that generates the message that no modifications where made.

Regards,

Bruno

0 Kudos

Hi,

(now) I had a look in docu of this FM: you have to fill both structures, marm and mean in case of new eans for an article.

Sorry for confusing this, but try your original version <i>for the base unit.</i> Hopefully this will work.

Regards,

Christian

Former Member
0 Kudos

Hi All, I need this bapis to create new material in SAP, I'm got stuck with the following error:

The field MARA-EAN11 is defined as a required field; it does not contain an entry

I have include all structure that to fill EAN value, but still I have the same problem.

This is my program.

REPORT zcreatematerial.

DATA: headdata TYPE bapimathead.

DATA: clientdata TYPE bapi_mara.

DATA: clientdatax TYPE bapi_marax.

DATA: description TYPE TABLE OF bapi_makt WITH HEADER LINE.

DATA: ean_code TYPE TABLE OF bapi_mean WITH HEADER LINE.

DATA: ean_numb TYPE TABLE OF bapi_marm WITH HEADER LINE.

DATA: ean_numbx TYPE TABLE OF bapi_marmx WITH HEADER LINE.

DATA: return TYPE bapiret2 .

DATA: returnm TYPE TABLE OF bapi_matreturn2 WITH HEADER LINE.

DATA: xmara TYPE mara.

PARAMETERS: p_matnr TYPE mara-matnr.

SELECT SINGLE * FROM mara INTO xmara

WHERE matnr = p_matnr.

headdata-material = '000000009300000011'.

headdata-ind_sector = 'P'.

headdata-matl_type = 'ZBXT'.

headdata-basic_view = 'X'.

clientdata-old_mat_no = 'THE TEXT'.

clientdatax-old_mat_no = 'X'.

clientdata-base_uom = 'EA'.

clientdatax-base_uom = 'X'.

clientdata-base_uom_iso = 'EA'.

clientdatax-base_uom_iso = 'X'.

clientdata-unit_of_wt = 'EA'.

clientdatax-unit_of_wt = 'X'.

clientdata-prod_hier = '00002'.

clientdatax-prod_hier = 'X'.

clientdata-size_dim = 'GRANDE'.

clientdatax-size_dim = 'X'.

clientdata-mfr_no = 'BX0002'.

clientdatax-mfr_no = 'X'.

clientdata-manu_mat = 'FA1'.

clientdatax-manu_mat = 'X'.

clientdata-batch_mgmt = 'BATCH'.

clientdatax-batch_mgmt = 'X'.

clientdata-division = '00'.

clientdatax-division = 'X'.

description-langu = sy-langu.

*description-langu_iso = 'EN'.

description-matl_desc = 'Material Descrip'.

APPEND description.

CLEAR description.

ean_code-unit = 'EA'.

ean_code-unit_iso = 'EA'.

ean_code-ean_upc = '7594000670200'.

ean_code-ean_cat = 'HE'.

APPEND ean_code.

CLEAR ean_code.

ean_numb-alt_unit = 'EA'.

ean_numb-alt_unit_iso = 'EA'.

ean_numbx-alt_unit = 'X'.

ean_numbx-alt_unit_iso = 'X'.

ean_numb-ean_upc = '7594000670200'.

ean_numbx-ean_upc = 'X'.

ean_numb-ean_cat = 'HE'.

ean_numbx-ean_cat = 'X'.

APPEND ean_numb.

CLEAR ean_numb.

APPEND ean_numbx.

CLEAR ean_numbx.

CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'

EXPORTING

headdata = headdata

clientdata = clientdata

clientdatax = clientdatax

  • PLANTDATA =

  • PLANTDATAX =

  • FORECASTPARAMETERS =

  • FORECASTPARAMETERSX =

  • PLANNINGDATA =

  • PLANNINGDATAX =

  • STORAGELOCATIONDATA =

  • STORAGELOCATIONDATAX =

  • VALUATIONDATA =

  • VALUATIONDATAX =

  • WAREHOUSENUMBERDATA =

  • WAREHOUSENUMBERDATAX =

  • SALESDATA =

  • SALESDATAX =

  • STORAGETYPEDATA =

  • STORAGETYPEDATAX =

IMPORTING

return = return

TABLES

materialdescription = description

unitsofmeasure = ean_numb

unitsofmeasurex = ean_numbx

internationalartnos = ean_code

  • MATERIALLONGTEXT =

  • TAXCLASSIFICATIONS =

returnmessages = returnm

  • PRTDATA =

  • PRTDATAX =

  • EXTENSIONIN =

  • EXTENSIONINX = .

Thanks in advance.

Alexis Ramirez