Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

What is the difference between this 2 programms?

     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.
                                           if p_par = wa_join-carrid.

                                                                                            Program nr.2:


                                            REPORT  ZTABLE

                parameters p_carrid type sflight-carrid.
                data fly type spfli.

              select * from spfli into fly
              where carrid = p_carrid.
              write: fly-cityfrom, fly-cityto.

Former Member

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.


Janderson Livio

0 View this answer in context

Helpful Answer

Not what you were looking for? View more on this topic or Ask a question