‎2013 Jan 21 8:13 AM
Hello Experts,
I am doing some research on when to go for a Open Cursor route of selection. As a thumb rule, I know that if volumes are high(>100000) the Open Cursor should be used to break the data into smaller packets. However, I am not able to find what is SAP recommended volume is the criteria for it.Also, what is the recommended package size. I have generally seen people using 5000 size but not sure if this is a proven/SAP recommended size.
Kindly advice.
Thanks,
Chirantan
‎2013 Jan 21 11:50 AM
Hello Chirantan,
normally the package size addition is used to limit the number of records due to memory issues.
With the package size you can control the size of the internal table that contains selected records.
For the tables with many records and large numbr of fields this addition is often used.
To select the right package size you should do your calculation as follows.
Find out the width of the resulting internal table (TW, bytes). Then think how much memory you would like to utilize at maximum for this internal table (MS, bytes). Now you can easily calculate your package size.
Example: you can afford utilizing maximum 50 Mb for the internal table, MS = 50.000.000. The width of the internal table is 1000 bytes.
Package Size = MS / TW = 50.000.000 / 1000 = 50.000.
So you can select 50.000 records with each package.
Regards,
Yuri
‎2013 Jan 21 8:44 AM
Hi Chirantan,
it is not like we always use Package size as 5000.
Generally when there is a Millions of records. we go for Open cursor, fetch Cursor and Close cursor Concept. As you researched the Package size can be a Parameter in the Selection screen with defaulted values as 10000 or 5000. Depends on the user selection screen data.
Lets say he have 50,000 records then user will give the package size as 5000 and the Process of hitting DB is 10 times in this case.
If there are 1 Million records then the package size in the selection screen will be given as 50,000 so that the process of hitting DB is 20 Times. Generally you can find the BSEG table being used with Cursors all the time.
Hope this helps..
‎2013 Jan 21 11:50 AM
Hello Chirantan,
normally the package size addition is used to limit the number of records due to memory issues.
With the package size you can control the size of the internal table that contains selected records.
For the tables with many records and large numbr of fields this addition is often used.
To select the right package size you should do your calculation as follows.
Find out the width of the resulting internal table (TW, bytes). Then think how much memory you would like to utilize at maximum for this internal table (MS, bytes). Now you can easily calculate your package size.
Example: you can afford utilizing maximum 50 Mb for the internal table, MS = 50.000.000. The width of the internal table is 1000 bytes.
Package Size = MS / TW = 50.000.000 / 1000 = 50.000.
So you can select 50.000 records with each package.
Regards,
Yuri