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

Retrieving n displaying variables

Former Member
0 Likes
594

Hi folks

If have a flat file in which I have a value like 35234.

Now i want to retrieve n display those values like 35,234.00. How can I do that.

In the same way if I get the value like 35,234.00 how can I remove those ',' and '.' from the value.

Gimme sample code on those.

Thanks in advance.

REgards,

Ram

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
572

well it it is a number you get from your file, and if you put it in a numeric datatype (p,f,i) you will get the 1k seperator point without doing anything.

If not, you have to go through your properties.

the other way round: replace '.' with ''.

anyway i wouldnt recomment to delete the comma, since when you want to read the record from your file again, why would you know how much characters you had behind the comma before you deleted the comma?

Hi folks

If have a flat file in which I have a value like 35234.

Now i want to retrieve n display those values like 35,234.00. How can I do that.

In the same way if I get the value like 35,234.00 how can I remove those ',' and '.' from the value.

Gimme sample code on those.

Thanks in advance.

REgards,

Ram

4 REPLIES 4
Read only

Former Member
0 Likes
572

The variable that is going to hold the value should be declared as type p decimals 2.

In your user settings, the setting for the numeric fomat must be chosen appropriately (in SU3 transaction).

for your second query, move to a type I variable.

Then move the content of it to a char type variable.

Then replace the ',' with ''.

replace all occurances of ',' with '' in v_char.

Regards,

Ravi

Read only

Former Member
0 Likes
573

well it it is a number you get from your file, and if you put it in a numeric datatype (p,f,i) you will get the 1k seperator point without doing anything.

If not, you have to go through your properties.

the other way round: replace '.' with ''.

anyway i wouldnt recomment to delete the comma, since when you want to read the record from your file again, why would you know how much characters you had behind the comma before you deleted the comma?

Read only

Former Member
0 Likes
572

Hi,

Data: v_so(5) type c value '35234',

v_num like vbak-netwr

v_num1(5) type n.

v_num = v_so. You will get 35,234.00 (currency type) (or you can declare a variable type P decimals 2 and use)

v_num1 = v_num. (numeric)

reward if useful

regards,

Anji

Read only

Former Member
0 Likes
572

In se38

-> system settings -


>owndata-> change decimal format default to your requirement..

data:

w_val type p decimals 2.

w_val = '3456'.

write w_val.

for second...

data:

w_val(6) type n.

w_val = '3,456.00'.

write w_val.