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: 

unit of measure

Former Member
0 Kudos
481

Hi all,

i have measured the weight for a material using below formula

P_NTGEW = MARA-NTGEW * I_MARM-UMREZ / I_MARM-UMREN.

here what is the UOM of P_ntgew?how come we know whether it is G or KG'.

bcause i need to convert this P_NTGEW into KG.

thanx

sunny.

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos
177

Unit should be MARA-GEWEI (the unit associated with field MARA-NTGEW)

Look at MARA via SE11, tab unit/currency.

Regards

10 REPLIES 10

JozsefSzikszai
Active Contributor
0 Kudos
177

hi Sunny,

look for the material in table MARA, field MEINS will tell you the UoM.

hope this helps

ec

0 Kudos
177

hi

but here for this material we are havng MEINS = EA.

but i need weight of P_NTGEW.

thank u

0 Kudos
177

Use FM MD_CONVERT_MATERIAL_UNIT to get the Qty conversion .

Like:


  CALL FUNCTION 'MD_CONVERT_MATERIAL_UNIT'
    EXPORTING
      I_MATNR                    = P_MATNR
      I_IN_ME                    = P_MEINS    " Input UoM .. EA
      I_OUT_ME                   = LF_MEINS    "Output UoM KG
      I_MENGE                    = LF_E_MENGE " QTY in Input UoM ... EA
    IMPORTING
      E_MENGE                    = LF_I_MENGE    " Output QTY in KG
*   EXCEPTIONS
*     ERROR_IN_APPLICATION       = 1
*     ERROR                      = 2
*     OTHERS                     = 3
            .
  IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

Regards,

Naimesh Patel

0 Kudos
177

Hi naimesh,

I need the small clarification. shell we use this FM: 'MATERIAL_UNIT_CONVERSION' reply me.

CALL FUNCTION 'MATERIAL_UNIT_CONVERSION'

EXPORTING

INPUT = v_qty

KZMEINH = ' '

MATNR = p_matnr

MEINH = itab-gewei

MEINS = v_meins

  • EXTENDED_CONV = ' '

  • TYPE_UMR = ' '

  • NO_OUTPUT = ' '

  • CHARGE =

  • CHARG_CUOBJ =

  • WERKS =

IMPORTING

  • ADDKO =

  • MEINS =

OUTPUT = v_qty

  • UMREN =

  • UMREZ =

  • BATCH_CONVERSION_ERROR =

  • KZWSO =

EXCEPTIONS

CONVERSION_NOT_FOUND = 1

INPUT_INVALID = 2

MATERIAL_NOT_FOUND = 3

MEINH_NOT_FOUND = 4

MEINS_MISSING = 5

NO_MEINH = 6

OUTPUT_INVALID = 7

OVERFLOW = 8

OTHERS = 9

.

IF SY-SUBRC <> 0.

write: v_qty.

ENDIF.

0 Kudos
177

Hi nimesh,

if i execute this FM, i'm gettng shortdump.

can you pls check it once.it was showng the message is "conflict error".

below FM:

prameters: p_matnr like mara-matnr.

data: begin of itab occurs 0,

matnr like marm-matnr,

gewei like marm-gewei,

end of itab.

data: v_meins type mara-meins,

v_qty type p decimals 3,

v_qty2 type p decimals 3..

select matnr

gewei

from marm

into table itab

where matnr = p_matnr

and meinh = 'CS'.

select single meins

from mara

into v_meins

where matnr = p_matnr.

v_qty = '133632.0008'.

Loop at itab.

CALL FUNCTION 'MD_CONVERT_MATERIAL_UNIT'

EXPORTING

I_MATNR = p_matnr

I_IN_ME = v_meins

I_OUT_ME = itab-gewei

I_MENGE = v_qty

IMPORTING

E_MENGE = v_qty2

EXCEPTIONS

ERROR_IN_APPLICATION = 1

ERROR = 2

OTHERS = 3

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

write: v_qty2.

endloop.

thank u

sunny

0 Kudos
177

" ... v_qty type p decimals 3,

...

v_qty = '133632.0008'. ... "

you have four decimals!

0 Kudos
177

hi,

even,

if i changed decimal point,v_qty = '133632.008'.

i am getting same error(Type conflict when calling a function module).

can u please change code and send back to me.

thanks for ur help.

thnaku

sunny.

0 Kudos
177

The field GEWEI should have the TYPE MARA-MEINS to avoid the type conflict

Like:


data: begin of itab occurs 0,
matnr like marm-matnr,
*gewei like marm-gewei,
gewei like MARA-MEINS, 
end of itab.

* change the TYPE for qty also:
data: v_qty type EKPO-MENGE,
v_qty2 type EKPO-MENGE.

Regards,

Naimesh Patel

raymond_giuseppi
Active Contributor
0 Kudos
178

Unit should be MARA-GEWEI (the unit associated with field MARA-NTGEW)

Look at MARA via SE11, tab unit/currency.

Regards

Former Member
0 Kudos
177

Hi,

You will get conflict error when the import/ export variables are not of the same data type or declared in same way as given in the function module.

Check the data types of each import and export parameter and accordingly define your variables.

Cheers,

Vikram