Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Convert -ve values to float value

Former Member
0 Likes
602

Hi Friends,

I have a character field with the following value

114,3200 - (a negative value),when i copy it to a

float value,the -ve sign is lost,how do i retain -ve value

for a float value.

regards

kaushik

4 REPLIES 4
Read only

Former Member
0 Likes
541

hi Hedge,

Try taking that value to type p and then pass it to type f .. i guess this way it should work ..

Regards,

santosh

Read only

Laxmana_Appana_
Active Contributor
0 Likes
541

Hi,

check this :

this is working for me.

data x_test(10) type c,
     x_result type p.

x_test = '1143200 -'.

move x_test to x_result.

write x_result.

Regards

Appana

Read only

Former Member
0 Likes
541

hi,

Try this code.

data: v_char(10) type c value '2,389.56-',

v_float type f.

translate v_char using ', '.

translate v_char using '. '.

condense v_char no-gaps.

v_float = v_char.

write 😕 v_float.

Regards,

Sailaja.

Read only

Former Member
0 Likes
541

You can make use of the fm: HRCM_STRING_TO_AMOUNT_CONVERT.

rEGARDS,

rAVI