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

Call Function starting new Task - Close used and useless task

0 Likes
1,480

Hi all, I have to elaborate more than 2 millions of record, I have divided these record making a small packages and running my function "in update task" with all my different packages of data.

Now I'm having a problem with the available channels because for example I must launch 10 parallel procedures but I have only 9 available channels, if I start with these 9 channels it seems it will be busy until the end of the 10th package.

Why the 9 channels wait for the end of 10th? If the execution of their program finish I expect that the 9 channel return to be available. I should close the channel and set it as available after the end of any single function execution.

How can I solve my problem?

Thank you

For example:

do n times

    call function 'FUNCTION'

          starting new task lv_name

          destination in group 'parallel_generators'
          performing f_return_info on end of task
enddo
    

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,398

Did you first call SPBT_INITIALIZE to get number of free processes. Then every time you successfully create a task increment a counter of current running tasks. Decrement the counter in the end of task method/form. Check  maximum number of running tasks reached before creating a new task, if reached use a WAIT UNTIL one process ends and decrements current number of running tasks to less than maximum number.

More information at help.sap.com : Implementing Parallel Processing

Regards,

Raymond

4 REPLIES 4
Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,399

Did you first call SPBT_INITIALIZE to get number of free processes. Then every time you successfully create a task increment a counter of current running tasks. Decrement the counter in the end of task method/form. Check  maximum number of running tasks reached before creating a new task, if reached use a WAIT UNTIL one process ends and decrements current number of running tasks to less than maximum number.

More information at help.sap.com : Implementing Parallel Processing

Regards,

Raymond

Read only

0 Likes
1,398

Yes,

There is a procedure with SPBT_INITIALIZE to calculate how many processes I can run but I want to keep  some available channels; so for example I have 10 free channel but I want divide my session in 8 + 2 to keep 2 channels free for other different processes.

Read only

0 Likes
1,398

In RZ12 when you define server groups, there is an option to keep a "Minimum Number of Free WPs" (SPBT_INITIALIZE respects this limit ?)

Regards,

Raymond

Read only

0 Likes
1,398

Thank you Raymond but It's not what I need anyway I think these information will be very usefull for me; I need to close a task when its program end the execution getting available its channel for another task