Application Development 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: 

Call function start new task

Former Member
0 Kudos

How can i control number of task running with Call function 'ZMY_FUNC' starting new task?

My program:

DO 5 TIMES.

  CALL FUNCTION 'ZMY_FUNC' STARTING NEW TASK 'TEST'.

  COMMIT WORK.

ENDDO.

Function ZMY_FUNC:

WAIT UP TO 100 SECONDS.

Where i see this task running? I went to SM58 and SM37 and nothing!

1 ACCEPTED SOLUTION

Former Member
0 Kudos

See transaction SM50. In ZMY_FUNC waiting is not enough, do for example a SELECT..ENDSELECT on a table with a million or so lines. You should see the tasks occupying upto 5 work processes of type dialog (DIA) in transaction SM50.

5 REPLIES 5

Former Member
0 Kudos

See transaction SM50. In ZMY_FUNC waiting is not enough, do for example a SELECT..ENDSELECT on a table with a million or so lines. You should see the tasks occupying upto 5 work processes of type dialog (DIA) in transaction SM50.

0 Kudos

I can see my task in SM50. But my function is running by 3000 seconds. Via program i want to kill this process. How can i do that? Has any way to insert a time for CALL FUNCTION STARTING NEW TASK? For exemplo: if ZMY_FUNC don´t finish in 60 seconds, this task is killed.

0 Kudos

No, I don't think so. Limit the execution time by other means. If you are processing data, just limit the amount of data that is being processed by each invocation so that it takes shorter time. If there is a loop involved just store the value of SY-UZEIT when entering the loop and check on each loop iteration the current value of SY-UZEIT and exit the loop with the exit command if the time limit has been reached (the difference of the computation is time in seconds the loop has been executing).

If you want to implement complex parallel processing, you should be looking at an existing implementation. Transaction SGEN is one. You may have to do keep records in a table and involve enqueue.

raymond_giuseppi
Active Contributor
0 Kudos

SM50 will show you the task running, you could also use the [{CALLING meth}|{PERFORMING subr} ON END OF TASK] here decrement a counter, increased when CALLING FUNCTION. then you could add a WAIT UNTIL counter = 0 in main program if required. That can be useful when managing huge volume of data, as the submitted task will be considered as interactive process so can reach the time out limit. So you may be required to start smaller task and also not use every process of the avaliable servers, for that check FMs of FG SPBT.

Regards,

Raymond

Former Member
0 Kudos

Resolved!

I´m change my code for CALL FUNCTION IN BACKGROUND TASK and control number of process executing with select in table ARFCSSTATE. This way i can execute process and control number of process in execution.

Thanks all!