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

Jobname during runtime

Former Member
0 Likes
5,603

Hi ,

My requirement is basically to get the current jobname when the job is running in the background.

I tried using the FM 'GET_JOB_RUNTIME_INFO' but it always returns with exception NO_RUNTIME_INFO.

Can some one provide some answer for this.

Thanks in advance.

Regards,

Vijay

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,959

Hi,

allthe job names and information is stored in table..

TBTCO,TBTCP.

if you want to know the jon name..

if sy-batch = 'X' "that means job is running in back ground.

fecth the job name .

select sigle * from tbtco where INTREPORT = 'reportname which you are running'.

from above you get the job name related to program you are running.

regards,

Prabhduas

Hello,

How do you know there is a problem? Try to debug the "finished job" & check why you are getting this error?

BR,

Suhas

15 REPLIES 15
Read only

Former Member
0 Likes
3,960

Hi,

allthe job names and information is stored in table..

TBTCO,TBTCP.

if you want to know the jon name..

if sy-batch = 'X' "that means job is running in back ground.

fecth the job name .

select sigle * from tbtco where INTREPORT = 'reportname which you are running'.

from above you get the job name related to program you are running.

regards,

Prabhduas

Read only

0 Likes
3,959

Hi ,

Thanks for the reply.

But the problem is

Say for example.

I am using a variant called Ztest .

Now i scheduled two jobs ZJ1 and ZJ2 using the same variant.

Now there is a problem in finding the current jobname.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
3,959

Hello,

How do you know there is a problem? Try to debug the "finished job" & check why you are getting this error?

BR,

Suhas

Read only

0 Likes
3,959

Hi ,

I am not sure which problem are you referring to.

I used this FM

CALL FUNCTION 'GET_JOB_RUNTIME_INFO'

IMPORTING

  • EVENTID =

  • EVENTPARM =

  • EXTERNAL_PROGRAM_ACTIVE =

  • JOBCOUNT =

JOBNAME = w_jobname

  • STEPCOUNT =

EXCEPTIONS

NO_RUNTIME_INFO = 1

OTHERS = 2

here i am trying to get the jobname in w_jobname.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
3,959

Hello,

But as per your post you are always getting the EXCEPTION: NO_RUNTIME_INFO, when you are executing the 'GET_JOB_RUNTIME_INFO'.

How are you testing the program? Plz revert back.

If you are trying to run the program in the online mode, you will always get this EXCEPTION.

BR,

Suhas

Read only

0 Likes
3,959

Try BP_FIND_JOBS_WITH_PROGRAM, or others in same Function group.

Read only

0 Likes
3,959

Inside the Function Module GET_JOB_RUNTIME_INFO , there is call made for

CALL 'GetRuntimeInfo'

ID 'JOB' FIELD I_JOBINFO.

This is failing here.

Read only

0 Likes
3,959

I am running the program in background job and debugging by JDBG in background.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
3,959

Hello,

The FM "GET_JOB_RUNTIME_INFO" will not work in DEBUG mode, because the stmt where the FM fails is an SAP Kernel call.

Hope this helps.

BR,

Suhas

Edited by: Suhas Saha on May 13, 2009 3:29 PM

Read only

0 Likes
3,959

Hi ,

Thanks for your answer.Can you please tell me how to debug the same without JDBG.

Regards,

Vijay

Read only

0 Likes
3,959

Sorry for the previous post, Please ignore the same.i didnt see your reply.

But one question is , how can i test the same.

BR

Vijay

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
3,959

Hello Vijay,

You donot EXPORT any data to the FM, you just IMPORT data from it.

I think that this FM is fool-proof )

AFAIK there is no way to test this FM.

BR,

Suhas

Read only

Former Member
0 Likes
3,959

TBTC is the master table which stores information about the job.

Read only

Former Member
0 Likes
3,959

Perhaps the problem lies in the definition of the variable. I tried this little test and it gets the job name cleanly.

Use SM36 to create this job and run it, and then go to sm37 and capture the active job. This brings up the debuger, and there you can see you are trapped in the endless WHILE. Just look at the content of the NAME variable and you'll see the name of the job. To exit, change the content of the CONTROL variable to anything other than 'X', and then exit debugging. If the job doesn't appear to stop in SM37, refresh it a pair of times and you'll see it as finished.

This is how you test this kind of functions or debug background programs.

DATA: name LIKE tbtcm-jobname,
control TYPE c.


control = 'X'.
CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
 IMPORTING
*   EVENTID                       =
*   EVENTPARM                     =
*   EXTERNAL_PROGRAM_ACTIVE       =
*   JOBCOUNT                      =
   jobname                       = name
*   STEPCOUNT                     =
 EXCEPTIONS
   no_runtime_info               = 1
   OTHERS                        = 2.

WHILE control = 'X'.

ENDWHILE.

Read only

Former Member
0 Likes
3,959

Hi ,

My Problem is solved now :)I had used the FM BP_FIND_JOBS_WITH_PROGRAM.

Thanks for all the responses.

Regards,

Vijay