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

Former Member
0 Likes
757

HI...

Is there any problem if in put the select statement in loop like this.

loop at itab.

select * from .......

endloop.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
734

Hi,

This would delay the programming time. It would take more time for the execution of the logic. so it is always better to avoid Select within a loop.

<b>Reward points if this helps,</b>

Kiran

6 REPLIES 6
Read only

Former Member
0 Likes
734

Hi,

We can't use Select for the Internal Tables.

Regards,

Padmam.

Read only

Former Member
0 Likes
734

hi,

We can display the data only by writing in the loop.

We cannot retrieve the data inside the loop because it gets repeated.

Read only

Former Member
0 Likes
735

Hi,

This would delay the programming time. It would take more time for the execution of the logic. so it is always better to avoid Select within a loop.

<b>Reward points if this helps,</b>

Kiran

Read only

Former Member
0 Likes
734

Hi,

It is possible to do this

loop at itab.

select * from ekpo into table another_itab.

endloop.

But this will give you performance problem as you select from database as many as the loop operation.

Read only

Former Member
0 Likes
734

performance will not be good else you can use select * from dbtab inside the loop.

better to use for all entrines and then read the int table inside the loop.

for e.g.

select f1 f2 from dbtab into table itab1 for all entries in itab where....

loop at itab.

read table itab1 with key f1 = itab-f1.

if sy-subrc = 0.

<access itab1-f2...>

endif.

endloop.

regards

shiba dutta

Read only

Former Member
0 Likes
734

Hi,

That will take more time to execute.we have to avoid select query in loops.

so you can use for all entries instead of writing a select query in the loop.

Thanks & Regards,

CS Reddy.