Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

how to determine package size dynamically for select - endselect statement in ABAP

0 Likes
3,147


Hi All,

I was using select- edselect with package size but i have hard coding the package size. Can any one tell me the the process to determine dynamic package size so that i can use in parallel processing.

1 ACCEPTED SOLUTION
Read only

ThomasZloch
Active Contributor
0 Likes
2,529

Usually package size is used to avoid memory overflow when mass-reading data, or to insert occasional commit works when mass-updating data.

Your best bet here is to have the package size as a selection parameter that can be adjusted if needed.

But how do package size and parallel processing go together? How do you avoid that the same data is being selected by processes running in parallel? I think you rather need to prepare "smart" selection ranges for this purpose.

Please tell us what your requirement is.


Thomas


Hi All,

I was using select- edselect with package size but i have hard coding the package size. Can any one tell me the the process to determine dynamic package size so that i can use in parallel processing.

12 REPLIES 12
Read only

Former Member
0 Likes
2,529

I don't think there is anyway to deteermine package size dynamically. You will have to use trial and error approach to get optimize package size.

On what basis you want to make package size dynamic?

Regards,

Jigar Thakkar.

Read only

ThomasZloch
Active Contributor
0 Likes
2,530

Usually package size is used to avoid memory overflow when mass-reading data, or to insert occasional commit works when mass-updating data.

Your best bet here is to have the package size as a selection parameter that can be adjusted if needed.

But how do package size and parallel processing go together? How do you avoid that the same data is being selected by processes running in parallel? I think you rather need to prepare "smart" selection ranges for this purpose.

Please tell us what your requirement is.


Thomas

Read only

0 Likes
2,529

I believe you are able to do what is required. I can imagine one select, which will work in just single program:

1. determine "best" package size may vary on the number of parallel processes needed, so I will imagine, you need 10. Then there is one redundant select statement needed just to count the number of rows that the select will fetch.

2. using a wise modulo statement will split the number to 10 packages, which seems quite dynamic to me . Just do not forget to raise the final package size to a higher number (because the state of the database could change from the first select.

3. by paralel processing, Andy could mean "starting a new task" or "background task" or whatever. So you can have the dynamics and paralel processing at once.

Read only

0 Likes
2,529

I rather understood "package size" as being the addition of that name of the "select" statement.

As so often, it is up to the original poster to clarify, and another example for meager initial information leading to guessing games.


Thomas

Read only

0 Likes
2,529

I know I should wait for the poster, but I'm quite unsure - what is the difference between my view on the package size and yours?

Read only

0 Likes
2,529

I would need to understand your view better to make a good call.

PACKAGE SIZE as the option of the SELECT statement works as a compromise between a huge SELECT INTO TABLE itab (without packages) and a SELECT INTO wa / ENDSELECT loop.

So you still have an SELECT / ENDSELECT loop within the same work process.

I don't see how this relates to parallel processing. What you are referring to seems to be the typical preparation task for parallel processing, creating evenly sized work packages and then kicking off one process per package.


Thomas

Read only

0 Likes
2,529

ok, you got it right and now I got it right too. Let's see Andy's move

Read only

0 Likes
2,529

I'm running out of Sudokus...do you think he is ever coming back?

Read only

0 Likes
2,529

Dude, I gotch. I am using  Workplace availability FM and calculated the no of instance for paraalel processing using that i have calculated Package size.  It is working right now. Not sure will it run in future

Read only

0 Likes
2,529

Can you tell as the detail, what do you mean by Workplace availability FM?

If your problem is solved, why not closing the thread?

Read only

RaymondGiuseppi
Active Contributor
0 Likes
2,529

It depends entirely on the SELECT actual statement, you must have already executed a first select statement giving some range of values in an internal table, so you could sort and divide the internal table by the number of process and execute the next statements on every subset in a different process (e.g. with a FAE in  itab  or using lowest/highest value of key values in subset itab)

Regards,

Raymond

Read only

Former Member
0 Likes
2,529

Hi,

If you are looking to determine or set the value of package size dynamically then use below code for reference.

DATA: itab TYPE TABLE OF spfli,

       wa like LINE OF itab,

       n    TYPE i.

n = 10.

SELECT carrid connid

FROM   spfli

INTO   CORRESPONDING FIELDS OF TABLE itab

PACKAGE SIZE n.

   LOOP AT itab INTO wa.

     WRITE: / wa-carrid, wa-connid.

   ENDLOOP.

ENDSELECT.


If you are concerned about the performance then either use SELECT with OPEN CURSOR and CLOSE CURSOR.

Let me know if it helped?

Regards,

Zuber