Skip to Content
author's profile photo Former Member
Former Member

spool not getting created , have a look into my code plz

Dear all

Plz help me in tracking the error

"Spool req 0 doesnt exist"

SELECT SINGLE * FROM ZPLH WHERE VBELN = SSORD

AND POSNR = ITNO.

IF SY-SUBRC EQ 0.

DATA : v_jobcount LIKE tbtcjob-jobcount,

ZTEST LIKE TBTCJOB-JOBNAME.

*-- run in the background

CALL FUNCTION 'JOB_OPEN'

EXPORTING

jobname = 'ZTEST'

IMPORTING

jobcount = v_jobcount

EXCEPTIONS

cant_create_job = 1

invalid_job_data = 2

jobname_missing = 3

OTHERS = 4.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE 'E' NUMBER sy-msgno

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

EXIT.

ENDIF.

*-- submit the program in the background

SUBMIT ZPP_REP_ENCLOSURE_PACKLIST3

WITH JOBNO = SSORD

WITH LINENO = ITNO

USER sy-uname

TO SAP-SPOOL WITHOUT SPOOL DYNPRO

DESTINATION 'LOHP'

IMMEDIATELY 'X'

KEEP IN SPOOL 'X'

VIA JOB 'ZTEST' NUMBER v_jobcount AND RETURN.

IF SY-SUBRC = 0.

  • * Job scheduled successfully

ENDIF.

IF SY-SUBRC = 4.

  • *Job scheduling terminated by user

ENDIF.

IF SY-SUBRC = 8.

  • *Error in job scheduling (JOB_SUBMIT)

ENDIF.

IF SY-SUBRC = 12.

  • *Error in internal number assignment .

ENDIF.

*-- close the job

CALL FUNCTION 'JOB_CLOSE'

EXPORTING

jobcount = v_jobcount

jobname = ZTEST

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.

  • MESSAGE ID sy-msgid TYPE 'W' NUMBER sy-msgno

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

ENDIF.

CALL FUNCTION 'GET_JOB_RUNTIME_INFO'

IMPORTING

  • EVENTID =

  • EVENTPARM =

  • EXTERNAL_PROGRAM_ACTIVE =

JOBCOUNT = v_jobcount

JOBNAME = ZTEST

  • STEPCOUNT =

EXCEPTIONS

NO_RUNTIME_INFO = 1

OTHERS = 2

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

clear tbtcp.

select single listident from tbtcp

into tbtcp-listident

where jobname = ZTEST

and jobcount = v_jobcount

and stepcount = step.

IF SY-SUBRC EQ 0.

move tbtcp-listident to spool_id.

ENDIF.

CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'

EXPORTING

SRC_SPOOLID = SPOOL_ID

NO_DIALOG = ''

  • DST_DEVICE = 'LOHP' "E_DEVTYPE

  • PDF_DESTINATION = 'LOHP'

IMPORTING

PDF_BYTECOUNT = BTC

  • PDF_SPOOLID =

  • LIST_PAGECOUNT =

  • BTC_JOBNAME =

  • BTC_JOBCOUNT =

TABLES

PDF = T_SPOOL_2_PDF

EXCEPTIONS

ERR_NO_ABAP_SPOOLJOB = 1

ERR_NO_SPOOLJOB = 2

ERR_NO_PERMISSION = 3

ERR_CONV_NOT_POSSIBLE = 4

ERR_BAD_DESTDEVICE = 5

USER_CANCELLED = 6

ERR_SPOOLERROR = 7

ERR_TEMSEERROR = 8

ERR_BTCJOB_OPEN_FAILED = 9

ERR_BTCJOB_SUBMIT_FAILED = 10

ERR_BTCJOB_CLOSE_FAILED = 11

OTHERS = 12

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ELSE.

TEXT02 = ITNO.

MESSAGE I014(ZQOTBANK) WITH TEXT02.

ENDIF.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    Posted on Feb 25, 2005 at 07:18 PM

    Hi Moni,

    If I look at your program flow, it is as follows:

    1. Open Job.

    2. Submit Z program via job and create spool.

    3. Close job.

    4. Get job runtime info.

    5. select from tbtcp for spool id.

    6. call function to convert the spool to PDF.

    I see some problems in your code. First at step 4. Get job runtime does not return you the status of the job that you just submitted. You need to use the function module BP_JOB_STATUS_GET to the status of your job. Only if it is 'F', you can go to step 5.

    Other problem is in step 5 where even if you don't get a spool id, you are proceeding with the step 6. I think you are not getting a spool id and that is the reason why you are getting that error message with spool id as 0.

    Change your flow as follows.

    1. Open Job.

    2. Submit Z program via job and create spool.

    3. Close job.

    4. DO.
         call function BP_JOB_STATUS_GET.
         IF job status = 'F'.
    *-- job has finished
           EXIT.
         ENDIF.
       ENDDO.

    5. select from tbtcp for spool id.

    6. call function to convert the spool to PDF.

    Also, make note of Anand's comment about the variable ZTEST and the job name 'ZTEST'.

    Hope this helps.

    Srinivas

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 25, 2005 at 07:42 AM

    Hello Moni,

    You have declared a variable called ZTEST. This variable has not been initialized.

    Some places you use the string 'ZTEST' and the others you use this variable.

    Are you able to see my point ? Or is this not the complete code ?

    Regards,

    Anand Mandalika.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 25, 2005 at 08:06 AM

    Hi Monirujjaman,

    Check demo program DEMO_LIST_SUBMIT_TO_SPOOL.

    Thanks

    Lakshman

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 25, 2005 at 05:42 PM

    This thread may also be of interest. Check my posting in regards to why a list will appear online but not in batch.

    ALV Tree in Background

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.