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

table to string

Former Member
0 Likes
646

Hello,

I have a short question. I have created a table with lines of strings.

Now I want to convert these lines of the table to one string.

What is the easiest way to create one string with the entries of the table?

Regards

Philipp

1 ACCEPTED SOLUTION
Read only

JozsefSzikszai
Active Contributor
0 Likes
606

hi Philipp,

something like this:

LOOP AT itab INTO wa.
CONCATENATE string wa INTO string SEPARATED BY space.
ENDLOOP.

From Release 6.0 you can also use:

CONCATENATE LINES OF itab INTO string SEPARATED BY space.

hope this helps

ec

4 REPLIES 4
Read only

JozsefSzikszai
Active Contributor
0 Likes
607

hi Philipp,

something like this:

LOOP AT itab INTO wa.
CONCATENATE string wa INTO string SEPARATED BY space.
ENDLOOP.

From Release 6.0 you can also use:

CONCATENATE LINES OF itab INTO string SEPARATED BY space.

hope this helps

ec

Read only

peter_ruiz2
Active Contributor
0 Likes
606

hi,


data: v_string type string.

loop at itab into wa.
  concatenate v_string into wa-string separated by space.
endloop.

*this is to remove the space in front of the string
condense v_string.

regards,

Peter

Read only

Former Member
0 Likes
606

hi,

If i have understood your question correctly. You take an internal with single character string with 1000 length.


types : begin of ty_string,
 string(1000),
           end of ty_string.

data : it_string type standard table of ty_string.


loop at itab into wa_string.
  cocatenate wa_string-field1 wa_string-field2 wa_string-field3 ....into it_string.
  append it_string.
  clear it_string. 
endloop.  

Read only

Former Member
0 Likes
606

hiii

you can use a loop.then take every line of table in one variable and concatenate that variable in one another variable which is having string data type..

like below

SELECT string  FROM ztable
    INTO TABLE i_table.
   
loop at i_table.
  wa_string = wa_table.
  CONCATENATE wa_string into wa_longtext.
endloop.

regards

twinkal