‎2014 Sep 08 4:14 PM
Hello guys, i just started learning ABAP so i made this 2 programms which are displaying information from the sflight table after asking for a
parameter. The both achieve the same task, but there must be a difference. Maybe in performance? Thanks verry much.
Program nr.1 :
REPORT ZTABLE7.
types: BEGIN OF ZPFLI_STRUCTURE,
carrid TYPE spfli-carrid,
cityfrom type spfli-cityfrom.
types end of ZPFLI_STRUCTURE.
data: lt_join type table of ZPFLI_STRUCTURE,
wa_join like line of lt_join.
parameters: p_par type ZPFLI_STRUCTURE-CARRID.
select * from spfli into corresponding fields of table lt_join.
loop at lt_join into wa_join.
new-line.
if p_par = wa_join-carrid.
write:
wa_join-cityfrom.
endif.
endloop.
Program nr.2:
REPORT ZTABLE
parameters p_carrid type sflight-carrid.
data fly type spfli.
select * from spfli into fly
where carrid = p_carrid.
new-line.
write: fly-cityfrom, fly-cityto.
endselect.
‎2014 Sep 08 6:49 PM
Exactly, the big difference between these code is the performance, in the first one you are selecting all records of table (this obviously is a really bad behavior ) and after you've created a logic to find out which record of internal table the program is going to show for user..
The second, you're selecting using a clausule where and passing an especific value.
If you want to analise this before you transport to production enviroment, using transactions like ST12, SE30, ST05 or STAD and if you want to learn more about, search for the topic openSQL.
Regards,
Janderson Livio
‎2014 Sep 08 6:45 PM
Hi Andrei,
have a look in this Wiki:
ABAP Performance and Tuning - ABAP Development - SCN Wiki
If you want to learn more about it, there is a lot good content out there.
So if you don't know how to discover it, here is a second link for you:
~Florian
‎2014 Sep 08 6:49 PM
Exactly, the big difference between these code is the performance, in the first one you are selecting all records of table (this obviously is a really bad behavior ) and after you've created a logic to find out which record of internal table the program is going to show for user..
The second, you're selecting using a clausule where and passing an especific value.
If you want to analise this before you transport to production enviroment, using transactions like ST12, SE30, ST05 or STAD and if you want to learn more about, search for the topic openSQL.
Regards,
Janderson Livio