11-19-2007 5:03 PM
Hi Dear friends,
iam having one requirement. that is conversion.
here is need to convert from EA to CS, for that one iam using FM: conversion_factor_get
But this is not converting and when i run program it was showing the error is "conversion of dimensionless units is possible".
Here i need to convert from EA to CS.
this is Eg:
DATA : LV_SS TYPE F,
LV_DEC(100) TYPE N,
LV_NUM(100) TYPE N.
call function 'CONVERSION_FACTOR_GET'
EXPORTING
NO_TYPE_CHECK = ' '
UNIT_IN = 'EA'
UNIT_OUT = 'CS'
IMPORTING
ADD_CONST = LV_SS
DECIMALS = LV_DECI
DENOMINATOR = LV_DEC
DIMENSION =
NUMERATOR = LV_NUM
EXCEPTIONS
CONVERSION_NOT_FOUND = 1
OVERFLOW = 2
TYPE_INVALID = 3
UNITS_MISSING = 4
UNIT_IN_NOT_FOUND = 5
UNIT_OUT_NOT_FOUND = 6
OTHERS = 7
..
if SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
write : lv_ss, lv_dec, lv_num.
11-20-2007 2:56 AM
if you see the function module documentation its specifically said that
Only measurement units in the same dimension can be converted. Units without a dimension can not be converted using the measurement unit table.
So check in table:T006 for CS and EA
field T006-DIMID.
Dimensionless units must be translated material specifically.
for that you should use
MATERIAL_UNIT_CONVERSION
For Dimensionless Units of Measure (Each, Piece, Box etc.) conversion depends on the given Material (see table MARM). For other Units of Measure (Length, Weigth etc.) conversion can be calculated from the T006 table or via CONVERSION_FACTOR_GET.