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

split and concotenate

Former Member
0 Likes
655

hi huys,

how to split the value and concotenate the value...

for eg.

i hvave the value like 4.549,50 but i want 4,549.50 like this.

Thanks & Regards,

praveen

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
634

First try to change the user settings in SU01.

Here in Default tab define decimal notation as 1,234,567.89.

and check whether changes are reflected or not?

After that also if you are getting the same problem then try the code

data : text(50) value '1.234,56'.

replace all occurrences of ',' in text with '*' .

replace all occurrences of '.' in text with ',' .

replace all occurrences of '*' in text with '.' .

write : / text.

5 REPLIES 5
Read only

matt
Active Contributor
0 Likes
634

Why not use REPLACE?

matt

Read only

prasanth_kasturi
Active Contributor
0 Likes
634

HI,

try this way

PARAMETERS p_val(10) type c .

REPLACE ALL OCCURRENCES OF ',' in p_val with '.'.

replace '.' IN P_VAL WITH ','.

write p_val.

regards

prasanth

Read only

Former Member
0 Likes
635

First try to change the user settings in SU01.

Here in Default tab define decimal notation as 1,234,567.89.

and check whether changes are reflected or not?

After that also if you are getting the same problem then try the code

data : text(50) value '1.234,56'.

replace all occurrences of ',' in text with '*' .

replace all occurrences of '.' in text with ',' .

replace all occurrences of '*' in text with '.' .

write : / text.

Read only

0 Likes
634

Hi prasad,

my problem is solved while going to the su01 transcaction.

thanq for ur help.

Regards,

praveen.

Read only

Former Member
0 Likes
634

Hi,

You can use the following code for this,

DATA: str1 TYPE string,

str2 TYPE string,

str3 TYPE string,

itab TYPE TABLE OF string,

text TYPE string,

l_no type String value '4.549,50' .

SPLIT l_no AT '.' INTO: str1 str2 .

SPLIT str2 AT ',' INTO: str2 str3 .

concatenate str1 str2 into str2 separated by ',' .

concatenate str2 str3 into str3 separated by '.' .

write /: str3.

You can do this by using REPLCE also

replace all occurences of ',' in l_no with '.'.

replace first occurence of '.' in l_no with ','.

write : l_no.