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: 

How to select all data from a table to a structure using one select statement?

former_member798
Employee
Employee

SELECT * from /brlt/subsc INTO dup_table WHERE Type = ls_request_input_data-Type AND Dl1 = ls_request_input_data-Dl1.
ENDSELECT.

The statement above is going in a loop instead of selecting all rows at once in a structure.

4 REPLIES 4

FredericGirod
Active Contributor

A structure is something flat, is like a table with only one line. So you cannot have a whole table inside a structure.

You have to declare a table

SELECT * from /brlt/subsc 
       INTO TABLE @DATA(dup_table) 
       WHERE Type = @ls_request_input_data-Type 
       AND    Dl1 = @ls_request_input_data-Dl1.

or use your statement, because it is the right way to read a table in a structure

Sandra_Rossi
Active Contributor

Please use the CODE button to format your code so that it's shown in a more user-friendly format (colorized).

srikanthnalluri
Active Participant

I would suggest to check the documentations of the SELECT statement.

former_member1716
Active Contributor
0 Kudos

Hello Amit Krishna,

SELECT.. ENDSELECT is Loop which will basically fetch one entry at a time until the last entry is reached. It is considered as a client cursor that will induce a lot of work load on the communication between Application and Database server. It is not a recommended approach as well. You can proceed with the code suggested by Frederic Girod.

Regards!