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

Select a table into string table

manukapur
Active Participant
0 Likes
2,490

Hello Experts,

How do I select from database into a string table?

e.g. Select * from <tablename> into table <lt_string>.

7 REPLIES 7
Read only

former_member1716
Active Contributor
0 Likes
2,333

manu.kapur,

You need first declare a structure with all the fields holding string Data types, then pass on the data fetched from the above query into the table which is declared based on the string data type structure defined.

By explaining more on your requirement we can help you better.

Regards!

Read only

0 Likes
2,333

I need to read multiple tables more than 20 and then download all the data as one text file. Tried reading them one and one and transferring them to a table with single string field but that doesn't work either.

Any pointers?

Read only

2,333

it is not the same request

Read only

FredericGirod
Active Contributor
0 Likes
2,333

I think you cannot proceed in one statement

Read only

manukapur
Active Participant
0 Likes
2,333

@Frederic Girod,

Even I have to do in steps, what do you suggest? I have already tried reading and passing the tables in a string table, that gives me a type mismatch error.

Read only

FredericGirod
Active Contributor
0 Likes
2,333

(without test).

try somethink like that

select * from t001 into  @data(lt_t001).
select * from t001w into @data(lt_t001w).
select * fron t001k into @data(lt_t001k).

cl_demo_output=>write_data( lt_t001 ).
cl_demo_output=>write_data( lt_t001w ).
cl_demo_output=>write_data( lt_t001k ). 
data(lv_my_string) = cl_demo_output=>get( ).

Read only

Sandra_Rossi
Active Contributor
0 Likes
2,333

I guess you mean a string of characters. What if the table is made of columns of different data types like bytes, packed numbers, floating numbers, what character format do you expect for these types?