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: 

can I retrieve a job name inside of a running program?

Former Member
0 Kudos

We have a function that sends an email with a program name and message if the program encounters an error. This program can be run in batch mode by a job or in the foreground through SE38 or SE80.

If the program was executed as a step in a job is there a system field that contains the job name so that we can have this information in the email as well?

Example:

Job u2013 SCHEDULED_JOB

Step 1 u2013 Z_ABAP_PROGRAM

When Z_ABAP_PROGRAM is running SY-REPID contains Z_ABAP_PROGRAM.

From within Z_ABAP_PROGRAM is there any way to see job SCHEDULED_JOB

Looking in the dictionary and debugging a runnign job the SYST table does not appear to have this information.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hello

You could try FM GET_JOB_RUNTIME_INFO to get the name of the job that is running your program.

Regards

Greg Kern

5 REPLIES 5

rodrigo_paisante3
Active Contributor
0 Kudos

Hi,

Did you try to use SM50?

You can see all runing programs. The FM TH_WPINFO do the same, retrieve the records to a itab.

Maybe this can help you.

Regards

Former Member
0 Kudos

Hello

You could try FM GET_JOB_RUNTIME_INFO to get the name of the job that is running your program.

Regards

Greg Kern

0 Kudos

Thanks Greg Kern. I had a similar problem and solved by calling the function module.

arpit_shah
Contributor
0 Kudos

Hi,

you can use fm GET_JOB_RUNTIME_INFO

like,

  • Get current job details

CALL FUNCTION 'GET_JOB_RUNTIME_INFO'

IMPORTING

eventid = gd_eventid

eventparm = gd_eventparm

external_program_active = gd_external_program_active

jobcount = gd_jobcount

jobname = gd_jobname

stepcount = gd_stepcount

EXCEPTIONS

no_runtime_info = 1

OTHERS = 2.

Regards,

Arpit

Former Member
0 Kudos

Thanks Greg, this worked