‎2006 Jul 27 9:17 PM
Hi all,
I have a field <field> of type FLTP and length 16. This field has a value 4.650000000000000E+01. I want to print this value as 46.5. How can I do this.
Waiting for replies. Thanks
‎2006 Jul 27 9:21 PM
data val(16).
write <field> to val.
condense val.
hope this will work
‎2006 Jul 27 9:27 PM
Hi Raju,
Take another variable of TYPE P DECIMALS 1 and MOVE fltp to type p.
DATA V_FLTP TYPE F VALUE '4.650000000000000E+01'.
<b>DATA V_PD TYPE P DECIMALS 1.
V_PD = V_FLTP
WRITE V_PD. -
> 46.5.</b>
V_PD displays leading blanks and displays 46.5,BUT if you need with out leading blanks then take a character variable of length 16 and move the contents of V_PD.
<b>DATA V_C(16) TYPE C.
V_C = V_PD.
CONDENSE V_C.
WRITE V_C. -
> 46.5 (W/0 leading blanks)</b>
<b>Note: Plz award all helpful answers and close the thread once problem is solved.</b>
Thanks,
Vinay
‎2006 Jul 27 9:46 PM
If you want to show <field> in list display use
WRITE <Field> EXPONENT 0 DECIMALS 1.
Regards
Sridhar
‎2006 Jul 27 9:54 PM
Hi guys,
Thank you for the replies. I think I forgot to mention some thing else.
I can have any value in the field <field>. For example If I have
4.650000000000000E+01 I need 46.5 and if I have
5.000000000000000E-02 I need 0.05
in my <field>. how can I do this. Waiting...........
‎2006 Jul 27 11:04 PM
write v_fltp to v_char exponent 0.
shift v_char right deleting trailing '0'.
write v_char.
Regards
Sridhar
‎2006 Jul 28 12:15 AM
‎2007 Apr 04 3:40 PM
I have the same problem like you, but cannot solve it with these answers in this thread here.
My <fs> is assigned to a field of a table (dynamicly and direktly). To copy the value in <fs> to an P-Variable, it doesn't helped me...
See my code:
DATA:
grfk_ok_code TYPE sy-ucomm,
grfk_values TYPE TABLE OF GPRVAL WITH HEADER LINE,
wa_ztab TYPE zqm_chq,
l_index TYPE n,
l_field TYPE string,
l_fs2p TYPE p DECIMALS 3
.
FIELD-SYMBOLS: <fs_field> TYPE ANY.
LOOP AT ztab INTO wa_ztab.
UNASSIGN <fs_field>.
l_index = sy-tabix.
CONCATENATE 'grfk_values-val' l_index INTO l_field.
ASSIGN (l_field) TO <fs_field>.
IF sy-subrc <> 0.
RETURN.
ENDIF.
<fs_field> = wa_ztab-cf_dlp.
l_fs2p = <fs_field>.
<fs_field> = l_fs2p.
ENDLOOP.
And I cannot use the floating point values in the grfk_value table...
Regards,
Steffen