Skip to Content
avatar image
Former Member

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Sep 08, 2014 at 05: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.


    Janderson Livio

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 08, 2014 at 05: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:

    How to use SCN search


    Add comment
    10|10000 characters needed characters exceeded