Displaying a Job Log

Procedure

Use function module BP_JOBLOG_SHOW to display a job log to a user.

BP_JOBLOG_SHOW cannot usually be part of the same program that you used to schedule a job, since the job log is complete only when the job has been completed.

However, you could offer display of a job log as a separate function to your users.

Example

Displaying Job Logs

REPORT BCSWPTS2. 
INCLUDE LBTCHDEF. 

* Possible data declarations: BP_JOBLOG_SHOW 
* Assumption: You have saved the JOBNAME and JOBCOUNT of a job 
* and are specifying these values explicitly. 

DATA: JOBCOUNT LIKE TBTCJOB-JOBCOUNT. 
DATA: JOBNAME LIKE TBTCJOB-JOBNAME. 

JOBNAME = '<NAME OF JOB>'. " Supplied by you when you 
" schedule a job. 
JOBCOUNT = '<NUMBER OF JOB>'. " Returned by JOB_OPEN. 

CALL FUNCTION 'BP_JOBLOG_SHOW' 
EXPORTING 
CLIENT = SY-MANDT " Defaults to user's client. 
JOBCOUNT = JOBCOUNT " Job ID number. 
JOBNAME = JOBNAME " Job name. 
EXCEPTIONS 
JOBLOG_DOES_NOT_EXIST = 01 " Log already deleted 
JOBLOG_IS_EMPTY = 02 " Job has just started. If 
" exception recurs, there is 
" probably a system problem. 
NO_JOBLOG_THERE_YET = 03 " Job not yet started. 
NO_SHOW_PRIVILEGE_GIVEN = 04 " Calling user does not have 
" display privileges for the 
" requested job. 
OTHERS = 99. " System errors, such as 
" database or network problems.