SAP programmers have to use many performance tuning methods in order to get quick output from the system, using parallel cursor is one of those techniques used by programmers to handle huge data. The data stored in SAP systems is in one centralized database which makes it bulky and record searching a time consuming job, if traditional methods are applied they may result in wastage of lot of time in data loading which may even turn out to be a painful experience for the end users.
Use of nested loops is everyday task of any programmer to access related data of one master file from transaction file. This method is good and output is accurate all the time but if data runs in millions and is increasing day by day then use of this method to retrieve data can be very time consuming. In SAP programming performance tuning by using parallel cursor technique saves 80% of time.
Why programmers need to use nested loops for data retrieval? We can understand this by the means of a simple example. Suppose there are two tables one containing master data of sales bill like bill no., bill type, buyer name, buyer code, amount of sales bill etc. And there is another table containing detailed information of the same bill and also one record for each item like bill number, item code, item name, quantity sold, rate, discount etc. In order to extract data from transaction file for a particular bill number programmers use nested loops which loads the desired bill number from the master file and then carry out a search for specified bill number in transaction file till it finds the match. If the entries for that particular bill number are lying at the bottom of the table this search is going to consume lot of time and this time will keep on increasing with new data.
Parallel cursor technique used for performance tuning in SAP resolves this situation by making this search five times faster and this speed is maintained through out irrespective of the size of the tables. Parallel cursor technique maintains the cursor at the position from where the second loop of transaction table shall start which reduces the time wasted in searching the table from the first record every time loop runs. The prerequisite for parallel cursor technique in SAP is that both tables shall be sorted on the key field that is the field common in both the tables. Once the required bill number is loaded in the variable from the master table the cursor is positioned on the record of the transaction table containing the bill number. This way the loop runs only for required number of times and saves lot of time. This performance tuning technique works equally well even when used on tables containing huge data.
Use of nested loops in the program has been a fear factor for all the ABAP programmers as it slows down the program execution but by using parallel cursor technique for performance tuning SAP ABAP programs are able to conduct searches on huge tables in less time and maintains this execution level through out.