Documente Academic
Documente Profesional
Documente Cultură
Normally in every project after the developer completes a development he fills the review check list and does some performance tests before sending it for lead review. The basic check list template is attached at the end. 1. Extended Program Check / SLIN Test. After development the developer does a syntax check and after that the very first test he/she executes is the SLIN Test. Display the program and from Program follow the path as follows.
By Debesh
Page 1
After achieving zero errors/messages/warnings go to Code Inspector check from the same path. 2. Code Inspector Check It does a static analysis before we run the program and reports potential performance issues. Although it does not provide any relevant information about the code during runtime but still it checks for certain coding standards like : In where clause all key fields are used or not, and whether sy-subrc check is used after database statements or not.
By Debesh
Page 2
Try to remove all errors and warnings .Expand the section , double click the item , it will take you to the code and take proper action.
To improve the performance and quality of code, SAP has provided some Performance Analysis tools. They are mentioned below. 3. Run time analysis (transaction SE30) It is used by the developer to calculate or evaluate the quality of the code to achieve the business requirement. It ensures the performance of program on Production server. Execution time for the code Evaluation of the 3 main areas: ABAP Database System Go To Transaction SE30 and provide the program name and execute.
By Debesh
Page 3
It will display a message for run time analysis completion. Click on evaluate.
By Debesh
Page 4
It will display the time spend on application server level and data base level. System and Data base section should be small. Go to Hit List.
The Hit list summarizes the measurements of execution and processing times into one entry per operation. Filter Hit List.
Choose from the available options for which the analysis is important.
By Debesh
Page 5
Now check in which statements more time is being spent and go back to code and check whether these code can be made more efficient or not.
From the main run time analysis menu you can go to tips & tricks.
There you can check how same staments written in two different ways can change the run time significantly. Choose any option and comapare and measure the runtime.
By Debesh
Page 6
4. SQL Trace (ST05). It accesses the DDIC compenents to check SQL statement performances, Locking activities, Remote calls etc. Go to transaction ST05. Make trace on.
By Debesh
Page 7
By Debesh
Page 8
It shows the sequence of database operations that are taking place while a query is processed. It includes prepare, fetch, open, reopen, execute.
By Debesh
Page 9
There are certain other tools like New Version of Runtime Analysis tool (Transaction SAT), ST12 (SQL trace, ABAP Trace, Enqueue, RFC all at one place ), STAD etc. Certain Recommended Coding Standards: 1. Properly document each development with Developer name and change history. 2. Follow certain naming conventions (like local variaable lv_name, global variable gv_name, woel area ls_name , constants c_name and so on). 3. Remove dead codes. 4. When possible use MOVE instead of MOVE-CORRESPONDING . 5. Code executed more than once should be placed in a form routine. 6. Use SORT and READ TABLE t_tab WITH KEY ... BINARY SEARCH when possible . 7. Use all key fields for Select Single else use Select up to one row. 8. Do a table is empty or not check before For all entries addition. 9. Views (inner join) are a fast way to access information from multiple tables. Use subqueries when possible. 10. Where clause should be in order of index See example. Where clause should contain key fields in an appropriate db index or buffered tables. 11. Avoid nested SELECTs (SELECT...ENDSELECT within another SELECT...ENDSELECT). 12. Use CASE statement instead of IF...ELSEIF when possible (It is only possible in equality tests).
By Debesh
Page 10
Description Run Extended syntax checks with character literals checkbox switched on & Code Inspector to rectify all relevant errors and warning (e.g. Use the results of the above checks to remove all variables/constants etc that are declared but are not used) Transaction SE30 (ABAP Runtime Analysis) must be checked to measure/compare program performance/runtime if program has multiple inefficient databases selects or complicated internal table operations Use transaction ST05 (SQL Trace) to see what indices your database accesses are using. Check these indices against your where clause to assure they are significant. Check other indices for this table and where you have to change your where clause to use it. Create new indices if necessary, but do not forget to check the impact by consulting onsite coordinator. TYPE (data element) command is used while declaring the fields whenever feasible instead of LIKE. Remember not always the data element name matches with the table field name Internal Table is defined with TYPE STANDARD TABLE OF & Work-Areas is used instead of header lines Global variables are minimized by declaring local variables or by passing variables through parameters & arguments while creating internal subroutine(s) In SELECT statement, only the required fields are selected in the same order as they reside on the database table/structure/view For selecting single row from a database table, SELECT UP to 1 Rows is used. Select Single is used only when full primary key combination is known No SELECT * is used Use SELECT INTO TABLE rather than SELECT INTO CORRESPONDING FIELDS OF TABLE Always specify as many primary keys as possible in WHERE clause to make the Select efficient Always select into an internal table, except when the table will be very large (i.e., when the internal table will be greater than 500,000 records). Use Up to N Rows when the number of records needed is known Select statement within a GET event is not used Wild cards like A% is avoided as much as possible Nested Select is not used instead Inner Join and/or For all Entries is used. For all Entries is to be used over Loop at ITAB / Select / ENDLOOP (FOR ALL ENTRIES retrieves a unique result set so ensure you retrieve the full key from the database)
Comments
By Debesh
Page 11
By Debesh
Page 12
Try to avoid logical databases. If your program uses a logical database, but does not require all fields belonging to a certain GET event, always use the FIELDS addition to reduce the amount of data selected by the logical database Avoid the aggregate (Count, Max, Min) functions in the database selection Use Parallel Cursor methods for nested loop into the internal tables if second internal table contains considerable number of records In Smartform/ Sapscript do not make redundant data retrieval where data is available in interface Check List(2) Description Title The title is a concise description Type The type of program is specified correctly Status: Result Comment
By Debesh
Page 13
'K' Custom-developed program for production 'T' Test Program 'S' System Program Application The application area should relate back to Character Module Identification he program name.
Development Class The appropriate development class has Name Space The appropriate namespace has been used Documentation: Documentation Block: Must contain: been used
Description: Detailed description Created By: Developers name Created On: Date Program Documentation for FM The Online Program Documentation provides functional leads and end users with necessary information to determine report functionality. It also contains information on file inputs and outputs Code Comments
By Debesh
Page 14
By Debesh
Page 15
By Debesh
Page 16
Fields compared in the WHERE clause of SELECT statements have similar types The use of negative logic in SELECTs is avoided whenever possible When using the AND or OR operator the most likely elimination criteria is specified first. (Expressions are evaluated left to right and the evaluation ends when the final result has been established) Primary Key Used Whenever possible, the full table key is specified and SELECT SINGLE is specified
By Debesh
Page 17
A secondary index has been considered if: does not exist are repeatedly used to make selections Only a small part of a large table is selected (<5%) The WHERE condition of the SELECT is simple Fields that make up the index significantly reduce the selection set of the records by matching the unique qualifiers in the WHERE clause Note: prior to creating secondary indexes, consultation with the database administrator is required Nested SELECTS or Loops Nested selects and loops are avoided through the of dictionary VIEW or by using FOR ALL ENTRIES appendage to the SELECT statement For all Entries Make sure table that you are selecting on for all entries is populated. If not, you will select every record from the table which is not efficient. Column Selection SELECT statements only query the necessary columns from a table. SELECT * is only used when more than one-third of the columns are being used UP TO N ROWS: When a full key is unknown and only one record is needed, the UP TO 1 ROWS appendage is added to the use
By Debesh
Page 18
Preferred: SELECT FIELD1 FROM TABLE UP TO 1 ROWS. ENDSELECT. Avoid: SELECT FIELD1 FROM TABLE. EXIT. ENDSELECT. Sorting SORT ITAB ORDER BY preferred over SORT ITAB Delete Adjacent Duplicates SORT the internal table according to ALL the fields that you want to compare when looking for duplicates before using delete adjacent duplicates. Aggregates When finding aggregates such as maximum, minimum sum, average, and count, a SELECT list with the aggregate function is used instead of programming the code. Internal Tables Nested Loops Nested loops are avoided. If unavoidable, take advantage of parallel cursor technique Unnecessary MOVEs are avoided by using explicit Work Areas Reading:
By Debesh
Page 19
REFRESH REFRESH table is used to initialize table records FREE The FREE command is used to release the memory allocated to internal tables when the program is finished processing the data in the table and when the following conditions exist:
The internal table is large The internal table is sorted and reprocessed several
times
By Debesh
Page 20
By Debesh
Page 21
MOVE CORRESPONDING: MOVE CORRESPONDING is only used for small tables or tables where most, but not all, fields need to be moved. Try to avoid using INTO CORRESPONDING FIELDS OF TABLE. Instead use INTO TABLE.
When all fields need to be moved and the attributes for every field and position are identical, the table is MOVEed as a group.
By Debesh
Page 22