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

Error in BAPI_MATERIAL_SAVEDATA

Former Member
0 Likes
716

Hi everyone,

I've been attempting to create material master data using BAPI_MATERIAL_SAVEDATA.

What I'm trying to do is populate the fields Gross Weight, Gross weight unit, EAN/UPC, EAN Category, Volume, and Volume unit in the basic data.

I've searched through the forums and for the most part the recommended solution is to populate the table UNITSOFMEASURE/UNITSOFMEASUREX (BAPI_MARM/BAPI_MARMX), with the field ALT_UNIT = BASE_UOM from the CLIENDDATA structure.

During debugging I am encountering the following error:

"The alternative unit of measure is the same as the base unit of measure"

I'm not sure what I'm doing wrong on this part. Please please can anyone help me? Below is the code used:

To populate client data:


  DATA: v_iprkz    TYPE MARA-IPRKZ.

  wa_clientdata-matl_group    = wa_upltab-matkl.
  wa_clientdata-base_uom      = wa_upltab-meins.
  wa_clientdata-net_weight    = wa_upltab-ntgew.
  wa_clientdata-unit_of_wt    = wa_upltab-gewei.
  wa_clientdata-division      = wa_upltab-spart.
  wa_clientdata-trans_grp     = wa_upltab-tragr.
  wa_clientdata-po_unit       = wa_upltab-bstme.
  wa_clientdata-stor_conds    = wa_upltab-raube.
  wa_clientdata-minremlife    = wa_upltab-mhdrz.
  wa_clientdata-shelf_life    = wa_upltab-mhdhb.
  CASE wa_upltab-iprkz.
  WHEN 'D'.
    v_iprkz = SPACE.
  WHEN 'W'.
    v_iprkz = '1'.
  WHEN 'M'.
    v_iprkz = '2'.
  WHEN 'Y'.
    v_iprkz = '3'.
  ENDCASE.
  wa_clientdata-period_ind_expiration_date = v_iprkz.
  wa_clientdata-size_dim      = wa_upltab-groes.

  wa_clientdatax-matl_group   = 'X'.
  wa_clientdatax-base_uom     = 'X'.
  wa_clientdatax-net_weight   = 'X'.
  wa_clientdatax-unit_of_wt   = 'X'.
  wa_clientdatax-division     = 'X'.
  wa_clientdatax-trans_grp    = 'X'.
  wa_clientdatax-po_unit      = 'X'.
  wa_clientdatax-stor_conds   = 'X'.
  wa_clientdatax-minremlife   = 'X'.
  wa_clientdatax-shelf_life   = 'X'.
  wa_clientdatax-period_ind_expiration_date = 'X'.
  wa_clientdatax-size_dim     = 'X'.

To populate the Units of Measure table:



FORM PREPARE_UOM .
*---- base uom
  CLEAR i_uom.
  i_uom-alt_unit        = wa_upltab-meins.
  i_uom-alt_unit_iso    = wa_upltab-meins.
  i_uom-ean_upc         = wa_upltab-ean11.
  i_uom-ean_cat         = wa_upltab-numtp.
  i_uom-numerator       = 1.
  i_uom-denominatr      = 1.
  i_uom-volume          = wa_upltab-volum.
  i_uom-volumeunit      = wa_upltab-voleh.
  i_uom-gross_wt        = wa_upltab-brgew.
  i_uom-unit_of_wt      = wa_upltab-brwei.
  APPEND i_uom.
  CLEAR i_uomx.
  i_uomx-alt_unit        = wa_upltab-meins.
  i_uomx-alt_unit_iso    = wa_upltab-meins.
  i_uomx-ean_upc         = 'X'.
  i_uomx-ean_cat         = 'X'.
  i_uomx-numerator       = 'X'.
  i_uomx-denominatr      = 'X'.
  i_uomx-volume          = 'X'.
  i_uomx-volumeunit      = 'X'.
  i_uomx-gross_wt        = 'X'.
  i_uomx-unit_of_wt      = 'X'.
  APPEND i_uomx.

1 REPLY 1
Read only

Former Member
0 Likes
385

It turns the cause of my issue is that the sales unit in the structure SALESDATA is the same as the Base UOM.

The sales unit field can be filled up only if it is different from the base uom.