Application Development 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: 

"No List Available" in spool.

Former Member
0 Kudos

Hi All,

I am generating a report in foreground using SQ01 is SAP Query and I am getting proper data in ALV format.But whenever I am running it in background , after completion of the program ,I am getting an error message " No List Available " Although it is taking the same time to run as that of it takes in forefround.

Could you please help me ?

Regards

Jeetu

1 ACCEPTED SOLUTION

former_member223537
Active Contributor
0 Kudos

Hi,

It seems you are doing SUBMIT JOB instead of JOB_SUBMIT. The control is coming back to the calling program before the spool is executed.

Include the following logic, which won't come back to the calling program unless the background job is COMPLETED or CANCELLED.

FORM get_spool_details .

CLEAR : w_spool_number.

REFRESH : i_jobsteplist.

  • CHECK WHETHER STATUS OF JOB IS COMPLETED OR CANCELLED

WHILE 1 = 1.

  • GET THE JOB STEPLIST WHICH HAS THE SPOOL NUMBER

CALL FUNCTION 'BP_JOB_READ'

EXPORTING

job_read_jobcount = w_jobcount

job_read_jobname = w_jobname

job_read_opcode = '35'

  • JOB_STEP_NUMBER =

IMPORTING

job_read_jobhead = wa_jobhead

TABLES

job_read_steplist = i_jobsteplist

  • CHANGING

  • RET =

EXCEPTIONS

invalid_opcode = 1

job_doesnt_exist = 2

job_doesnt_have_steps = 3

OTHERS = 4

.

IF sy-subrc <> 0.

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

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

ENDIF.

  • IF STATUS OF JOB IS COMPLETED(F) OR CANCELLED(A)

  • READ THE JOBSTEPLIST & GET THE SPOOL NUMBER

IF wa_jobhead-status = 'A' OR wa_jobhead-status = 'F'.

READ TABLE i_jobsteplist INTO wa_jobsteplist INDEX 1.

CHECK wa_jobsteplist-listident <> space.

w_spool_number = wa_jobsteplist-listident.

EXIT.

ENDIF.

ENDWHILE.

If you want the spool content into an internal table, then use the following FM :

CALL FUNCTION 'RSPO_RETURN_ABAP_SPOOLJOB'

EXPORTING

rqident = w_spool_number

  • FIRST_LINE = 1

  • LAST_LINE =

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.

ENDIF.

Best regards,

Prashant

5 REPLIES 5

FredericGirod
Active Contributor
0 Kudos

Hi,

Did you have check that you didn't have any dump ? (transaction ST22).

Rgd

Frédéric

Former Member
0 Kudos

Hi Jeety,

do you use ALV-Grid? ALV-GRID is not Working in Backgrount!!!

Regards, Dieter

0 Kudos

Dieter, you could use ALV-Grid .. or any ALV in background, just don't use the object container and instead use a docking container.

Rgd

Frédéric

sridhar_k1
Active Contributor
0 Kudos

Check the print options when you are scheduling the job, if they are set to Print immediately and delete spool after print, the spool prints on a default pritner and gets deleted immediately, and u get the error message no list available.

Regards

Sridhar

former_member223537
Active Contributor
0 Kudos

Hi,

It seems you are doing SUBMIT JOB instead of JOB_SUBMIT. The control is coming back to the calling program before the spool is executed.

Include the following logic, which won't come back to the calling program unless the background job is COMPLETED or CANCELLED.

FORM get_spool_details .

CLEAR : w_spool_number.

REFRESH : i_jobsteplist.

  • CHECK WHETHER STATUS OF JOB IS COMPLETED OR CANCELLED

WHILE 1 = 1.

  • GET THE JOB STEPLIST WHICH HAS THE SPOOL NUMBER

CALL FUNCTION 'BP_JOB_READ'

EXPORTING

job_read_jobcount = w_jobcount

job_read_jobname = w_jobname

job_read_opcode = '35'

  • JOB_STEP_NUMBER =

IMPORTING

job_read_jobhead = wa_jobhead

TABLES

job_read_steplist = i_jobsteplist

  • CHANGING

  • RET =

EXCEPTIONS

invalid_opcode = 1

job_doesnt_exist = 2

job_doesnt_have_steps = 3

OTHERS = 4

.

IF sy-subrc <> 0.

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

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

ENDIF.

  • IF STATUS OF JOB IS COMPLETED(F) OR CANCELLED(A)

  • READ THE JOBSTEPLIST & GET THE SPOOL NUMBER

IF wa_jobhead-status = 'A' OR wa_jobhead-status = 'F'.

READ TABLE i_jobsteplist INTO wa_jobsteplist INDEX 1.

CHECK wa_jobsteplist-listident <> space.

w_spool_number = wa_jobsteplist-listident.

EXIT.

ENDIF.

ENDWHILE.

If you want the spool content into an internal table, then use the following FM :

CALL FUNCTION 'RSPO_RETURN_ABAP_SPOOLJOB'

EXPORTING

rqident = w_spool_number

  • FIRST_LINE = 1

  • LAST_LINE =

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.

ENDIF.

Best regards,

Prashant