on 10-19-2005 6:06 AM
Hi,
I want to convert weight field's units into KG. i want to add the all weights but i want to convert it into KG before. as it may contain the units other than KG. plz tell me its veryvery urgent.
i think u understood..
weight( (VBRP-BRGEW)
units (VBRP-GEWEI)
Kumar
Hi,
The following is from documentation.Have a look at it.Give unit_out = 'KG'.
Kindly reward points by clikcing the star on the left of reply,if it helps.
Functionality
This FM converts values from one measurement unit to another and rounds the result to the number of decimal places maintained in the measurement unit table, if necessary. The rounding is up ('+'), down ('-'), commercial ('X') or no rounding (SPACE), depending on the parameter ROUND_SIGN.
It can also be used for rounding according to the measurement unit table only. In this case UNIT_IN = UNIT_OUT.
Conversion requires that both units are maintained in the measurement unit table and have the same dimension and are not both without dimension.
Rounding is also possible for dimensionless units.
Example
DATA: VALUE_IN TYPE F,
VALUE_OUT TYPE F,
UNIT_IN LIKE T006-MSEHI,
UNIT_OUT LIKE T006-MSEHI.
...
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'
EXPORTING
INPUT = VALUE_IN
ROUND_SIGN = 'X'
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
this sample code must help u ....
&----
*& Form z_unit_conversion_kg
&----
This form is used to convert weight unit in 'LB'
----
--> p1 text
<-- p2 text
----
FORM Z_UNIT_CONVERSION_LB.
I_LN_ITEMS-BRGEW_KG = I_LN_ITEMS-BRGEW.
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'
EXPORTING
INPUT = I_LN_ITEMS-BRGEW
UNIT_IN = C_KG
UNIT_OUT = C_LB
IMPORTING
OUTPUT = I_LN_ITEMS-BRGEW_LB.
I_LN_ITEMS-NTGEW_KG = I_LN_ITEMS-NTGEW.
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'
EXPORTING
INPUT = I_LN_ITEMS-NTGEW
UNIT_IN = C_KG
UNIT_OUT = C_LB
IMPORTING
OUTPUT = I_LN_ITEMS-NTGEW_LB.
MODIFY I_LN_ITEMS TRANSPORTING NTGEW_KG NTGEW_LB.
ENDFORM. " z_unit_conversion_lb
&----
*& Form z_unit_conversion_lb
&----
This form is used to convert weight unit in 'KG'
----
--> p1 text
<-- p2 text
----
FORM Z_UNIT_CONVERSION_KG.
I_LN_ITEMS-BRGEW_LB = I_LN_ITEMS-BRGEW.
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'
EXPORTING
INPUT = I_LN_ITEMS-BRGEW
UNIT_IN = C_LB
UNIT_OUT = C_KG
IMPORTING
OUTPUT = I_LN_ITEMS-BRGEW_KG.
MODIFY I_LN_ITEMS TRANSPORTING BRGEW_LB BRGEW_KG.
I_LN_ITEMS-NTGEW_LB = I_LN_ITEMS-NTGEW.
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'
EXPORTING
INPUT = I_LN_ITEMS-NTGEW
UNIT_IN = C_LB
UNIT_OUT = C_KG
IMPORTING
OUTPUT = I_LN_ITEMS-NTGEW_KG.
MODIFY I_LN_ITEMS TRANSPORTING NTGEW_LB NTGEW_KG.
ENDFORM. " z_unit_conversion_kg
&----
*& Form z_unit_conversion_kg_lb
&----
This form is used to convert weight unit in 'KG' and 'LB'
----
--> p1 text
<-- p2 text
----
FORM Z_UNIT_CONVERSION_KG_LB.
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'
EXPORTING
INPUT = I_LN_ITEMS-BRGEW
UNIT_IN = I_LN_ITEMS-GEWEI
UNIT_OUT = C_KG
IMPORTING
OUTPUT = I_LN_ITEMS-BRGEW_KG.
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'
EXPORTING
INPUT = I_LN_ITEMS-BRGEW_KG
UNIT_IN = C_KG
UNIT_OUT = C_LB
IMPORTING
OUTPUT = I_LN_ITEMS-BRGEW_LB.
MODIFY I_LN_ITEMS TRANSPORTING BRGEW_KG BRGEW_LB.
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'
EXPORTING
INPUT = I_LN_ITEMS-NTGEW
UNIT_IN = I_LN_ITEMS-GEWEI
UNIT_OUT = C_KG
IMPORTING
OUTPUT = I_LN_ITEMS-NTGEW_KG.
CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'
EXPORTING
INPUT = I_LN_ITEMS-NTGEW_KG
UNIT_IN = C_KG
UNIT_OUT = C_LB
IMPORTING
OUTPUT = I_LN_ITEMS-NTGEW_LB.
MODIFY I_LN_ITEMS TRANSPORTING NTGEW_KG NTGEW_LB.
ENDFORM. " z_unit_conversion_kg_lb
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Try the function
UNIT_CONVERSION_SIMPLE - It convert weights from one UOM to another.
Thanks,
Ruthra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.