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

Function module

Former Member
0 Likes
651

HI all,

Is there any function module to convert from

grams to kg and

milligrams to kg and

kg to grams etc.

6 REPLIES 6
Read only

Former Member
0 Likes
609

Try using:

md_convert_material_unit

Hope that helps.

Regards

Read only

Former Member
0 Likes
609

Hi,

Check this

CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'
EXPORTING
input = slk-btgew " Weight in LB
unit_in = slk-gewei " LB
unit_out = vttkvb-dtmeg " KG
IMPORTING
output = slk-btgew. " Output : Weight in KG

Read only

0 Likes
609

HI Raj,

I have tried this logic. but not working. can you please check it once and let me know.. please

data: begin of itab occurs 0,

matnr like marm-matnr,

gewei like marm-gewei,

end of itab.

select matnr

gewei

from marm

into table itab

where matnr = '8435448'.

data: v_meins type c.

CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'

EXPORTING

INPUT = '102345.6'

  • NO_TYPE_CHECK = 'X'

  • ROUND_SIGN = ' '

UNIT_IN = itab-gewei

UNIT_OUT = vttkvb-dtmeg

IMPORTING

  • ADD_CONST =

  • DECIMALS =

  • DENOMINATOR =

  • NUMERATOR =

OUTPUT = v_meins

  • EXCEPTIONS

  • CONVERSION_NOT_FOUND = 1

  • DIVISION_BY_ZERO = 2

  • INPUT_INVALID = 3

  • OUTPUT_INVALID = 4

  • OVERFLOW = 5

  • TYPE_INVALID = 6

  • UNITS_MISSING = 7

  • UNIT_IN_NOT_FOUND = 8

  • UNIT_OUT_NOT_FOUND = 9

  • OTHERS = 10

.

IF SY-SUBRC <> 0.

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

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

write: v_meins.

Iam very thank full to you..

Read only

Former Member
0 Likes
609

Hi Mahaboob,

Try this

CALL FUNCTION 'MD_CONVERT_MATERIAL_UNIT'
EXPORTING
I_MATNR = MATNRIAL
I_IN_ME = IN_MEINS
I_OUT_ME = OUT_MEINS
I_MENGE = IN_MENGE
IMPORTING
E_MENGE = OUT_MENGE
EXCEPTIONS
ERROR_IN_APPLICATION = 1
ERROR = 2
OTHERS = 3.

Read only

0 Likes
609

here is a solution for ur problem

try this function module.....and ur problem /..................solved

MATERIAL_UNIT_CONVERSION

Read only

Former Member
0 Likes
609

Thanks to all