2014 Feb 19 7:13 AM
Hi,
I am trying to change exponetial value to pack decimals 2 value . I used following FM
'CHAR_FLTP_CONVERSION'
CHAR_PACK_CONVERSION' this is showing length is longer.
ex. data lv_char type char22.
data lv_dec type p decimals 2.
lv_char = ' 0.000000000000000E+01'.
now i want to change it decimal value.
Please give me some solution.
Regards,
Durga.
2014 Feb 19 7:15 AM
Hi,
did you check with the statement WRITE ... TO ... ?
regards
Fred
2014 Feb 19 8:20 AM
Hello Durga,
Try with the below code.
data:lv_temp(128),
lv_value type zflpt. " zfltp domian is FLTP
lv_value = '2.6000000000000003E-03'.
lv_temp = lv_value.
ls_convert-type = 'P'.
ls_convert-length = 13.
ls_convert-decimals = 6.
ls_convert-ddic_leng = 13.
ls_convert-sign = c_true.
CALL FUNCTION 'RS_CHECK_CONV_EX_2_IN_NO_DD'
EXPORTING
input_external = lv_temp
descr = ls_convert
IMPORTING
input_i_format = lv_temp
lv_temp has value 0.002600
Regards,
Thanga
2014 Feb 19 10:42 AM
Hi Thanga,
data:lv_temp(128),
lv_value type QMAX_VAL. " zfltp domian is FLTP
lv_value = '2.6000000000000003E-03'.
lv_temp = lv_value.
data: ls_convert type RSCONVERT.
ls_convert-type = 'P'.
ls_convert-length = 13.
ls_convert-decimals = 6.
ls_convert-ddic_leng = 13.
ls_convert-sign = '+' .
CALL FUNCTION 'RS_CHECK_CONV_EX_2_IN_NO_DD'
EXPORTING
input_external = lv_temp
descr = ls_convert
IMPORTING
input_i_format = lv_temp.
I am doing this but i am getting errror "Entry 2.0000000000000000E-03 is too long" Please correct me where i am doing wrong.
Regards,
Durga.
2014 Feb 19 8:28 AM
Hi Durga,
you need define a variable type F.
data: lv_f type f.
MOVE lv_char TO lv_f.
lv_dec = lv_f.
regards
Archer
2014 Feb 19 9:50 AM
Hi Durga,
As per your requirement we cannot move the char to packed decimal 2. Because lv_char is char22 and lv_dec is type p decimal 2. Where lv_char = ' 0.000000000000000E+01'. cannot be recognised as number. So when moving from lv_char to lv_dec it occurs runtime error.
Regards,
Vineesh.