2007 Jun 08 5:44 AM
Hello Gurus,
What are the different ways to loop at a internal table...I mean if I have to two internal tables then how will i loop
Cheers:Jim
2007 Jun 08 5:49 AM
Hi Jimmy,
There is only one way of looping at internal table. More the number of internal table nested it becomes.
EX:
Loop at itab.
Loop at jtab.
Loop at ktab.
.......
EndLoop.
EndLoop.
EndLoop.
Regards,
Younus
<b>Reward Helpful Answers:-)</b>
Hello Gurus,
What are the different ways to loop at a internal table...I mean if I have to two internal tables then how will i loop
Cheers:Jim
2007 Jun 08 5:49 AM
Hi,
U can use the Loop based on ur Requirement.If there is no relationship between those two Internal Tables,then u can write Seperate Loop Statements.If it is related then u can Write Nested Loops.
Regards,
Padmam.
2007 Jun 08 5:49 AM
Hi Jimmy,
There is only one way of looping at internal table. More the number of internal table nested it becomes.
EX:
Loop at itab.
Loop at jtab.
Loop at ktab.
.......
EndLoop.
EndLoop.
EndLoop.
Regards,
Younus
<b>Reward Helpful Answers:-)</b>
2007 Jun 08 5:50 AM
HI,
you can do like this
loop at itab1.
read table itab2 with key field = itab1-field binary search
or read table itab2 index sy-index.
endloop.
reward points if helpful,
regards,
venkatesh
2007 Jun 08 5:50 AM
Hi.
If u have two tables than
loop at one table into work area and then read second table.like this.
loop at itab1 into wa_itab1.
read table itab2 into wa_itab2
with key < common field in both tables.
append to final table.
clear wa_itab1,wa_itab2.
endloop.
regards,
sudha.
points if useful.
2007 Jun 08 5:53 AM
Hi jimmy,
If you have two internal tables,
you can loop one table and read another table inside the loop.
eg.
loop at it_ekko into w_ekko.
read table it_ekpo into w_ekpo
with key ebeln = w_ekko-ebeln
binary search.
endloop.
regards,
Ruchika
2007 Jun 08 5:56 AM
Hello Jim,
If the tables are related by some fileds,
then you can loop at one while for other table you can put where caluse
on filed to improve performance.
This is demo , both tables must be sorted by vbeln..
Loop at it_vbrk assigning <fs_vbrk>.
loop at it_vbrp assigning <fs_vbrp> where vbeln = <fs_vbrk>-vbeln.
.....
Regards,
Amol C.
*-- Award points if helpful..
2007 Jun 08 6:02 AM
hi,
loop at itab1.
read table itab2 with key field = itab1-field binary search
or
read table itab2 index sy-index.
endloop.
loop at itab1 where itab1-fld = 'fldname'.
read table itab2 with key field = itab1-field binary search
or
read table itab2 index sy-index.
endloop.
reward points if helpful,
regards,
suresh
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |