2007 Mar 28 1:06 PM
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
2007 Mar 28 1:11 PM
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?
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?
2007 Mar 28 1:09 PM
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
2007 Mar 28 1:11 PM
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?
2007 Mar 28 1:12 PM
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
2007 Mar 28 1:14 PM
In se38
-> system settings -
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.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |