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

Problem with space into string

Former Member
0 Likes
1,369

I've problem with space into a string.

I have this string.

000006602002-09724600002009____215618_ 10.000,00_ 0,00_ 0,00

After this istruction...

REPLACE ALL occurrences of '_' in string_lv with ' '.

The value is the followings

000006602002-09724600002009215618 10.000,00 0,00 0,00

I'have to tabulate the fields into a file, but doesn't respect the heading space, if I write concatenate f1 f2 into f3 respecting space, there is an check error.

How I can do?

Edited by: Antonio Sanseverino on Jun 16, 2008 3:22 PM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,138

hi send the string into the char string field like

data: test(200) type c .

and use the offset values while populating into the table like this..

itab-field1 = test+0(20) .

8 REPLIES 8
Read only

Former Member
0 Likes
1,138

Hello,

Try using the TRANSLATE command.

Converts the characters "A" to "B", "a" to "b", and vice versa. text contains "Abracadabra" after the conversion.

DATA text TYPE string.

text = `Barbcbdbarb`.

TRANSLATE text USING 'ABBAabba'.

Regards.

Read only

Former Member
0 Likes
1,138

Hi Antonio,

use concatenate statement

*Concatenate <f1> <f2> into <result> RESPECTING BLANKS.

Example

TYPES text TYPE c LENGTH 10.

DATA itab TYPE TABLE OF text.

DATA result TYPE string.

APPEND 'When' TO itab.

APPEND 'the' TO itab.

APPEND 'music' TO itab.

APPEND 'is' TO itab.

APPEND 'over' TO itab.

CONCATENATE LINES OF itab INTO result SEPARATED BY space.

...

CONCATENATE LINES OF itab INTO result RESPECTING BLANKS.

Reward if found helpful.

Regards,

Boobalan Suburaj

Read only

0 Likes
1,138

Doesn't work I've an error when I active the program.

Read only

Former Member
0 Likes
1,138

Hi,

Instead of giving '' write space . Your problem will be solved.

Regards,

Anomitro Guha

Read only

Former Member
0 Likes
1,139

hi send the string into the char string field like

data: test(200) type c .

and use the offset values while populating into the table like this..

itab-field1 = test+0(20) .

Read only

0 Likes
1,138

Yes!!

But why I can't use Concatenate... respecting blanks?

And why I can't fill headings blanks into string?

It's the first time i see this!

Bah Thanks a lot You have had a good idea

Read only

BGarcia
Active Contributor
0 Likes
1,138

Hello Antonio,

Check if this suits your requirement:


DATA lv_data   TYPE string VALUE '000006602002-09724600002009____215618_ 10.000,00_ 0,00_ 0,00'.
DATA lv_table  TYPE TABLE OF string.

SPLIT lv_data AT '_' INTO TABLE lv_table.
CONCATENATE LINES OF lv_table INTO lv_data SEPARATED BY SPACE.
WRITE lv_data.

Kind regards.

Read only

Former Member
0 Likes
1,138

"CONCATENATE LINES OF"

"CONCATENATE F1 F2 INTO F3 RESPECTING BLANKS"

I' have an error

Maybe my biggest problem is the system...

With offset it's ok!!!