Application Development 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: 

Hi expert. replace . with space

Former Member
0 Kudos

HI expert.

I want to replace '.' with space . so I proceed below.

itab is composed to two feilds.

date1 type char10

date2 type char10

the field's values are '2011.01.01'.

REPLACE ALL OCCURRENCES OF REGEX '\b(.)\b'

IN TABLE ITAB WITH SPACE

RESPECTING CASE.

result.

date1 : '2011010120'

date2 : '110101'

but I want the result below.

date1 : '20110101'

date2 : '20110101'

what should i do?

please help.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

As u mention ur date is 2011.01.01 u want to make it as 20110101 as use the FM CONVERT_DATE_TO_INTERNAL.

REGARDS,

ZAFAR

5 REPLIES 5

Former Member
0 Kudos

Hi,

As u mention ur date is 2011.01.01 u want to make it as 20110101 as use the FM CONVERT_DATE_TO_INTERNAL.

REGARDS,

ZAFAR

0 Kudos

BUT there are so many data in the table.

0 Kudos

Check with separted by word

0 Kudos

Hi Jake,

Using convert date to internal as mentioned by Zafar is a good idea, i don't see how this concerns the no of records, do update the post if you have a special requirement/concerns about using that FM.

Anyways the other way to do it using the offsets,


data: l_data type char10 value '2011.01.01',
l_date2 type char10.

concatenate l_data+0(4)  l_data+5(2) l_data+8(2) into l_date2.

or 

l_date2+0(4) = l_data+0(4).
l_date2+8(2) = l_data++5(2).
l_date2+8(2) = l_data+8(2).

Regards,

Chen

ravi_lanjewar
Contributor
0 Kudos

Try this.


data: l_data type char10 value '2011.01.01',
l_date2 type char10.

concatenate l_data+0(4)  l_data+5(2) l_data+8(2) into l_date2 sepArated by space.

write l_date2.