Application Development and Automation 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: 
Read only

Read current background job name

Former Member
0 Likes
7,962

Hello,

I would like to know if there exists a way to find out the name of the background job where your ABAP program is currenctly running in.

Does there exist a function that I can call ?

Best Regards,

Erwin

1 ACCEPTED SOLUTION
Read only

Vinod_Chandran
Active Contributor
0 Likes
4,163

You can get the job for a particular ABAP program by going to SM37 and give the program name in the 'ABAP Program Name' field and press execute.

Hello,

I would like to know if there exists a way to find out the name of the background job where your ABAP program is currenctly running in.

Does there exist a function that I can call ?

Best Regards,

Erwin

8 REPLIES 8
Read only

Vinod_Chandran
Active Contributor
0 Likes
4,164

You can get the job for a particular ABAP program by going to SM37 and give the program name in the 'ABAP Program Name' field and press execute.

Read only

0 Likes
4,163

You can use the function module GET_JOB_RUNTIME_INFO.

Regards,

Rich Heilman

Read only

0 Likes
4,163

I agree with Rich. I use the same function module and works very well.


call function 'GET_JOB_RUNTIME_INFO'        
    importing                               
*         EVENTID                 =         
*         EVENTPARM               =         
*         EXTERNAL_PROGRAM_ACTIVE =         
*         JOBCOUNT                =         
         jobname                 = jobname  
*         STEPCOUNT               =         
    exceptions                              
         no_runtime_info         = 1        
         others                  = 2        
          .                                 

Regards,

Subramanian V.

Read only

andreas_mann3
Active Contributor
0 Likes
4,163

Hi,

try that :

fm SUBST_GET_JOBSTATE

and fm SLW_WL1_GET_BTCH_JOB_STATUS

(->status F = ready)

Andreas

Read only

Former Member
0 Likes
4,163

Hi,

The info is stored into table TBTCP.

Svetlin

Read only

Former Member
0 Likes
4,163

Hi Erwin

I think that you can catch the name of back-ground job that your ABAP program is currently running, using system fields. (system fields example: sy-subrc)

While debugging, just see the fields in structure 'SY'. To know more about the system variables and which one may be suitable for your purpose, please check the link below:

http://www.planetsap.com/Abap_System%20fields.htm

SY-BATZO may be of your interest, check others too.

Cheers

Ashish Jain

Read only

Former Member
0 Likes
4,163

Hi,

Thank you very much.

I'll try these functions, that's just what I needed

Best regards,

Erwin

Read only

Former Member
0 Likes
4,163

Hi,

You can get the current backgroun job name for the given program name by joining the table TBTCP & TBTCO.

Here is the sample query to get the current job name for the give program name.

SELECT tstepjobcount tstepjobname tjob~status INTO CORRESPONDING

FIELDS OF TABLE joblist

FROM tbtcp AS tstep INNER JOIN tbtco AS tjob

ON tjobjobcount = tstepjobcount AND

tjobjobname = tstepjobname AND

tjob~status EQ 'R'

WHERE progname = your program name.

Hope this one will help u.

Best Regards,

Vijay