05-03-2005 4:44 PM
Hi,
How can I determine whethere a report is running in a background in a job and if so a user who scheduled it ?
Marian Morzol
05-03-2005 4:56 PM
Hi Marian,
To do it programmatically then try the function module:
BP_FIND_JOBS_WITH_PROGRAM
Use the status fields as follows to help with the selection (these constants are in the program LBTCHDEF):
BTC_RUNNING LIKE TBTCO-STATUS VALUE 'R',
BTC_READY LIKE TBTCO-STATUS VALUE 'Y',
BTC_SCHEDULED LIKE TBTCO-STATUS VALUE 'P',
BTC_RELEASED LIKE TBTCO-STATUS VALUE 'S',
BTC_ABORTED LIKE TBTCO-STATUS VALUE 'A',
BTC_FINISHED LIKE TBTCO-STATUS VALUE 'F',
BTC_PUT_ACTIVE LIKE TBTCO-STATUS VALUE 'Z',
BTC_UNKNOWN_STATE LIKE TBTCO-STATUS VALUE 'X'.
The joblist table it returns gives you the user who scheduled it, its status, and a lot of other detail.
Cheers,
Brad
Message was edited by: Brad Williams
05-03-2005 4:54 PM
Hi Marian,
From a user perspective you can simply run transaction SM51 (or SM50 if you have one application server).
If you see the program (look in the report column) against a process type of BGD then the program is being run in background.
The user you see in this screen is the user under which the job is running which is usually (but not always) the user who scheduled it.
To do this programmatically I will have to get back to you.
Cheers,
Brad
05-03-2005 4:56 PM
Hi Marian,
To do it programmatically then try the function module:
BP_FIND_JOBS_WITH_PROGRAM
Use the status fields as follows to help with the selection (these constants are in the program LBTCHDEF):
BTC_RUNNING LIKE TBTCO-STATUS VALUE 'R',
BTC_READY LIKE TBTCO-STATUS VALUE 'Y',
BTC_SCHEDULED LIKE TBTCO-STATUS VALUE 'P',
BTC_RELEASED LIKE TBTCO-STATUS VALUE 'S',
BTC_ABORTED LIKE TBTCO-STATUS VALUE 'A',
BTC_FINISHED LIKE TBTCO-STATUS VALUE 'F',
BTC_PUT_ACTIVE LIKE TBTCO-STATUS VALUE 'Z',
BTC_UNKNOWN_STATE LIKE TBTCO-STATUS VALUE 'X'.
The joblist table it returns gives you the user who scheduled it, its status, and a lot of other detail.
Cheers,
Brad
Message was edited by: Brad Williams
05-03-2005 4:59 PM
Just FYI the BTCH function group has a lot of useful functions for background jobs.
The function BP_IS_JOB_ACTIVE_IN_WP for example can tell you whether the job is running at the moment or not.
Cheers,
Brad
05-03-2005 5:18 PM
If you execute transaction SM37 and indicate into abap program field the name of your report, you can undestand if the execution is scheduled or not.
Gianluca