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: 

Jobs

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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

4 REPLIES 4

Former Member
0 Kudos

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

Former Member
0 Kudos

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

0 Kudos

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

Former Member
0 Kudos

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