sap web gui login

http://molgaard.consolut.eu/sap/bc/gui/sap/its/webgui

Monday, July 21, 2014

Performance Tuning

Performance TuningIntroductionPurpose
Use
Challenges


   Performance Tuning is nothing but optimizing theperformance of your program through various   techniques thus increasing the productivity of the user.
Purpose
    In this world of SAP programming, ABAP is the universal language . Often due to the pressure of schedules and deliveries, the main focus of making a efficient program takes a back seat. An efficient program is one which delivers the required output to the user in a finite time as per the complexity of the program, rather than hearing the comment “I put the program to run , have my lunch and come back to check the results
Selection Criteria
1.Restrict the data to the selection criteria itself, rather than filtering it out using the ABAP code using CHECK statement. 
2.Select with selection list.
Note: It is suggestible to make at least on field mandatory                             in Selection-Screen as mandatory fields restrict the data selection and hence increasing the performance.
 Points # 1/2
SELECT * FROM SBOOK INTO SBOOK_WA.
  CHECK: SBOOK_WA-CARRID = 'LH' AND
         SBOOK_WA-CONNID = '0400'.
ENDSELECT.
The above code can be much more optimized by the code written below which avoids CHECK, selects with selection list
SELECT  CARRID CONNID FLDATE BOOKID FROM SBOOK
 INTO TABLE T_SBOOK
  WHERE SBOOK_WA-CARRID = 'LH' AND
              SBOOK_WA-CONNID = '0400'.
1.Avoid nested selects

2.Select all the records in a single 

shot using into table clause of 
select statement rather than to use 
Append statements.



3.When a base table has multiple
 indices, the where clause 
should be in the order of the index,
 either a primary or a secondary index.

4.For testing existence , use Select.
. Up to 1 rows statement instead of 
a Select-Endselect-loop with an Exit.  

5.Use Select Single if all primary key fields are supplied in the Where condition .

Point # 1
SELECT * FROM EKKO INTO EKKO_WA.
  SELECT * FROM EKAN INTO EKAN_WA
      WHERE EBELN = EKKO_WA-EBELN.
  ENDSELECT.
ENDSELECT.
The above code can be much more optimized by the code written below.
SELECT P~F1 P~F2 F~F3 F~F4 INTO TABLE ITAB
    FROM EKKO AS P INNER JOIN EKAN AS F
      ON P~EBELN = F~EBELN.
Note: A simple SELECT loop is a single database access whose result is passed to the ABAP program line by line. Nested SELECT loops mean that the number of accesses in the inner loop is multiplied by the number of accesses in the outer loop. One should therefore use nested SELECT loops  only if the selection in the outer loop contains very few lines or the outer loop is a SELECT SINGLE statement.
Point # 2
SELECT * FROM SBOOK INTO SBOOK_WA.
  CHECK: SBOOK_WA-CARRID = 'LH' AND
         SBOOK_WA-CONNID = '0400'.
ENDSELECT.
The above code can be much more optimized by the code written below which avoids CHECK, selects with selection list and puts the data in one shot using into table
SELECT  CARRID CONNID FLDATE BOOKID FROM SBOOK INTO TABLE T_SBOOK
  WHERE SBOOK_WA-CARRID = 'LH' AND
              SBOOK_WA-CONNID = '0400'.
   
Point # 3
To choose an index, the optimizer checks the field names specified in the where clause and then uses an index that has the same order of the fields . In certain scenarios, it is advisable to check whether a new index can speed up the performance of a program. This will come handy in programs that access data from the finance tables.
Point # 4
SELECT * FROM SBOOK INTO SBOOK_WA
  UP TO 1 ROWS
  WHERE CARRID = 'LH'.
ENDSELECT.
The above code is more optimized as compared to the code mentioned below for testing existence of a record.
SELECT * FROM SBOOK INTO SBOOK_WA
    WHERE CARRID = 'LH'.
  EXIT.
ENDSELECT.
Point # 5
If all primary key fields are supplied in the Where condition you can even use Select Single.
Select Single requires one communication with the database system, whereas Select-Endselect needs two. 

0 comments:

Post a Comment