Parallel Cursor Method in SAP ABAP

alan9187 / Pixabay
ABAP Development Using Parallel Cursor Method
Performance is a very important point in program building. ABAP include, with each new version released, improved sentences for data base accessing, new kinds of internal tables… everything dedicated to get a better performance in the code built. There is a lot of investigation to be done as it is a complex and extremely wide area.
Although it is not always easy to have an adequate development environment to carry out acceptable volume test (as in real productive systems) that would help identify performance issues in the programs, there are some tools in the SAP Workbench that can be used to optimize the programs that are going to be delivered, mainly focused on database accessing. It is very important to analyze the SQL sentences to ensure the ones being used are the right ones. SAP provides with two powerful tools, such as the Runtime analysis (SE30) and the SQL Trace (ST05). They show how open SQL statements are converted into native SQL statements, measure database accesses and help to improve program performance. The correct use of the FOR ALL ENTRIES clause, the optimization in the selection of fields on SELECT clause and in the WHERE clause restriction, the use of indexes when accessing data… These are some of the important points that have to be taken into account. However, the ABAP program will handle and process the data after it is retrieved from the database. This is an important area that should not be forgotten when optimizing programs performance.
Parallel Cursor Program in SAP ABAP
This will explains the parallel cursor method (PCM), a method that can be used to improve the programs performance in this second important point, when handling header and position records together. This is explained with a real life example, comparing the results obtained with two different versions of source code, one with the traditional data handling and one applying the method. The white paper also gives technical instructions to apply the method in the special case when the tables have a different key.
Sequential Method
Get the starting Run time.
Loop the header internal table. Inside the master loop, item data will be looped and if any item data found, both the header and item data will be moved to another internal table.
Get the Ending Run Time.
The difference in End and Start run time is the actual time taken for sequential search.
SORT |
Parallel Method
Sort the header and item internal table.
Get the starting Run time.
Loop the header internal table. Inside the master loop, Item data will be looped by checking the index.
If the key field of item data is greater than the key field of header data, then there is no item data is found and exit from the detail loop.
If item data is equal to the key field of header data, move the header and item data to another internal table. Store the index of the item data. And continue the process.
Get the Ending Run Time.
The difference in End and Start run time is the actual time taken for Parallel Cursor.
SORT |
good advice
THE CONTENT IN THE DOCUMENT IS NOT CLEAR AS EXPECTED.
EVERY ONE SHOULD FOLLOW THIS METHOD WHEN CODING