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

UOM Convertion

Former Member
0 Likes
2,238

Hi Gurus,

Can anybody please tell me the table or FM in which we can get the covertions from one UOM to other.

Thanks & Regards,

Vijaya.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,204

Hi Gurus,

please dont feel that i am expecting spoon feeding,

i have tried with below code but i am unable to get the

convertions,please advice me...

DATA: VALUE_IN TYPE F VALUE '10.000',

VALUE_OUT TYPE F,

UNIT_IN LIKE T006-MSEHI VALUE 'GLL',

UNIT_OUT LIKE T006-MSEHI VALUE 'LB'.

...----


CLEAR VALUE_OUT.

CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'

EXPORTING

INPUT = VALUE_IN

UNIT_IN = UNIT_IN

UNIT_OUT = UNIT_OUT

IMPORTING

OUTPUT = VALUE_OUT

EXCEPTIONS

CONVERSION_NOT_FOUND = 01

DIVISION_BY_ZERO = 02

INPUT_INVALID = 03

OVERFLOW = 04

OUTPUT_INVALID = 05

UNITS_MISSING = 06

UNIT_IN_NOT_FOUND = 07

UNIT_OUT_NOT_FOUND = 08.

IF SY-SUBRC = 0.

WRITE:/ VALUE_OUT.

ENDIF.

-


Thanks & Regards,

Vijaya.

Hi Gurus,

Can anybody please tell me the table or FM in which we can get the covertions from one UOM to other.

Thanks & Regards,

Vijaya.

18 REPLIES 18
Read only

Former Member
0 Likes
2,204

Hi,

Please check,

UNIT_CONVERSION_SIMPLE

Read only

0 Likes
2,204

Hi Senthil,

Thank you,but could you please show me the output with any one example (any conversion),since i have tried this but i am unable to do convertions,

below is the input req for respective FM

Import parameters Value

INPUT

NO_TYPE_CHECK X

ROUND_SIGN

UNIT_IN

UNIT_OUT

Read only

Former Member
0 Likes
2,204

Hi Vijaya,

Check out the Function Module:


CIF_GEN_CONVERT_BASE_UOM

Thanks,

Chidanand

Read only

former_member156446
Active Contributor
0 Likes
2,204

MATERIAL_UNIT_CONVERSION

MATERIAL_CONVERT_QUANTITY

Read only

0 Likes
2,204

Hi, the conversion should not be material specific..

please advice me

Thanks & Regards,

Vijaya.

Read only

0 Likes
2,204

CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'

EXPORTING

input = ACTUAL QUANTITY

  • NO_TYPE_CHECK = 'X'

  • ROUND_SIGN = ' '

unit_in = ACTUAL UOM

unit_out = 'KG' ( UOM YOU WANT TO CONVERY )

IMPORTING

  • ADD_CONST =

  • DECIMALS =

  • DENOMINATOR =

  • NUMERATOR =

output = w_output-h_qtyin_kg

  • 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.

ENDIF.

Example

http://sap.niraj.tripod.com/id64.html

Read only

former_member156446
Active Contributor
0 Likes
2,204

[You can use the function module 'UNIT_CONVERSION_SIMPLE' |http://www.sap-img.com/business/how-to-convert-base-units-into-target-units-in-bw-reports.htm]

Read only

0 Likes
2,204

jay....

could you please provide me a simple example..

Thanks & Regards,

Vijaya.

Read only

0 Likes
2,204

Hi Vijaya,

Jay has given you a link for example. Moreover the FM is self explanatory and very easy to understand. Jus see the parameters

EXPORTING

input

unit_in

unit_out

IMPORTING

output

Would you unable to make it out from this ?

Read only

0 Likes
2,204

in the link above its clearly explained in words..

anyways check this

CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'
     EXPORTING
          INPUT    = L_KBEDM
          UNIT_IN  = T_ZCKA-KAPEH
          UNIT_OUT = CON-MEINS_TIM
     IMPORTING
          OUTPUT   = L_KBEDM
     EXCEPTIONS
          OTHERS   = 1.

CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'
     EXPORTING
          INPUT    = L_MENGE
          UNIT_IN  = L_MEINS
          UNIT_OUT = ZCBS-VOLEH
     IMPORTING
          OUTPUT   = L_MENGE
     EXCEPTIONS
          OTHERS   = 1.

Read only

Former Member
0 Likes
2,205

Hi Gurus,

please dont feel that i am expecting spoon feeding,

i have tried with below code but i am unable to get the

convertions,please advice me...

DATA: VALUE_IN TYPE F VALUE '10.000',

VALUE_OUT TYPE F,

UNIT_IN LIKE T006-MSEHI VALUE 'GLL',

UNIT_OUT LIKE T006-MSEHI VALUE 'LB'.

...----


CLEAR VALUE_OUT.

CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'

EXPORTING

INPUT = VALUE_IN

UNIT_IN = UNIT_IN

UNIT_OUT = UNIT_OUT

IMPORTING

OUTPUT = VALUE_OUT

EXCEPTIONS

CONVERSION_NOT_FOUND = 01

DIVISION_BY_ZERO = 02

INPUT_INVALID = 03

OVERFLOW = 04

OUTPUT_INVALID = 05

UNITS_MISSING = 06

UNIT_IN_NOT_FOUND = 07

UNIT_OUT_NOT_FOUND = 08.

IF SY-SUBRC = 0.

WRITE:/ VALUE_OUT.

ENDIF.

-


Thanks & Regards,

Vijaya.

Read only

0 Likes
2,204
DATA: VALUE_IN TYPE F VALUE '10.000',
VALUE_OUT TYPE F,
UNIT_IN LIKE T006-MSEHI VALUE 'GLL',  " change it to KG
UNIT_OUT LIKE T006-MSEHI VALUE 'LB'.

convertion can be done from same unit type weight to weight ... length to lenght etc..

are you sure you want to use type F for input amount? you can find some FM's which change the Floating type values to normal format.

Read only

0 Likes
2,204

Jay..

i have done that i mean changed to KG but still the same..

no o/p and regarding Floating type values,plz read the FM

documentation it is expecting a floating point...

please advice me...

Thanks & Regards,

Vijaya.

Read only

0 Likes
2,204

In Ecc 5.0 the input is of format blank.. so you can use any type.

I executed the code and it works fine for me:

DATA: value_in TYPE p VALUE '1',
value_out TYPE p DECIMALS 3,
unit_in LIKE t006-msehi VALUE 'KG',
unit_out LIKE t006-msehi VALUE 'LB'.

CLEAR value_out.
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'
  EXPORTING
    input                = value_in
    unit_in              = unit_in
    unit_out             = unit_out
  IMPORTING
    output               = value_out
  EXCEPTIONS
    conversion_not_found = 01
    division_by_zero     = 02
    input_invalid        = 03
    overflow             = 04
    output_invalid       = 05
    units_missing        = 06
    unit_in_not_found    = 07
    unit_out_not_found   = 08.

output:           2.205

I used http://www.convertunits.com/from/kg/to/lb to check...

Read only

0 Likes
2,204

my VPN disconnected, any way i will try this,

but i am working in version 4.7 lets see does it workout or not?

but anyway thankyou..... very much... jay...

i will update you on the same...

Thanks & Regards,

Vijaya.

Read only

0 Likes
2,204

Jay's code works well in 4.7 (but gives a slightly different answer: 2.200).

Rob

Read only

0 Likes
2,204

Jay...

Its Working thankyou verymuch.

Thanks & Regards,

Vijaya.

Read only

Former Member
0 Likes
2,204

hi,

you can go through MM03->basic view .On the application tool bar "additional data" button will be there. click on this, you will see a new screen with different tabs. select "Units of Measure".

here you can see the alternative UOM for each material.

You can also check MARM table.

the same values are stored in MARM table.

Cheers,

JP