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

Performance issue

vinod_vemuru2
Active Contributor
0 Likes
512

Hi All,

I ahve doubt regarding Where clause in LOOP.

Which one will give better performance.

1. LOOP AT i_tab INTO wa_tab WHERE ......conditions

..Processing.

ENDLOOP.

2. LOOP AT i_tab INTO wa_tab.

IF conditions

..Processing.

ENDIF.

ENDLOOP.

Is it depends on total number of records/no of records that satisfy where clause in any way?

Regards,

Vinod.

5 REPLIES 5
Read only

Former Member
0 Likes
496

Hi,

LOOP AT i_tab INTO wa_tab WHERE ......conditions

..Processing.

ENDLOOP.

is the best way at any time.

it doesn't depend on the number of records.

rgds,

bharat.

Read only

former_member404244
Active Contributor
0 Likes
496

Hi,

This will give better performance..

1. LOOP AT i_tab INTO wa_tab WHERE ......conditions

..Processing.

ENDLOOP.

Regards,

Nagaraj

Read only

Former Member
0 Likes
496

hi

the first option would be better,

at the begining of the loop only, all the not required rows are removed.

always prefer the 1st option for performance issue.

Regards,

Prasant

*reward if useful

Read only

former_member196517
Contributor
0 Likes
496

Hi Vinod,

actually it depends on the indexing of the table, if indexing is well defined than first will be better else both are nearly same..

Regards

Anuj

Read only

vinod_vemuru2
Active Contributor
0 Likes
496

Thanks u all