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

Getting spool number after SUBMIT report statement

Former Member
0 Likes
3,493

Hi All,

I am using the following Submit statement in my Z program.

SUBMIT RKO7KO8G USING SELECTION-SET VARIANT

TO SAP-SPOOL SPOOL PARAMETERS v_print_param

ARCHIVE PARAMETERS archi_parameters

WITHOUT SPOOL DYNPRO

AND RETURN.

I am taking the spool number into a variable

DATA: v_spool TYPE tsp01-rqident.

v_spool = sy-spono.

Using the Spool request, I am calling,

CALL FUNCTION 'RSPO_RETURN_ABAP_SPOOLJOB'

EXPORTING

rqident = v_spool

first_line = 22

last_line = 35

TABLES

buffer = i_buffer

EXCEPTIONS

no_such_job = 1

not_abap_list = 2

job_contains_no_data = 3

selection_empty = 4

no_permission = 5

can_not_access = 6

read_error = 7

OTHERS = 8.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ELSE.

perform send_mail

endif.

I am executing my Z program in background. But the job is getting cancelled and in the job log the following message is coming:

Spool request (number 0000052462) created without immediate output

Spool request 0 no longer exists

Please tell me how to correct this. I need to read the spool using the spool number.

Thanks,

Neethu.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,740

Hi,

in debugging did you check the value for v_spool.

i think it will be zero, because you have to collect the sy-spono in the program

your submitting .

try this.


DATA: NUMBER    TYPE TBTCJOB-JOBCOUNT,
      NAME      TYPE TBTCJOB-JOBNAME VALUE 'TEST_SPOOL',
      PRINPAR   TYPE PRI_PARAMS,
      ARCPAR    LIKE ARC_PARAMS,
      WA_TBTCP  TYPE TBTCP,
      RQIDENT   TYPE TSP01-RQIDENT,
      VAL.

CALL FUNCTION 'GET_PRINT_PARAMETERS'
  EXPORTING
    LAYOUT                 = 'X_65_132'
    LINE_COUNT             = 65
    LINE_SIZE              = 132
  IMPORTING
    OUT_PARAMETERS         = PRINPAR
    OUT_ARCHIVE_PARAMETERS = ARCPAR
    VALID                  = VAL
  EXCEPTIONS
    ARCHIVE_INFO_NOT_FOUND = 1
    INVALID_PRINT_PARAMS   = 2
    INVALID_ARCHIVE_PARAMS = 3
    OTHERS                 = 4.

CALL FUNCTION 'JOB_OPEN'
  EXPORTING
    JOBNAME          = NAME
  IMPORTING
    JOBCOUNT         = NUMBER
  EXCEPTIONS
    CANT_CREATE_JOB  = 1
    INVALID_JOB_DATA = 2
    JOBNAME_MISSING  = 3
    OTHERS           = 4.
IF SY-SUBRC = 0.

  SUBMIT  ZPRK_ALVLVC TO SAP-SPOOL
  SPOOL PARAMETERS PRINPAR
  WITHOUT SPOOL DYNPRO
  VIA JOB NAME NUMBER NUMBER
  AND RETURN.

  IF SY-SUBRC = 0.

    CALL FUNCTION 'JOB_CLOSE'
      EXPORTING
        JOBCOUNT             = NUMBER
        JOBNAME              = NAME
        STRTIMMED            = 'X'
      EXCEPTIONS
        CANT_START_IMMEDIATE = 1
        INVALID_STARTDATE    = 2
        JOBNAME_MISSING      = 3
        JOB_CLOSE_FAILED     = 4
        JOB_NOSTEPS          = 5
        JOB_NOTEX            = 6
        LOCK_FAILED          = 7
        OTHERS               = 8.

    IF SY-SUBRC = 0.
      WAIT UP TO 5 SECONDS.
      CLEAR WA_TBTCP.
      SELECT SINGLE *
        FROM TBTCP
        INTO WA_TBTCP
       WHERE JOBCOUNT = NUMBER.

      WRITE 50 'spool-number.' COLOR 5.
      WRITE:/ WA_TBTCP-LISTIDENT HOTSPOT.
    ENDIF.
  ENDIF.
