‎2006 Dec 12 2:13 AM
Hi. I am converting UOM from 'g' to 'lbs' and i'm using UNIT_CONVERSION_SIMPLE function module. My question is how will i make the output in 2 decimals places. I only got rounded off to the nearest whole number. Please help.
‎2006 Dec 12 2:23 AM
Maybe this will help, all you need to do is pass fields that are TYPE p with Decimals places 2.
report zrich_0001.
data: out type p decimals 2.
parameters: p_in type p decimals 2 default '1234.67',
p_uomi type t006-msehi default 'G' ,
p_uomo type t006-msehi default 'LB'.
call function 'UNIT_CONVERSION_SIMPLE'
exporting
input = p_in
* NO_TYPE_CHECK = 'X'
* ROUND_SIGN = ' '
unit_in = p_uomi
unit_out = p_uomo
importing
* ADD_CONST =
* DECIMALS =
* DENOMINATOR =
* NUMERATOR =
output = out
* 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:/ out.
Regards,
Rich Heilman
‎2006 Dec 12 2:23 AM
Maybe this will help, all you need to do is pass fields that are TYPE p with Decimals places 2.
report zrich_0001.
data: out type p decimals 2.
parameters: p_in type p decimals 2 default '1234.67',
p_uomi type t006-msehi default 'G' ,
p_uomo type t006-msehi default 'LB'.
call function 'UNIT_CONVERSION_SIMPLE'
exporting
input = p_in
* NO_TYPE_CHECK = 'X'
* ROUND_SIGN = ' '
unit_in = p_uomi
unit_out = p_uomo
importing
* ADD_CONST =
* DECIMALS =
* DENOMINATOR =
* NUMERATOR =
output = out
* 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:/ out.
Regards,
Rich Heilman