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

Performence issue ( Nested loop )

Former Member
0 Likes
492

Hi all ,

I have 2 Itables with similar structure( f1,f2,f3,f4 ).

i want to compare the field (f4) of two itables if (f1 ,f2, f3 ) is equal. if (f4) is not same then i should move this to itable c.

Example : itab1

A B C X

c c d X

itab2

A B C Y

A B C Z

c c d X

Finally i have to display it as A B C X

A B C Y

A B C X

A B C Z

__________

I did like this.

***loop at itab1 .

          • loop at itab2 into w_itab

**********where f1 = itab1-f1

****************f2 = itab1-f2

****************f3 = itab1-f3.

********append w_itab to itab3 .

*******endloop. (itab2)

******if sy-subrc eq 0 .

*********loop at itab3 .

************if itab1-f4 NE itab3-f4 .

***************Error-f1 = itab1-f1 .

***************Error-p1 = itab3-f1 .

***************.

***************append Error.

***************endif.

********endloop.(itab3)

        • endif.

**endloop. (itab1)

********

i got the performence issue here . can anybody suggest alternate solution for this.

Thanks.

3 REPLIES 3
Read only

FredericGirod
Active Contributor
0 Likes
470

Press buton "code" to retrieve the structure of the code.

and don't ask two times the same question

thanks

Read only

andreas_mann3
Active Contributor
0 Likes
470

Hi,

use sorted table for itab2

data: itab2 type sorted table of ty_1 with non-unique key f1 f2 f3.

A.

Message was edited by: Andreas Mann

Read only

Former Member
0 Likes
470

Read this:

/people/rob.burbank/blog/2006/02/07/performance-of-nested-loops

Rob