ENDIF.

.

Regards,

R K.

4 REPLIES 4
Read only

Former Member
0 Likes
1,740

Hi,

In the transaction SU01 in the defualts tab, , check whether the checkbox for Delete after output is unchecked. May be because of this even if the spool is created, it gets deleted immediately.

Hope this helps.

Regards,

Mansi.

Read only

0 Likes
1,740

Hi,

I am not having access to SU01. Is there any other option ?

Thanks,

Neethu.

Read only

0 Likes
1,740

In SU01 default tab , if delete after ouput is X also no use. I am also having same problem,Please

let me know whether u got the solution.

Regards,

Harsha

Read only

Former Member
0 Likes
1,741

Hi,

in debugging did you check the value for v_spool.

i think it will be zero, because you have to collect the sy-spono in the program

your submitting .

try this.


DATA: NUMBER    TYPE TBTCJOB-JOBCOUNT,
      NAME      TYPE TBTCJOB-JOBNAME VALUE 'TEST_SPOOL',
      PRINPAR   TYPE PRI_PARAMS,
      ARCPAR    LIKE ARC_PARAMS,
      WA_TBTCP  TYPE TBTCP,
      RQIDENT   TYPE TSP01-RQIDENT,
      VAL.

CALL FUNCTION 'GET_PRINT_PARAMETERS'
  EXPORTING
    LAYOUT                 = 'X_65_132'
    LINE_COUNT             = 65
    LINE_SIZE              = 132
  IMPORTING
    OUT_PARAMETERS         = PRINPAR
    OUT_ARCHIVE_PARAMETERS = ARCPAR
    VALID                  = VAL
  EXCEPTIONS
    ARCHIVE_INFO_NOT_FOUND = 1
    INVALID_PRINT_PARAMS   = 2
    INVALID_ARCHIVE_PARAMS = 3
    OTHERS                 = 4.

CALL FUNCTION 'JOB_OPEN'
  EXPORTING
    JOBNAME          = NAME
  IMPORTING
    JOBCOUNT         = NUMBER
  EXCEPTIONS
    CANT_CREATE_JOB  = 1
    INVALID_JOB_DATA = 2
    JOBNAME_MISSING  = 3
    OTHERS           = 4.
IF SY-SUBRC = 0.

  SUBMIT  ZPRK_ALVLVC TO SAP-SPOOL
  SPOOL PARAMETERS PRINPAR
  WITHOUT SPOOL DYNPRO
  VIA JOB NAME NUMBER NUMBER
  AND RETURN.

  IF SY-SUBRC = 0.

    CALL FUNCTION 'JOB_CLOSE'
      EXPORTING
        JOBCOUNT             = NUMBER
        JOBNAME              = NAME
        STRTIMMED            = 'X'
      EXCEPTIONS
        CANT_START_IMMEDIATE = 1
        INVALID_STARTDATE    = 2
        JOBNAME_MISSING      = 3
        JOB_CLOSE_FAILED     = 4
        JOB_NOSTEPS          = 5
        JOB_NOTEX            = 6
        LOCK_FAILED          = 7
        OTHERS               = 8.

    IF SY-SUBRC = 0.
      WAIT UP TO 5 SECONDS.
      CLEAR WA_TBTCP.
      SELECT SINGLE *
        FROM TBTCP
        INTO WA_TBTCP
       WHERE JOBCOUNT = NUMBER.

      WRITE 50 'spool-number.' COLOR 5.
      WRITE:/ WA_TBTCP-LISTIDENT HOTSPOT.
    ENDIF.
  ENDIF.
ENDIF.

.

Regards,

R K.