Code: Alles auswählen.
IF sy-batch = 'X'.
CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
IMPORTING
eventid = eventid
eventparm = eventparm
external_program_active = external_program_active
jobcount = jobcount
jobname = jobname
stepcount = stepcount
EXCEPTIONS
no_runtime_info = 1
OTHERS = 2.
WRITE: / 'jobcount: ' ,jobname.
WRITE: / 'Jobname: ' ,jobcount.
WRITE: / 'stepcount: ' ,stepcount.
WRITE: / 'eventid: ' ,eventid.
WRITE: / 'eventparm: ' ,eventparm.
WRITE: / 'external_program_active: ' ,external_program_active.
" IF sy-subrc <> 0.
" MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
" WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
" ENDIF.
data:
job(8) type c,
name(32) type c.
move jobcount to job.
move jobname to name.
CALL FUNCTION 'BP_JOB_READ'
EXPORTING
job_read_jobcount = job "'15382900' "jobcount
job_read_jobname = name "'Z_SPOOL2XLS' "jobname
job_read_opcode = 36
job_step_number = 1
* IMPORTING
* JOB_READ_JOBHEAD =
* JOBLOG_ATTRIBUTES =
TABLES
* JOB_READ_STEPLIST =
spool_attributes = lt_spool_attrib "spool_attributes
* CHANGING
* RET =
EXCEPTIONS
invalid_opcode = 1
job_doesnt_exist = 2
job_doesnt_have_steps = 3
OTHERS = 4
.
" ...
ENDIF.
Code: Alles auswählen.
job(8) type c,
name(32) type c.
Code: Alles auswählen.
jobcount LIKE tbtcm-jobcount,
jobname LIKE tbtcm-jobname,
Code: Alles auswählen.
*&---------------------------------------------------------------------*
*& Report ZTEST71 *
*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*
REPORT ztest71.
* ============ SAP Hinweis 186603 ==============
*Bei der Anzeige einer Spool-Liste in der SP01 und bei der
*Weiterverarbeitung (z.B. Senden an SAPoffice) wird die Breite
*der Liste immer auf 255 gesetzt, egal wie breit die Liste vorher war.
DATA ls_tsp01 TYPE tsp01.
DATA: numbytes TYPE i,
pdfspoolid LIKE tsp01-rqident,
jobname LIKE tbtcjob-jobname,
jobcount LIKE tbtcjob-jobcount,
is_otf.
* Job Runtime Parameters
DATA: gd_eventid LIKE tbtcm-eventid,
gd_eventparm LIKE tbtcm-eventparm,
gd_external_program_active LIKE tbtcm-xpgactive,
gd_jobcount LIKE tbtcm-jobcount,
gd_jobname LIKE tbtcm-jobname,
gd_stepcount LIKE tbtcm-stepcount.
* Spool IDs
TYPES: BEGIN OF t_tbtcp.
INCLUDE STRUCTURE tbtcp.
TYPES: END OF t_tbtcp.
DATA: it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0,
wa_tbtcp TYPE t_tbtcp.
DATA spoolno LIKE tsp01-rqident.
* Klappt NUR als Job !!!!!!
IF sy-batch IS INITIAL.
SKIP.
WRITE:/ '>>> Programm muss im Hintergrund (als Job) laufen <<<'
COLOR COL_NEGATIVE INTENSIFIED OFF .
EXIT.
ENDIF.
* 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.
* Nimm das Spoolfile des vorherigen Steps
gd_stepcount = gd_stepcount - 1.
IF gd_stepcount < 1.
MESSAGE s398(00) WITH
'Problem - kann nicht als STEP 1 laufen !!' '' '' ''.
EXIT.
ENDIF.
SELECT * FROM tbtcp
INTO TABLE it_tbtcp
WHERE jobname = gd_jobname
AND jobcount = gd_jobcount
AND stepcount = gd_stepcount
AND listident <> '0000000000'
ORDER BY jobname jobcount stepcount.
READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
IF sy-subrc = 0.
spoolno = wa_tbtcp-listident.
MESSAGE s398(00) WITH 'Spoolnummer ' spoolno ' gefunden.' '' .
ELSE.
MESSAGE s398(00) WITH 'Problem - keine Spoolnummer gefunden' '' '' ''.
EXIT.
ENDIF.
SELECT SINGLE * FROM tsp01 INTO ls_tsp01 WHERE rqident = spoolno.
IF sy-subrc <> 0.
WRITE: / 'Spoolauftrag existiert nicht'(003)
COLOR COL_NEGATIVE.
EXIT.
ENDIF.