Skip to Content
Author's profile photo Samarjeet Singh

Expensive Custom ABAP Program Analysis — SAP Performance Tuning

   Expensive Custom ABAP Program Analysis

Definition of expensive ABAP Programs


ABAP Programs which have long runtime i.e. high response time, high CPU time, high DB request time, high processing time and large amount of data transfer are typically classified as expensive ABAP Program.


SAP standard programs which are found to be expensive are generally taken care of in OSS notes. The main area of concern that remain unattended are customized ABAP Programs which are developed time to time to meet client requirement.


The aim of this document is to identify and highlight the expensive ABAP codes which would help the ABAP Team in reviewing these expensive codes and develop an efficient and optimized code.


Parameters used to analyze ABAP Programs


The parameter that are used in analyzing expensive ABAP Programs are:


  • Maximum Response Time (msec) – This is the time that it takes to execute the particular ABAP Program.
  • CPU Time (msec) – This is the CPU time that was utilized for execution of the ABAP Program
  • DB Request Time (msec) – This is the Database request time.
  • Processing Time (msec) – This includes CPU, I/O service and wait time.
  • Total Data Transferred (Bytes) – This is the amount of data that is transferred during the execution of the program.
  • Transfer Rate (Records/sec) – No. of records processed per second.
  • Database Row Records – Direct Reads, Sequential Reads, Update, Insert, Delete – No. of records updated, inserted or deleted
  • Processing Time / CPU Time Ratio (%)


Procedure for identifying expensive ABAP Programs


One of the most common methods of identifying expensive ABAP Programs is during its execution from transaction codes SM66 or SM50. Though this method is helpful in identifying the programs which are doing sequential reads or full scan of table, it will provide no additional quantifiable data which will be required for a detailed analysis.


The data is available in Workload Analysis, transaction code ST03N. The ABAP Programs which show high response time in Dialog and Background mode are identified. The high frequency executed programs are important, for the reason that if programs which have multiple executions are optimized would result in considerable reduction of total load on the system, (e.g. a program ZDUMMY runs for 100mins and is executed 20 times in a day, total execution time will be 2000mins.


If this program is optimized to run in 70 mins the total execution time would become 1400 mins a reduction of 600 mins or 10 hrs on system)


                                       

                     Data Collection for expensive ABAP Programs


Data collected from SAP for analysis

pic1.JPG

pic2.JPG

pic3.JPG

pic4.JPG

pic5.JPG

Calculated Data


  • Transfer Rate (Records/sec) – No. of records processed per second

Transfer Rate (Records/sec) = (Dir Read+Seq Read+Update+Delete+Insert) x 1000/DB Request Time (msec)


  • Processing Time / CPU Time Ratio (%)



Analysis of expensive ABAP Programs


  1. High Sequential Reads


When an ABAP Program shows high sequential reads it indicates that the program is doing a scan on the table and is probably not using index. This could be a problem of ABAP coding where the index is not considered or the table does not have a proper index which could be used in the ABAP code.


    2. High DB Request time


For expensive ABAP codes which show high DB request time which is considerably higher than CPU time, the area of concern is database access. This requires analysis of Expensive SQL statements, ‘where clause’ etc.


    3.  High CPU Time


For expensive ABAP codes which show high CPU time which is considerably higher that DB request time, the area of concern is ABAP code. This requires analysis of modules with a high percentage of net time due to numerous calls, internal tables, checking for unnecessary functionality in ABAP codes.


   4.  High DB Request and High CPU Time


For ABAP codes which show both DB request time and CPU time high, then database access and ABAP code both need to be analyzed. Refer section 2 & 3


   5. High Processing Time/CPU Time Ratio


For any optimized ABAP program the Processing time is about twice that of the CPU time. Any value higher than this would mean that the ABAP program is expensive. High processing time could be due to database access, or it could be due to sub-optimal ABAP coding in which program is not executing any database operations for a long period of time.


  6.   Data Transfer rate analysis


If the data transfer rate is high of the order 1000, the reason of ABAP code to be expensive could be that select statement is transferring too much data. If the data transfer rate is low of the order 100, the reason of ABAP code to be expensive could be that select statement is scanning too much data and proper index is not being used, resulting in table scan and sequential reads.



                                                                                ABAP Program Analysis Report


pic6.JPG

                        

The report above gives a detailed analysis of ABAP Program and shows performance of two custom programs in comparison to standard SAP Program RSCOLL00. The key performance indicator for the poor performance of custom programs are indicated as,

  • Response Time
  • CPU Time
  • DB Request Time
  • Processing Time
  • Total Data Transferred
  • Data Transfer rate
  • Direct Reads
  • Sequential Reads
  • Insert, Update and Delete



                                        Tuning Pre-requisite for expensive ABAP Program


Runtime Analysis Report of ABAP Program


All ABAP Programs transported to Production must be thoroughly tested for Quality Control on QA environment before it is transported to Production. Poor performing custom programs are single largest reason for performance issues on Production system.


All programs should have documentation and performance analysis report before being transported to Production. The programs should be appropriately load tested to eliminate any future performance issues, which require considerably high amount of unjustified effort in rework and fixes.


Runtime Analysis Evaluation through SE30:


pic7.JPG


                                                 

                                                                 Performance Tips and Tricks


Performance Tips and Tricks provided in SE30=ABAP Runtime Analysis should be used to optimize ABAP programs



pic8.JPG


Thanks


Will write few more in coming days…

Assigned Tags

      4 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Karl Hearty
      Karl Hearty

      Hi,

      Good blog.

      Would you be able to expand on the ABAP Analysis Report.

      Many Thanks,

      K.

      Author's profile photo Samarjeet Singh
      Samarjeet Singh
      Blog Post Author

      Hi Karl,

      Thanks for your feedback.

      Surely will so the needful regatrding the ABAP Analysis Report.

      Regards

      Samar

      Author's profile photo Former Member
      Former Member

      Hi Samar,

      Nice Blog..!! Keep Going..!!

      Regards,

      Deepthi

      Author's profile photo Member Member
      Member Member

      Hi,

      If there is not any year restriction in the report code still can we find with tracing why some years' data are not coming to the report output?

       

      Have a nice day!