Application Development and Automation 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: 
Read only

Performance Issue - How to improve the code?

Former Member
0 Likes
642

Dear all,

I am quite new in the ABAP world and start to play around a bit in the SAP Netweaver ABAP Trail version. I did a first ABAP program which I analysed with with Transaction code SE30 as suggested in the ABAP tutorials for beginners. The outcome is that 70% of processing time are spent for ABAP where I guess it is particularly the query which causes that issue.

-


> Query <------


FORM get_flights_from_to.

  SELECT
  p~connid s~fldate p~carrid p~cityfrom p~cityto p~deptime
    p~arrtime p~fltime
  INTO CORRESPONDING FIELDS OF TABLE connect_report_tab
  FROM spfli AS p
    LEFT OUTER JOIN sflight AS s ON p~carrid = s~carrid
      WHERE p~cityfrom = p_from
        AND p~cityto = p_to.

  IF sy-subrc <> 0.
    MESSAGE e007(sabapdocu).
  ENDIF.
ENDFORM.      "get flights from to

<------ Query -


>

To output the result of that query I am using the ALV class as below:

-


> ALV <------


FORM show_result_from_to.
  TRY.
      cl_salv_table=>factory(
        IMPORTING r_salv_table = connect_report_alv
        CHANGING  t_table = connect_report_tab ).
      connect_report_alv->display( ).

    CATCH cx_salv_msg.
      MESSAGE 'ALV display not possible' TYPE 'I'
              DISPLAY LIKE 'E'.
  ENDTRY.
ENDFORM.                    "show_result_from_to

<------ ALV -


>

My question is actually where is the potential bottle neck in the code?

From my point of view it would be the join but if so then what other possibilities do I have to avoid that performance issue?

What I want to simulate with that table is that I can get an overview of possible flights between 2 cities from table SPFLI and the date of these flights from Table SFLIGHT.

Thank you very much for your help and advice,

Bernd.

Edited by: Bernd Mueller on Mar 9, 2009 5:46 AM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
585

HI,

If ABAP processing is more it means work load is more on Application server for the program.

Select Query only affects database....

They Only issue of performance comes into picture when you retrieve data from Database Server..

But your select query Seams to use database 30%. That's Fine...

Make sure when ever your write report Database load is less.

Joins have some performance issue.You can create a database View and query it in the report that will increase the performance Beacuse Views can be buffered at Application server.

Regards,

Gurpreet

5 REPLIES 5
Read only

Former Member
0 Likes
586

HI,

If ABAP processing is more it means work load is more on Application server for the program.

Select Query only affects database....

They Only issue of performance comes into picture when you retrieve data from Database Server..

But your select query Seams to use database 30%. That's Fine...

Make sure when ever your write report Database load is less.

Joins have some performance issue.You can create a database View and query it in the report that will increase the performance Beacuse Views can be buffered at Application server.

Regards,

Gurpreet

Read only

Former Member
0 Likes
585

I don't think that I will optimize the sflight model ... maybe it is o.k.

Better read this blog, it tells you the 70% ABAP means nothing

SE30

/people/siegfried.boes/blog/2007/11/13/the-abap-runtime-trace-se30--quick-and-easy

Siegfried

Read only

0 Likes
585

Hi,

70% ABAP means nothing

Well I believe it depends on the context of the issue. In the issue described above, I believe it to be fine. But if you have a huge internal tables with rows > 10000 and you use nested loops for some processing. You will still get a larger percentage on ABAP; but then it is a performance issue.

Read only

Former Member
0 Likes
585

performance issues do not relate to percentages, the absolute numbers count !

Percentages are interesting in the hitlist to find the main contributions to a problem.

Read only

Former Member
0 Likes
585

Hi:

Remove CORRESPONDING FIELDS.

Declare the type containing the required fields and make it as internal table and then use it.

Regards

Shashi