When I ran a big program(actually,already optimized but still high cpu usage,but completely fast,just like 30 secs,and CPU lower than before) but so many users (50 more)
My scheme ---for example User1 runs the program,other user prohibit run it.and then show it will run it automatically after XX sec,such as put in queue up schedule.
and then when User1 run finished program,program will be release,if I dont to do so,I think production server gonna die when high usage peak.so,Does anybody has any idea on this...?
Thanks in advance.
What I would think is u anyways schedule the job when any user tries to execute. The job will check for if any other job is executing or is schedule.
If there is other job running but not schedule u will schedule this job with 'Wait for predecessor job' condition.
if there is any other job sceduled in the queue then u will schedule this job waitin on the one which is sceduled.
Keep the job name same 'JOB_REPORT_001'. The last three digit is running number.
This will give u idea as to how u want to proceed. U will need lot of Job sceduling FM to program them.
You can use the FM : <b>THUSRINFO</b> to get the list of users and the list of transactions run by them.
1. Assign a transaction code to your program
2. In the program before running your lenghty select statement do the following validation check whether the same transaction is being executed simultaneously by any other user.
If so, you can prohibit the user from running the transaction giving an error message...
DATA: BEGIN OF usr_list OCCURS 1000.
INCLUDE STRUCTURE uinfo.
DATA: END OF usr_list. "Internal table for list of users"
"Get users and transactions run by them into usr_list"
CALL FUNCTION 'THUSRINFO'
TABLES usr_tabl = usr_list.
DATA count TYPE i.
"Check whether the transactions is being run"
"Replace ZONE with your tcode"
LOOP AT usr_list WHERE tcode EQ 'ZONE'.
count = count + 1.
IF count GT 1.
MESSAGE a001(z538msg) WITH 'Already running'.
"First user : Permitted"