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: 

Performance Tuning of an ABAP report

Former Member
0 Kudos
153

Dear ABAP experts;

I was required to create a new field in a Z* table and fill those data as its required. However, my ABAP report runs sooo slow and it will take forever for 5 million datas.

I need a performance tuning for this code but I couldnt really figure that out.

Here is my code:

tables: blpk, mseg, zpp_20.


data: itab type table of zpp_20 with header line,

      wa_blpk like blpk.


select-options: s_prtnr for zpp_20-prtnr,

                s_mjahr for zpp_20-mjahr.


parameters p_werks like zpp_20-werks OBLIGATORY.


start-of-selection.


  select * from zpp_20
    into table itab
    where prtnr in s_prtnr
    and   mjahr in s_mjahr
    and   werks eq p_werks.



  loop at itab.                   "I loop itab to fill out the new field that I added.

    select single * from blpk
      into wa_blpk
      where prtnr = itab-prtnr
      and   vaart = 'B'.


    if sy-subrc eq 0.

      select single lgort from mseg
       into itab-alort
       where mblnr = itab-belnr
       and   mjahr = itab-mjahr
       and   matnr = itab-matnr
       and   werks = itab-werks
       and   ( bwart = '131' or bwart = '132' ).


      if sy-subrc eq 0.

        modify itab.

        update zpp_20 set alort = itab-alort where
        belnr  = itab-belnr and
        mjahr  = itab-mjahr and
        matnr  = itab-matnr and
        werks  = itab-werks.

        commit work.

      else.


        continue.


      endif.


    else.


      continue.


    endif.


  endloop.

Moderator Message: Please provide more details viz., SQL trace, Runtime analysis - SE30/SAT - snapshot etc.

Thanks in advance.

Talha

Message was edited by: Suhas Saha

6 REPLIES 6

Former Member
0 Kudos
68

Hi,

Remove your selection inside the loop. Use FOR ALL ENTRIES. Then, use READ TABLE to get those values. Use F1 for help.

Jake.

former_member189849
Contributor
0 Kudos
68

hi

inside loop select statement is performance issue in the place of select query use read table

Please the follow or search the performance issues points search in sdn  some therds are avilable plz follow those

Regards

mahesh

Former Member
0 Kudos
68

Hi Talha,

At this part, avoid select * if you won't use all fields of zpp_20.

" select * from zpp_20
    into table itab
    where prtnr in s_prtnr
    and   mjahr in s_mjahr
    and   werks eq p_werks."

Here, delete loop itab and use for all entries.

loop at itab.                   "I loop itab to fill out the new field that I added.

    select single * from blpk
      into wa_blpk..."

You can also use SAT or se30 in order to trace and optimize your program's performance.

Kind regards.

former_member182040
Active Contributor
0 Kudos
68

yes i agree with

ABAP Performance Standards link:

<link to blocked site removed by moderator>

Message was edited by: Thomas Zloch

former_member189849
Contributor
0 Kudos
68

This message was moderated.

Former Member
0 Kudos
68

This message was moderated.