‎2008 Dec 24 7:55 AM
Hi Experts,
1) Are Nested LOOPS acceptable in coding? if Yes, How much extent ?
2) in LOOP...ENDLOOP, Can we use Select Single Statements?
3) If we can use appox. 6 nested loops how much performance was affected?
4) In LOOP..ENDLOOP.... Can we use MOVE-CORRESPONDING statements
‎2008 Dec 24 8:14 AM
Hi Siva,
Here are the replies.
1) Nested loops are not accepted in the coding by if you are not able to get hte solution then you need to put one loop inside other but this is also a bad coding.
2) Yes you can use select single inside loop endloop. but the good practice is fetch all the data from the tables and use the Read statement instead of Select single.
3) Dude performance will be degraded in 2 nested loops . and you are using 6 nested loops then the system will go down with the performance.
4) MOVE-CORRESPONDING is not a good practice instead of this you can directly assign the field name value.
Thanks,
Chidanand
‎2008 Dec 24 7:56 AM
‎2008 Dec 24 8:01 AM
HI Krishna,
This is not in interview questions..
I need to done Code walk through for program. He developed the program in that fashion.. Now i need to give the report.
‎2008 Dec 24 8:15 AM
Hi Siva,
All that you have written are usually best avioded in any report which can have loads of data to process.
But even then at times it may be unavoidab;e to use such loops.
My personal experience has been that at times loads of read table cost more than select singles.
Try and run the report in SE30 and you will have a fairly good idea to suggest changes if need be.
Regards,
‎2008 Dec 24 8:14 AM
Hi Siva,
Here are the replies.
1) Nested loops are not accepted in the coding by if you are not able to get hte solution then you need to put one loop inside other but this is also a bad coding.
2) Yes you can use select single inside loop endloop. but the good practice is fetch all the data from the tables and use the Read statement instead of Select single.
3) Dude performance will be degraded in 2 nested loops . and you are using 6 nested loops then the system will go down with the performance.
4) MOVE-CORRESPONDING is not a good practice instead of this you can directly assign the field name value.
Thanks,
Chidanand
‎2008 Dec 24 8:23 AM
1) Are Nested LOOPS acceptable in coding? if Yes, How much extent
ans yes but performance point of view in decrease performance.
2) in LOOP...ENDLOOP, Can we use Select Single Statements?
Ans Genelly we not use select statement within the loop. it increas the time of execution
3) If we can use appox. 6 nested loops how much performance was affected?
yes: but it decrease the performance of program.
4) In LOOP..ENDLOOP.... Can we use MOVE-CORRESPONDING statements
ans yes but move is better than move-correspondoin.
‎2008 Dec 24 8:50 AM
1) Nested loops are not accepted in the coding by if you are not able to get hte solution then you need to put one loop inside other but this is also a bad coding. You can use but performance point of view in decrease performance
2) Yes you can use select single inside loop endloop. but the good practice is retrieve all the data from the database tables and use the Read statement instead of Select single.
Genelly we not use select statement within the loop. it increase the time of execution.
3) If you use 2 nested loops, it will decrease the performance and you are using 6 nested loops then the system will go down with the performance.
4) MOVE-CORRESPONDING is not a good practice instead of this you can directly assign the field name value or but move is better than move-correspondoing.
‎2008 Dec 24 10:08 AM
Hi,
If you use Nested loops you will face performance issues. But no restriction.
Use read statement in loops inted of select single.
Declare filed symbols and use intend of MOVE-CORRESPONDING.
Regards
Durga
‎2008 Dec 24 10:08 AM
Hi,
1) Nested loops are not acceptable in coding.
But use that only if you have no other option but to use it.
2) In loop and endloop you can use select statement.
But this degrades the performance in a great way.
Try to fetch data in advance in an internal table and then read that internal table inside of the loop statement.
3)Only 2 loop statement is enough for performance degradation. 6 loops are a big deal.
The rate of performance degradation depends upon the amount of selected data.
If in the first statement it is looping for 50 times and in second for 60 times,
then total looping will be forr 50*60 = 3000 times.
So you can think.
4)In lopp-endloop move corresponding can be used, but better is to avoid them.
Try to assign directly and then append to an internal table.
Thanks & regards
Jayati
‎2008 Dec 24 10:19 AM