10-02-2008 8:04 PM
Hi Guys,
I need to convert the LB to KG, i came to know this the FM "UNIT_CONVERSION_SIMPLE" will support,
I am pssing the INPUT = 100000
UNIT_IN = LB
UNIT_OUT = KG
But function module not giving any ouptut, Can any one suggest, what values i need to pass to the FM or any other way to do the conversion.
Thanks in advacne.
10-02-2008 8:09 PM
Hi,
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[/code]
Hope this helps,
Thanks,
Sree.
10-02-2008 8:18 PM
Make sure that your INPUT and OUTPUT parameters are typed correctly. This works for me.
data: lv_input type p DECIMALS 3 value '10000.000'.
data: lv_output type p DECIMALS 3.
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'
EXPORTING
input = lv_input
UNIT_IN = 'LB'
UNIT_OUT = 'KG'
IMPORTING
OUTPUT = lv_output
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.
write:/ sy-subrc.
write:/ lv_output.
Regards,
Rich Heilman
10-02-2008 8:22 PM
You can use the FM
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'
EXPORTING
input = g_weight_i
unit_in = 'LB'
unit_out = 'KG'
IMPORTING
output = g_weight_o.
Thanks and Regards
David Carballido
10-02-2008 8:23 PM
Hi,
Use it in your editor in SE38. I wont work in SE37.
data out type i.
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'
EXPORTING
input = 100000
UNIT_IN = 'LB'
UNIT_OUT = 'KG'
IMPORTING
OUTPUT = out
.
IF sy-subrc <> 0.
ENDIF.
write 😕 out.
Thanks,
Senthil