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

concatenate

Former Member
0 Likes
859

hai all,

in my internal table i have only one field of type string.

which has 'this is -


test file ' . "----


" is space.

so i am looping the internal table which i am getting

this

is

--- " it represent space

--

test

file

now i have to concatenate the contents of internal table in to string

the output should be like " THIS IS TEST FILE".

PLEASE GIVE ME SUGGESTION .

BYE

LAXMI

hai all,

in my internal table i have only one field of type string.

which has 'this is -


test file ' . "----


" is space.

so i am looping the internal table which i am getting

this

is

--- " it represent space

--

test

file

now i have to concatenate the contents of internal table in to string

the output should be like " THIS IS TEST FILE".

PLEASE GIVE ME SUGGESTION .

BYE

LAXMI

5 REPLIES 5
Read only

Former Member
0 Likes
827

Hi There

Do try "RESPECTING BLANKS" at the end of concatenate.

Hope it helps

Example

After the first CONCATENATE statement, result contains "When_the_music_is_over", after the second statement it contains "When______the_______music_____is________ over______" . The underscores here represent blank characters.

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.

Read only

Former Member
0 Likes
827

When you use the CONCATENATE command all spaces are trimmed.

Read only

Former Member
0 Likes
827

Hi Laxmi ,

All you need to do is

Data : final type string.

LOOP AT IT_1.

concatenate final it_1-text to final separated BY space.

ENDLOOP.

This must solve the issue , if it does not the use CONDENSE FINAL.

Regards

Arun

*Assign points if reply is helpful

Read only

Former Member
0 Likes
827
data : v_string type string.

delete table itab where str eq space. " str is the field of ur itab

loop at itab.
 concatenate v_string itab-str into v_string.
endloop.

write : v_string.
Read only

Former Member
0 Likes
827

Hi laxmi,

check this code

data :name(5) value 'this',

name1(2) value 'is',

name3(3) value ' ',

name4(10) value 'test file',

name5 type string.

concatenate name name1 name4 into name5 separated by ' '.

write : name5.

try this