2008 Jan 04 10:48 AM
Hi everybody!
I'd like to determine the jobnumer (TBTCO-JOBCOUNT) of an actually running background job.
In other words: Does an ABAP report know its own jobnumber, when it is running as background job? I need it inside the running report.
Unfortunately the SY structure does not contain it.
Is there another way to get it (e.g. by kernel call)?
Best regards
Torsten
2008 Jan 04 11:20 AM
If the job is running in background you should have access to the JOBLOG.
Another way is to wrap an abap around the job you want to run which simply creates the batch job you want to run and pass the number as a parameter.
Cheers
jimbo
Hi everybody!
I'd like to determine the jobnumer (TBTCO-JOBCOUNT) of an actually running background job.
In other words: Does an ABAP report know its own jobnumber, when it is running as background job? I need it inside the running report.
Unfortunately the SY structure does not contain it.
Is there another way to get it (e.g. by kernel call)?
Best regards
Torsten
2008 Jan 04 10:59 AM
hi
good
yes a ABAP program knows its own job number whenever you r creating a background job all the details related to that particular backgound job stores in the table TBTCS,only thing you need to access them in your program.So pls check that table you will get all your required fields.
thanks
mrutyun^
2008 Jan 04 11:20 AM
If the job is running in background you should have access to the JOBLOG.
Another way is to wrap an abap around the job you want to run which simply creates the batch job you want to run and pass the number as a parameter.
Cheers
jimbo
2008 Jan 04 12:38 PM
Unfortunately I don't have the jobname, and the report might be executed differrent times in parallel. The job is repeated periodically, so I can't use the jobnumber from the jobplanning.
But I found a solution on my own: As the Workprocess-Numer is hold in Table TBTCO I just have to determine the WP number at runtime of the report (see below).
REPORT zzschubert6001 .
*
CONSTANTS con_opcode_wp_get_id TYPE x VALUE 8. "from Include TSKHINCL
DATA lv_wppid TYPE wppid. "like wpinfo-wp_pid
DATA lv_jbcnt TYPE btcjobcnt. "like tbtco-jobcount
*
IF sy-batch IS NOT INITIAL.
CALL 'ThWpInfo' ID 'OPCODE' FIELD con_opcode_wp_get_id
ID 'PID' FIELD lv_wppid.
SELECT jobcount FROM tbtco INTO lv_jbcnt UP TO 1 ROWS WHERE wpprocid = lv_wppid. ENDSELECT.
MESSAGE i398(00) WITH 'Batch-Jobnumber is' lv_jbcnt.
ENDIF.Thank you anyway!
Torsten
PS: What a crappy editor...
2008 Jan 04 1:43 PM
Hi Torsten
UWE showed me a neat trick
Type "{"code"}"
Your ABAP code
more coding
"{"code"}"
leave off the inverted commas
you should see something like this
Abap coding
Abap coding
......
cheers
jimbo
2008 Jan 04 3:17 PM
Hallo Torsten
you can use the FM GET_JOB_RUNTIME_INFO
-
DATA: jobcount LIKE tbtcm-jobcount,
jobname LIKE tbtcm-jobname,
stepcount LIKE tbtcm-stepcount.
CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
IMPORTING
jobcount = jobcount
jobname = jobname
stepcount = stepcount
EXCEPTIONS
no_runtime_info = 1
OTHERS = 2.
-
Kindly Regards,
Stefan
2008 Jan 07 11:37 AM
Hi Schubert ,
you can retrieve it using join on TBTCP and TBTCO.
in where clause give sy-report as TBTCP-PROGNAME and check condition TBTCO-STATUS = 'R'.
Regards,
Mohaiyuddin
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |