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

loop at itab

Former Member
0 Likes
934

Hi experts,

Iam selecting data from 10 tables and putting into itab.

I have filtered lot of data from this itab and got required data.

Then i want to select the the data from itab by parameters.I want to know is it correct way....!Or is there any way to approach.

code something like this.



  loop at t_equp where vkbur = <b>p_vkbur</b> and
                      kunum = <b>p_kunum</b> and
                      exp_mth_name = <b>p_month</b> and
                      kdgrp = <b>p_kdgrp.</b>

    doing something
  endloop.

8 REPLIES 8
Read only

Former Member
0 Likes
875

Hi kaki,

1. Perfectly all right.

regards,

amit m.

Read only

Former Member
0 Likes
875

HI kakki

Ya it is correct. you can do it.

regards

kishore

Read only

Former Member
0 Likes
875

Hi,

1. Always try to restrict yout data while Select itself.

It will reduse the hits of DB.

In your case I think you selected all the records from DB and later you are restricting them. Why dont you do this at Select itself.

Thanks.

If this helps you reward with points.

Message was edited by: KDeepak

Read only

Former Member
0 Likes
875

Hi Kaki,

are all these are parameters or is there any select option.

 loop at t_equp where vkbur = p_vkbur and
                           kunum = p_kunum and  
                           exp_mth_name = p_month and
                           kdgrp = p_kdgrp.  

   "doing something 
 endloop.

regards

vijay

Read only

Former Member
0 Likes
875

Hi Kaki,

It is syntactically correct but it is not the right way to get the data which increases the burden on the database b'coz u r selecting the total data and later u start filtering instead of this just use the condition in the select statement itself.

regards,

<b>Sri</b>.

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
875

Hi,

SInce you are selecting the t_equp data from 10 tables, I hope the vkbur,kunum,exp_mth_name and kdgrp will exist in some tables.

So it is always better,if you are restricitng while selecting from database itself.

For ex..

select * from db1 into itab1 where vkbur = p_vkbur.

select * from db2 into itab2 where kunum = p_kunum.

Then after you do some manipulations,you will populate t_equp which will have only the restricted value.

Read only

Former Member
0 Likes
875

Nothing wrong in writing like this.

But If U have already selected data from SELECTS based

on the parameters then this is not required.

Better to filter the data at the SELECT statement only.

Read only

Former Member
0 Likes
875

You can do it this way, but it would be far more efficient to do a binary search.

Rob