on 06-17-2013 7:29 AM
Hi
We are running on Information Steward 4.0
I am urgently looking for a solution for a rule where I need to convert a value from a table defined character field into a numeric value. I have searched the available documentation but have not found anything.
I tried applying the Convert to Decimal but when I run the rule it fails stating "Option <to_decimal_ext> must contain a constant value, not a variable, parameter, or column reference"
appreciate your help
regards
Ed
Can you provide more information on the exact requirement. We use IS and never came across this kind of requirement.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Example below shows the rule where the field dbo.CLASSIFICATION.CHAR_VALUE = varchar
I need to report as error where Z1_GDS_STOR_TEMP_MAX / CHAR_VALUE < Z1_GDS_STOR_TEMP_MIN / CHAR_VALUE
in order to do this I need to convert the value to numeric
I tried the Function "Convert to decimal" in IS rule build but the fails with error message
"Option <to_decimal_ext> must contain a constant value, not a variable, parameter, or column reference."
DECLARE
$MaxTemp decimal(4, 0);
$MinTemp decimal(4, 0);
#Scenario 07/ Rule 179:
BEGIN
$MaxTemp = lookup('ECC_SIRS_PRD_MAT Sirius Production Material Data', 'dbo.CLASSIFICATION', 'MATERIAL_NUMBER', $MATNR, 'CHARACTERISTIC', 'Z1_GDS_STOR_TEMP_MAX', 'CHAR_VALUE', null);
$MinTemp = lookup('ECC_SIRS_PRD_MAT Sirius Production Material Data', 'dbo.CLASSIFICATION', 'MATERIAL_NUMBER', $MATNR, 'CHARACTERISTIC', 'Z1_GDS_STOR_TEMP_MIN', 'CHAR_VALUE', null);
IF (to_decimal($MaxTemp, null, null, 4, null) < to_decimal($MinTemp, null, null, 4, null))
RETURN FALSE;
ELSE RETURN TRUE;
END
thanks
Ed
Hi E,
From Character to Numeric,
DATA: lv_chr(4) type c,
lv_num type p.
CALL FUNCTION 'MOVE_CHAR_TO_NUM'
EXPORTING
CHR = lv_chr
IMPORTING
NUM = lv_num
EXCEPTIONS
CONVT_NO_NUMBER = 1
CONVT_OVERFLOW = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
If you want string to decimals use the following,
FIELD-SYMBOLS <BETRG> TYPE any.
DATA lv_BETRG TYPE p DECIMALS 2.
CALL FUNCTION 'HRCM_STRING_TO_AMOUNT_CONVERT'
EXPORTING
string = '234123477'
DECIMAL_SEPARATOR = '.'
THOUSANDS_SEPARATOR = ','
WAERS = ' '
IMPORTING
BETRG = lv_BETRG
EXCEPTIONS
CONVERT_ERROR = 1
OTHERS = 2
.
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_BETRG.
Hope This will solve your problem.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
11 | |
11 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.