Skip to Content
avatar image
Former Member

BAPI_MATERIAL_SAVEDATA: Unit of weight

Hi everyone.

I´m trying to create materials through this BAPI: BAPI_MATERIAL_SAVEDATA.

The point is that, after execute it, it throws me the following error: "Enter the unit of weight for the net weight". The problem is I´m passing the weight and the unit of weight within the table UNITSOFMEASURE and structure CLIENTDATA (along with their correponding UNITSOFMEASUREX and CLIENTDATAX well updated) and the system remains with the same error. Anyone could tell me why?

Thanks in advance, people!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Apr 25, 2011 at 06:59 AM

    Hello,

    If you check the structure BAPI_MARA the field NET_WEIGHT has a quantity reference field 'UNIT_OF_WT'(or GEWEI). Did you pass the UoM value to this particular field?

    BR,

    Suhas

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Judith Jessie Selvi

      Hi Judith,

      The point is that this error doesn´t appear in every execution. In fact, it depends on the sort of material (field MTART). This error was triggered when the material was of the type "Raw Material".

      Anyway, I´ve solved not filling the field PO_UNIT. 😀

      So you were right, at least, leading me to that point of the code.

      By now, BAPI works fine with several kinds of material. I have to keep checking data to assure the process integrity.

      Thank you very much, people, for your help.

      Best regards.

  • avatar image
    Former Member
    Apr 25, 2011 at 07:04 AM

    Hi,

    Hope the following code may help you in analysing the error.

    **********************************************************************

    • DATA POPULATIONS *

    **********************************************************************

    LOOP AT IT_MATMASTER.

    *HEADER DATA

    BAPIMATHEAD-MATERIAL = IT_MATMASTER-MATNR.

    BAPIMATHEAD-IND_SECTOR = IT_MATMASTER-Mbrsh.

    BAPIMATHEAD-MATL_TYPE = IT_MATMASTER-Mtart.

    BAPIMATHEAD-BASIC_VIEW = u2018Xu2019.

    BAPIMATHEAD-PURCHASE_VIEW = u2018Xu2019.

    BAPIMATHEAD-ACCOUNT_VIEW = u2018Xu2019.

    *CLIENTDATA

    BAPI_MARA-MATL_GROUP = IT_MATMASTER-MATKL.

    BAPI_MARA-DIVISION = IT_MATMASTER-SPART.

    BAPI_MARA-DSN_OFFICE = IT_MATMASTER-LABOR.

    BAPI_MARA-PROD_HIER = IT_MATMASTER-PRDHA.

    BAPI_MARA-PUR_STATUS = IT_MATMASTER-MSTAE.

    BAPI_MARA-ITEM_CAT = IT_MATMASTER-MTPOS_MARA.

    BAPI_MARA-NET_WEIGHT = IT_MATMASTER-NTGEW.

    • BAPI_MARA-PO_UNIT = u2018KGu2019.

    • BAPI_MARA-UNIT_OF_WT_ISO = u2018KGu2019.

    BAPI_MARA-UNIT_OF_WT = u2018KGu2019.

    • BAPI_MARA-PACK_VO_UN = u2018KGu2019.

    • BAPI_MARA-BASE_UOM_ISO = u2018KGu2019.

    bapi_mara-size_dim = it_matmaster-groes.

    BAPI_MARA-MAT_GRP_SM = IT_MATMASTER-MAGRV.

    BAPI_MARA-OLD_MAT_NO = IT_MATMASTER-BISMT.

    BAPI_MARA-BASE_UOM = IT_MATMASTER-MEINS.

    BAPI_MARA-BASIC_MATL = IT_MATMASTER-WRKST.

    BAPI_MARA-HAZMATPROF = IT_MATMASTER-PROFL.

    BAPI_MARA-ENVT_RLVT = IT_MATMASTER-KZUMW.

    BAPI_MARA-PO_UNIT = IT_MATMASTER-BSTME.

    BAPI_MARA-VAR_ORD_UN = IT_MATMASTER-VABME.

    BAPI_MARA-PUR_VALKEY = IT_MATMASTER-EKWSL.

    BAPI_MARA-MANU_MAT = IT_MATMASTER-MFRPN.

    BAPI_MARA-MFR_NO = IT_MATMASTER-MFRNR.

    BAPI_MARAX-MATL_GROUP = u2018Xu2019.

    BAPI_MARAX-DIVISION = u2018Xu2019.

    BAPI_MARAX-DSN_OFFICE = u2018Xu2019.

    BAPI_MARAX-PROD_HIER = u2018Xu2019.

    BAPI_MARAX-PUR_STATUS = u2018Xu2019.

    BAPI_MARAX-ITEM_CAT = u2018Xu2019.

    BAPI_MARAX-NET_WEIGHT = u2018Xu2019.

    BAPI_MARAX-UNIT_OF_WT = u2018Xu2019.

    • BAPI_MARAX-UNIT_OF_WT_ISO = u2018Xu2019.

    bapi_maraX-size_dim = u2018Xu2019.

    BAPI_MARAX-MAT_GRP_SM = u2018Xu2019.

    BAPI_MARAX-OLD_MAT_NO = u2018Xu2019.

    BAPI_MARAX-BASE_UOM = u2018Xu2019.

    BAPI_MARAX-BASE_UOM_ISO = u2018Xu2019.

    BAPI_MARAX-BASIC_MATL = u2018Xu2019.

    BAPI_MARAX-MFR_NO = u2018Xu2019.

    BAPI_MARAX-HAZMATPROF = u2018Xu2019.

    BAPI_MARAX-ENVT_RLVT = u2018Xu2019.

    BAPI_MARAX-PO_UNIT = u2018Xu2019.

    • BAPI_MARAX-PACK_VO_UN = u2018Xu2019.

    BAPI_MARAX-VAR_ORD_UN = u2018Xu2019.

    BAPI_MARAX-PUR_VALKEY = u2018Xu2019.

    BAPI_MARAX-MANU_MAT = u2018Xu2019.

    BAPI_MARAX-MFR_NO = u2018Xu2019.

    *PLANT DATA

    BAPI_MARC-PLANT = IT_MATMASTER-WERKS.

    BAPI_MARC-PUR_GROUP = IT_MATMASTER-EKGRP.

    BAPI_MARC-BATCH_MGMT = IT_MATMASTER-XCHPF.

    BAPI_MARC-GR_PR_TIME = IT_MATMASTER-WEBAZ.

    BAPI_MARCX-PLANT = IT_MATMASTER-WERKS.

    BAPI_MARCX-PUR_GROUP = u2018Xu2019.

    BAPI_MARCX-BATCH_MGMT = u2018Xu2019.

    BAPI_MARCX-GR_PR_TIME = u2018Xu2019.

    *VALUATION DATA

    BAPI_MBEW-PRICE_CTRL = IT_MATMASTER-VPRSV.

    BAPI_MBEW-STD_PRICE = IT_MATMASTER-STPRS.

    BAPI_MBEW-COMMPRICE1 = IT_MATMASTER-BWPRH.

    BAPI_MBEW-VAL_AREA = IT_MATMASTER-BWKEY.

    BAPI_MBEW-VAL_CLASS = IT_MATMASTER-BKLAS.

    BAPI_MBEWX-PRICE_CTRL = u2018Xu2019.

    BAPI_MBEWX-STD_PRICE = u2018Xu2019.

    BAPI_MBEWX-COMMPRICE1 = u2018Xu2019.

    BAPI_MBEWX-VAL_AREA = IT_MATMASTER-BWKEY.

    BAPI_MBEWX-VAL_CLASS = u2018Xu2019.

    IT_MATERIALDESC-LANGU = u2018ENu2019.

    IT_MATERIALDESC-MATL_DESC = IT_MATMASTER-MAKTX.

    append IT_materialdesc.

    IT_UOM-GROSS_WT = IT_MATMASTER-BRGEW.

    IT_UOM-ALT_UNIT = u2018KGu2019.

    IT_UOM-ALT_UNIT_ISO = u2018KGu2019.

    IT_UOM-UNIT_OF_WT = IT_MATMASTER-GEWEI.

    APPEND IT_UOM.

    IT_UOMX-GROSS_WT = u2018Xu2019.

    IT_UOMX-ALT_UNIT = u2018KGu2019.

    IT_UOMX-ALT_UNIT_ISO = u2018KGu2019.

    IT_UOMX-UNIT_OF_WT = u2018Xu2019.

    APPEND IT_UOMX.

    it_mean-unit = u2018KD3u2032.

    append it_mean.

    it_mltx-langu = u2018Eu2019.

    it_mltx-text_name = it_matmaster-matnr.

    APPEND IT_MLTX.

    CALL FUNCTION u2018BAPI_MATERIAL_SAVEDATAu2019

    EXPORTING

    headdata = BAPIMATHEAD

    CLIENTDATA = BAPI_MARA

    CLIENTDATAX = BAPI_MARAx

    PLANTDATA = BAPI_MARc

    PLANTDATAX = BAPI_MARcx

    • FORECASTPARAMETERS =

    • FORECASTPARAMETERSX =

    • PLANNINGDATA =

    • PLANNINGDATAX =

    • STORAGELOCATIONDATA =

    • STORAGELOCATIONDATAX =

    VALUATIONDATA = BAPI_MBEW

    VALUATIONDATAX = BAPI_MBEWX

    • WAREHOUSENUMBERDATA =

    • WAREHOUSENUMBERDATAX =

    • SALESDATA =

    • SALESDATAX =

    • STORAGETYPEDATA =

    • STORAGETYPEDATAX =

    • FLAG_ONLINE = u2018 u2018

    • FLAG_CAD_CALL = u2018 u2018

    IMPORTING

    RETURN = IT_RETURN

    TABLES

    MATERIALDESCRIPTION = IT_MATERIALDESC

    UNITSOFMEASURE = IT_UOM

    UNITSOFMEASUREX = IT_UOMX

    INTERNATIONALARTNOS = it_mean

    • MATERIALLONGTEXT = IT_MLTX

    • TAXCLASSIFICATIONS =

    • RETURNMESSAGES =

    • PRTDATA =

    • PRTDATAX =

    • EXTENSIONIN =

    • EXTENSIONINX =

    .

    Thanks & Regards

    Harish

    Add comment
    10|10000 characters needed characters exceeded

    • As suhas mentioned, check the values passed to fields NET_WEIGHT & UNIT_OF_WT in structures (CLIENTDATA & CLIENTDATAX). Error is triggered when Net weight is not initial and UNIT_OF_WT is initial (See Line 20 of Function module MARA_GEWEI).