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

nedd help

Former Member
0 Likes
616

I am using 3 internal tables. First I am fetching the data from itab1 , by using itab1 again I am fetching data into itab2.

I am declaring the itab3 fields whose are contains in both itab1 and itab2. I am populating the data into itab3 by using itab1 and iatb2.

loop at iatb2.

read table itab1 with key …key all fileds…

itab3-filed1= itab1-filed1.

itab3-filed2= itab2-filed2.

endloop.

But it is taking lot of time. Please advice any peformence technique.

regards,

Ajay reddy

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
592

hi Ajay,

do this way

loop at iatb1.
read table itab2 with key …Include all the key fields…
 if sy-subrc = 0. 
  itab3-filed1= itab1-filed1.
  itab3-filed2= itab2-filed2.
  append itab3.
  clear itab3.
 endif.
endloop.

5 REPLIES 5
Read only

Former Member
0 Likes
593

hi Ajay,

do this way

loop at iatb1.
read table itab2 with key …Include all the key fields…
 if sy-subrc = 0. 
  itab3-filed1= itab1-filed1.
  itab3-filed2= itab2-filed2.
  append itab3.
  clear itab3.
 endif.
endloop.

Read only

0 Likes
592

Hi Santhosh,

if i use the same code suggested by you. in debuging mode. time is expired .

if i populate large amount , i am getting the same.

please adivice any .

regards,Ajay reddy

Read only

0 Likes
592

hi,

sort the internal tables with the key fields and use

binary search

statment in the read table statement ...


sort itab1 by <key fields>.
sort itab2 by <key fields>.
loop at iatb1.
read table itab2 with key …Include all the key fields…binary search. 
 if sy-subrc = 0. 
  itab3-filed1= itab1-filed1.
  itab3-filed2= itab2-filed2.
  append itab3.
  clear itab3.
 endif.
endloop.

Read only

0 Likes
592

HI,

Are you sure the this loop is taking time or the select statement taking the time..

check ur select statements

Sort the Tables itab1 and itab2 by the same key..

loop at itab1.

read table itab2 with key 1 , 2 ,3 <b>binary search.</b>

if sy-subrc eq 0.

append itab3.

endif.

endloop.

Read only

Former Member
0 Likes
592

thaq Santhosh and mahesh.

given points .

regards,

Ajay reddy