Application Development 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: 

move vs loop..

Former Member
0 Kudos

Hi Experts,

Data : itab01 LIKE pa0001 occurs 0 with header line.

DATA: BEGIN OF pernr_struc.

DATA: pernr LIKE pa0001-pernr.

DATA: END OF pernr_struc.

DATA: pernr_list LIKE pernr_struc OCCURS 0 WITH HEADER LINE.

A. Move itab01[] to p_list[].

B. Loop at itab01.

APPEND itab01-pernr TO pernr_list.

Endloop.

Can anybody please kindly tell me that which is faster? A or B.

Please...

Thank you..

Sean

Moderator message - Performance tuning is what you do after the program is working - post locked

Edited by: Rob Burbank on Apr 30, 2009 9:00 AM

5 REPLIES 5

former_member242255
Active Contributor
0 Kudos

if your at itab01 and pernr_list are having exactly the same and same no of fields...you can go for 1st option,,,it will be faster..

ThomasZloch
Active Contributor
0 Kudos

Can you not just compare it yourself`? Please let us know the result.

Thomas

0 Kudos

hi, i have tested using SE30 to analyze but due to some cache problem when selecting database, some other issue in my program and unconsistent of system performance i can determine whether which one is faster.

So could any one who know this please help to clarify abit for me.

I'll appreciate alot.

Thank you very much...

Regards,

sean

0 Kudos

Loop at is faster for your case....

Regards,

Siddarth

former_member182566
Active Contributor
0 Kudos

Hi Shum,

In this case it's not a matter of speed: MOVE will not work for you because the tables do not have the same structure (since PA0001 starts with MANDT you'll end up with the client in the first 3 characters of each record in your destination field).

Generally speaking, though, and provided the internal tables have the same structure, MOVing at once will be much faster than LOOPing and APPENDing.

Hope this helps,

Rui Dantas