04-25-2011 7:39 AM
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!
04-25-2011 7: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
04-25-2011 8:50 AM
04-25-2011 8:55 AM
Hello,
I hope you have passed the corresponding data in the CLIENTDATAX structure!
Can you specify the error message details viz., Message Class, number etc. ?
BR,
Suhas
04-25-2011 9:04 AM
Yes, yes. I´m passing the corresponding info in clientdatax
This is the error message: "Enter the unit of weight for the net weight". Id message "MK", number message "010".
04-25-2011 9:13 AM
Check whether you have filled IT_UOM table correctly.
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.
http://learningabap.wordpress.com/2007/03/19/creating-material-with-bapi/
04-25-2011 9:30 AM
Ey, people. You´re not gonna believe it! Within bapi process, the value contained in BAPI_MARA-UNIT_OF_WT is lost.
I´ve checked that I pass it to BAPI invoke in my program and, within the BAPI, it´s lost. WOW!
I´m looking for the right place I´m losing it. I tell you more now in a few moments...
04-25-2011 9:57 AM
Well, gurus. Here I go.
In include L1001UEBF01, line 432.
If I go into that if clause (which depends on the value of ti_unitsofmeasure-del_flag), I lose the UNIT_OF_WT. So, If I don´t go into that part of code (I mean, filling BAPI_MARM-del_flag = 'X') the value of BAPI_MARM-UNIT_OF_WT remains with the same value, and I don´t get the error.
Now, I have another error: "The alternative unit of measure is the same as the base unit of measure".
I wait for your comments...
By the way, thank you very much for your help, people!
04-26-2011 7:27 AM
Check CLIENTDATA and UNITSOFMEASURE where in u are passing the UOM.
Got the below details from docu, check if this helps:
You need specify a unit of measure in the field PO_UNIT (or PO_UNIT_ISO) only if the order unit is not the same as the base unit of measure (field BASE_UOM or BASE_UOM_ISO).
If units of measure that do not yet exist in the system are transferred in the following fields, an entry in the structure UNITSOFMEASURE must also be transferred for these new units of measure:
BASE_UOM (or BASE_UOM_ISO)
PO_UNIT (or PO_UNIT_ISO)
04-27-2011 9:33 AM
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.
04-25-2011 8: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
04-25-2011 8:56 AM
Hi, harishkumar:
I´m checking your code, and I´m getting the same error, unfortunately.
I keep on testing...
04-25-2011 9:08 AM
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).