2015 Apr 13 4:38 PM
Hi guys,
using SCN for years and finally took the time to register.
Here's the situation: We have a program in our producitve system that starts parallel processes while running.
Sometimes (the cause is not yet determined) one process just runs longer with no attempt to stop. The main process is captured at a WAIT UNTIL command. We basically wait a defined time, then we want to automatically EXIT the program. Let's just say we don't want long runs.
Now: We want that one parallel process to be killed. This is why because our main program is running all day in a loop and cant be restarted, if one parallel process is still running. At the moment we are killing the process in SM50 manually. We want that to be done automatically within the main program.
I found some functions TH_* like TH_SYSTEMWIDE_WPINFO which provides all wps from all application servers. There I can see my process, but how can I kill it and do I have to change application server as there are up to 6 different ones where the parallel process might be running (because of parallelization the main programm can be running on a different application server as the parallel process)?
Many thanks for your ideas!
Regards
Stefan
2015 Apr 14 7:34 AM
2015 Apr 13 5:32 PM
Stefan,
We have a similar process in our system. I dont know how to kill an existing process but what we did was to code a wait until <logical expression> along with a <time frame>.
This way the main program will only be allowed to run for a certain # of seconds irrespective of the logical expression on the wait statement. If the time is up the main program continues with its execution.
WAIT UNTIL log_exp [UP TO sec SECONDS].
Hope this helps with atleast one part of your solution.
Thanks,
Vikram.M
2015 Apr 13 9:31 PM
Hi Stefan,
We do get all the details of the processes running through the FM 'TH_SYSTEMWIDE_WPINFO'.
Based on the conditions we can transfer the details to a file (killproc.bat) on the application server through an scheduled abap program.
abap program - condition example:
IF WA-WP_TYP = 'DIA' AND WA-WP_STATUS = 'Running' AND WA-WP_ELTIME GT 5000.
CONCATENATE 'taskkill' '/pid ' wa-wp_pid '/F' into str SEPARATED BY space.
transfer str to w_dataset1.
ENDIF.
Finally we have to create schedules on the application server to run this file killproc.bat
This file has command taskkill with pid number.
example: taskkill /pid 1836 /F
I do hope you go the idea.
2015 Apr 14 7:34 AM
2015 Apr 14 9:07 AM
Hi Raymond,
FM TH_STOP_WP is exactly what we need. I didn't think of system commands before.
If we use this one, I have to be on the same server as the process with the pid, right?
If the program is currently running on a different server though, how can I switch to the correct server within the program?
Thank you!
Regards
Stefan
2015 Apr 14 9:46 AM
Debug SM51 on a multi-app-server system, and you should be able to figure it out.
2015 Apr 15 8:43 AM
Just to complete this topic:
Switching server is done in FM TH_REMOTE_TRANSACTION.
CALL FUNCTION 'TH_REMOTE_TRANSACTION'
EXPORTING
dest = <your server>
tcode = space.
This can be found in program rsm51000_alv in routine sm51_user_cmd.
Thanks!
Regards
Stefan
2015 Apr 15 9:02 AM
Hi Mr. Mathew & Mr. Raymond,
using the fm 'TH_REMOTE_TRANSACTION' we get the list of PIDs running on other application servers.
If we delete the process using fm 'ThWpInfo' or TH_STOP_WP then will it delete on the other application server?