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

SUBMIT statement not generating spool

Bharath84
Participant
0 Likes
3,025

Hi All,

I am calling the standard progrom as below:

SUBMIT crm_socm_service_report TO SAP-SPOOL
SPOOL PARAMETERS priparms
WITHOUT SPOOL DYNPRO
VIA JOB lv_jobname NUMBER lv_jobcount
AND RETURN
WITH pmy = pmy
WITH poffice = poffice
WITH pcoll = pcoll
WITH pteam = pteam
WITH pstatop = pstatop
WITH pstatcl = pstatcl
WITH pstatal = pstatal
WITH sobject = sobject-low
WITH cancel = abap_true
WITH next = abap_false
WITH noupd = abap_false
WITH SELECTION-TABLE lt_selection.
WAIT UP TO 5 SECONDS.

lv_spool = sy-spono.

Spool number is not getting generated. Butwhen I checked in SP01, spool number is generated. Am I missing anything please let me know if anyone faced the same issue. Alsi I tries the below link but did not work.

SUBMIT statement not generaitng spool

Thanks,

HT

7 REPLIES 7
Read only

FredericGirod
Active Contributor
2,323

Could you give us your real objective ? maybe there is another way to proceed

Read only

Bharath84
Participant
0 Likes
2,323

I have to read the data from the spool into internal table and display it in the output. This is what I am trying to do. But in debugging, spool no is 00000000.

Read only

2,323

Please use the COMMENT button for comments, questions, adding details, etc., ANSWER is only to propose a solution, dixit SAP text at the right of the answer area. At the same time, the person will be informed of your comment (currently not).

Read only

FredericGirod
Active Contributor
0 Likes
2,323
SUBMIT (p_prog) VIA SELECTION-SCREEN AND RETURN EXPORTING LIST TO MEMORY.


CALL FUNCTION ‘LIST_FROM_MEMORY’     
TABLES       
listobject = it_listobj     
EXCEPTIONS       
not_found  = 1       
OTHERS     = 2.

you could export to memory directly

Read only

0 Likes
2,323

I have tried LIST TO MEMORY and when my SUBMIT report is crm_socm_service_report is executed, in the report output I am getting the below error and exiting from my report.

error:SET SCREEN not allowed in subscreen(screen: SAPLSBL_DISPLAY 0101). If I use TO SPOOL, I am not getting this error. Any idea why this error is coming.

Read only

Sandra_Rossi
Active Contributor
0 Likes
2,323

To sum up your code, you launched a background job and you have a code to wait and get the ID of the spool request generated by the job:

CALL FUNCTION 'JOB_OPEN' ...
SUBMIT ... VIA JOB ... TO SAP-SPOOL ...
WAIT UP TO ...
spoolnumber = sy-spono.
CALL FUNCTION 'JOB_CLOSE' ...
" the rest of your algorithm

So, it's normal that SY-SPONO is not initialized by the spool generated in the submitted background job. System fields correspond to data in the current session, not in other sessions.

Moreover, WAIT UP TO ... makes no sense, how can you know the duration of a background job !

If you want to stick to the job solution, you'd better add a second step (custom program to create) to your job, that is started right after the first step, read the spool numbers in table TBTC_SPOOLID, and do the rest of your algorithm in that new program. Of course, it means that you need to split your main program. I don't know if it's worth the try.

Read only

Sandra_Rossi
Active Contributor
0 Likes
2,323

The question title is incorrect. This one would be better:

Can't get spool number created by job