2008 Jul 04 4:19 AM
Hi All,
Are Commas accepted in a Currency Fieldsi.e.,
I have to update a currency field in the Database Table.
If the user provides entries as 23,000.0000 the ',' is not accepted.
Is it possible to eliminate this , programatically?
Please note : he can also enter 23,330,340.00 also.
Any input on this will be of great help.
Thanks and Regards,
Pavithra
2008 Jul 04 4:27 AM
Hi Pavithra,
Generally there are Conversion routiines , it will take care of all these things .
If we give teh currency as 23046521 it automatically converts in to 23,046,521.00 will storing in database.
Best regards,
raam
Hi,
You need not even split, You can use REPLACE ALL OCCURANCES OF and CONDENSE to achieve the Same.
Edited by: Siva Prakash on Jul 4, 2008 4:17 AM
2008 Jul 04 4:27 AM
Hi Pavithra,
Generally there are Conversion routiines , it will take care of all these things .
If we give teh currency as 23046521 it automatically converts in to 23,046,521.00 will storing in database.
Best regards,
raam
2008 Jul 04 5:01 AM
Hi Ram,
Thanks a lot for your response.
But the idea is the user is providing the Currency Field in my case. So i need to validate this before updating. Any input on this is highly appreciated.
Thanks
Pavithra
2008 Jul 04 5:05 AM
2008 Jul 04 5:09 AM
Hi All,
Thanks a lot for your time.
Problem resolved.
It can be done as follows :
Before updating the Database Table we need to check for ',' and manipulate the value accordingly. Below is the code snippet that accomplishes this :
DATA : t_sal TYPE String,
v_sal TYPE string,
it_tab_sal TYPE TABLE OF string,
wa_tab_sal TYPE string.
CLEAR wa_tab_sal.
t_sal = '23,500,450.0000'.
SPLIT t_sal at ',' INTO TABLE it_tab_sal.
Loop at it_tab_sal INTO wa_tab_sal.
CONCATENATE v_sal wa_tab_sal into v_sal.
CLEAR wa_tab_sal.
ENDLOOP.
WRITE : v_sal.
Regards,
Pavithra
2008 Jul 04 5:16 AM
Hi,
You need not even split, You can use REPLACE ALL OCCURANCES OF and CONDENSE to achieve the Same.
Edited by: Siva Prakash on Jul 4, 2008 4:17 AM
2008 Jul 04 5:22 AM
Hi Pratibha..
The SU3 settings have a role to play here..go to su3>defaults>there u can change the currency type...no need to changein program...the format of currency printing will automatically change...
2008 Jul 04 5:37 AM
Hi Siva!!
Thanks!!!
This Replace all did occur to me but i wasnt aware of the CONDENSE Keyword. I was trying to find if there is any other method to compress space in the string!!
Thanks a lot for your time. Your time is much appreciated and points rewarded
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |