0% found this document useful (0 votes)
53 views

Performance Tuning Using Parallel Curso1

The document discusses using parallel cursors to improve the performance of nested loops in ABAP. It provides an example of a normal nested loop that takes a long time to execute due to the large number of table entries. The solution shown is to use a parallel cursor, which sorts the tables by a common field and only loops through matching records, significantly reducing the runtime. Test results show the parallel cursor method completes in under 100,000 microseconds while the normal nested loop takes over 34,000,000 microseconds.

Uploaded by

Vaibhav Sambare
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views

Performance Tuning Using Parallel Curso1

The document discusses using parallel cursors to improve the performance of nested loops in ABAP. It provides an example of a normal nested loop that takes a long time to execute due to the large number of table entries. The solution shown is to use a parallel cursor, which sorts the tables by a common field and only loops through matching records, significantly reducing the runtime. Test results show the parallel cursor method completes in under 100,000 microseconds while the normal nested loop takes over 34,000,000 microseconds.

Uploaded by

Vaibhav Sambare
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Performance Tuning using Parallel Cursor

Nested Loops This is one of the fear factors for all the ABAP developers as this consumes lot of program execution time. If the number of entries in the internal tables is huge, then the situation would be too worse. The solution for this is to use parallel cursor method whenever there is a need for Nested Loop. Program using Normal Nested Loop: REPORT TABLES: likp, lips. Data: t_likp t_lips type table of likp, type TABLE OF lips. ZNORMAL_NESTEDLOOP.

data: W_RUNTIME1 TYPE I, W_RUNTIME2 TYPE I. START-OF-SELECTION. select * from likp into table t_likp. select * from lips into table t_lips. get RUN TIME FIELD w_runtime1. loop at t_likp into likp. loop at t_lips into lips where vbeln eq likp-vbeln. endloop. endloop. get RUN TIME FIELD w_runtime2. w_runtime2 = w_runtime2 - w_runtime1. write w_runtime2. Nested Loop using Parallel Cursor: REPORT TABLES: likp, lips. DATA: t_likp TYPE TABLE OF likp, zparallel_cursor2.

t_lips

TYPE TABLE OF lips.

DATA: w_runtime1 TYPE i, w_runtime2 TYPE i, w_index LIKE sy-index. START-OF-SELECTION. SELECT * FROM likp INTO TABLE t_likp. SELECT * FROM lips INTO TABLE t_lips. GET RUN TIME FIELD w_runtime1. SORT t_likp BY vbeln. SORT t_lips BY vbeln. LOOP AT t_likp INTO likp. LOOP AT t_lips INTO lips FROM w_index. IF likp-vbeln NE lips-vbeln. w_index = sy-tabix. EXIT. ENDIF. ENDLOOP. ENDLOOP. GET RUN TIME FIELD w_runtime2. w_runtime2 = w_runtime2 - w_runtime1. WRITE w_runtime2. Analysis report: Runtime in microseconds: Iteration No 1 2 3 Normal Nested Loop 34,796,147 38,534,583 34,103,426 Using Parallel Cursor 63,829 56,894 50,510

You might also like