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

Regarding loop and nested loop

Former Member
0 Likes
715

Dear experts,

i have four ztables and i have maintanig relation b/w four tables

table1 (Comp table key field is srno) and

table2 (projects table key field psno and relation field is srno)

table3 (jobs table key jsno and relation fields srno and psno)

table4( equipment table key esno and relation fields srno,psno,jsno)

actually i'm developing report for these tables

please tell me how can i maintain loops for this report please help me i tryed in diff ways but i'm gettin problem with clear data and append data please tell me d sol otherwise i will send detailed info

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
690

>

> Dear experts,

> i have four ztables and i have maintanig relation b/w four tables

> table1 (Comp table key field is srno) and

> table2 (projects table key field psno and relation field is srno)

> table3 (jobs table key jsno and relation fields srno and psno)

> table4( equipment table key esno and relation fields srno,psno,jsno)

> actually i'm developing report for these tables

> please tell me how can i maintain loops for this report please help me i tryed in diff ways but i'm gettin problem with clear data and append data please tell me d sol otherwise i will send detailed info

hi,

you are getting data from four database tables

so its best method to declare internal tables for all the four tables.

then you have to code selecet statements for four tables.

select * from table1 into table itab where f1 = field1.

select * from table2 into table jtab where f2 = field2.

select * from table3 into table ktab where f3 = field3.

select * from table4 into table ltab where f4 = field4.

now code loop statement.

loop at ltab.

read table itab with key f1 = field1.

read table jtab with key f2 = field2.

read table ktab with key f3 = field3.

read table ltab with key f4 = field4.

endloop.

this is the best method to avoid multiple loop statements.

Regards,

swaminat.

5 REPLIES 5
Read only

Former Member
0 Likes
691

>

> Dear experts,

> i have four ztables and i have maintanig relation b/w four tables

> table1 (Comp table key field is srno) and

> table2 (projects table key field psno and relation field is srno)

> table3 (jobs table key jsno and relation fields srno and psno)

> table4( equipment table key esno and relation fields srno,psno,jsno)

> actually i'm developing report for these tables

> please tell me how can i maintain loops for this report please help me i tryed in diff ways but i'm gettin problem with clear data and append data please tell me d sol otherwise i will send detailed info

hi,

you are getting data from four database tables

so its best method to declare internal tables for all the four tables.

then you have to code selecet statements for four tables.

select * from table1 into table itab where f1 = field1.

select * from table2 into table jtab where f2 = field2.

select * from table3 into table ktab where f3 = field3.

select * from table4 into table ltab where f4 = field4.

now code loop statement.

loop at ltab.

read table itab with key f1 = field1.

read table jtab with key f2 = field2.

read table ktab with key f3 = field3.

read table ltab with key f4 = field4.

endloop.

this is the best method to avoid multiple loop statements.

Regards,

swaminat.

Read only

0 Likes
690

please give me ur mail id i will send u the code then suggest me the best way

Read only

0 Likes
690

Please see:

[The Performance of Nested Loops|/people/rob.burbank/blog/2006/02/07/performance-of-nested-loops]

Rob

Read only

Former Member
0 Likes
690

Seems to be no easy problem, because you would need a

several keys for the internal tables which is not (yet) possible.

Be aware, that an internal table does not have a key automatically, you can define the key.

Check which tables will be largest. How many lines do you expect for your tables? Define the most useful keys starting with the largest tables.

Siegfried

Read only

Former Member
0 Likes
690

The best solution is to use JOINS in your select query and get all the required fields baluein a single Internal Table.

Regards

Sonal