09-02-2009 10:06 AM
Hi,
I try to create a spool but I always receive an error. It doesn't found the spool in tbtc_spoolid table.
CONCATENATE 'rkaep000' sy-datum sy-uzeit INTO w_name.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = w_name
IMPORTING
jobcount = w_number
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
* Generate spool-id.
PERFORM submit_trans.
CLEAR: w_spoolid, w_no_spool.
IF sy-subrc = 0.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = w_number
jobname = w_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.
ENDIF.
* Retrieve the spool id in table tbcto and tbtc_spoolid
IF sy-subrc = 0.
DO.
SELECT SINGLE * FROM tbtco INTO wa_tbtco
WHERE jobname EQ w_name
AND sdluname EQ sy-uname.
*- Check status of job
CASE wa_tbtco-status.
WHEN 'F' OR 'A'. "Finished, aborted
EXIT.
WHEN OTHERS.
ENDCASE.
ENDDO.
ENDIF.
CLEAR wa_tbtc_spoolid.
SELECT SINGLE * FROM tbtc_spoolid INTO wa_tbtc_spoolid
WHERE jobcount = wa_tbtco-jobcount.
MOVE wa_tbtc_spoolid-spoolid TO w_spoolid.
*- Check if no spool found
IF w_spoolid IS INITIAL.
w_no_spool = 'X'.
ENDIF.
Anybody could help me please?
Regards,
Mohamed.
09-02-2009 10:21 AM
Hi!
You may use the function module 'RSPO_FIND_SPOOL_REQUESTS'
spooldsn = listname.
spoolname = dataset.
CALL FUNCTION 'RSPO_FIND_SPOOL_REQUESTS'
EXPORTING
rq0name = spoolname
rq2name = spooldsn
TABLES
spoolrequests = spool_ids
EXCEPTIONS
OTHERS = 0.
Kind regards
Peter
09-02-2009 10:23 AM
Hi Peter,
Thanks for your quick answer. Could you tell me where I should place this function please?
Regards,
Mohamed.
Edited by: rahhaoui mohamed on Sep 2, 2009 11:26 AM
09-02-2009 10:30 AM
Hi Mohamed, <li>When you use JOB_SUBMIT function module, you can pass PRIPARAMS type PRI_PARAMS. There you specify unique spool name and other details. <li>call the RSPO_FIND_SPOOL_REQUESTS function module to get the spool nos. Try to get the latest spool no. Thanks venkat.O
09-02-2009 10:35 AM
We used the following logic for getting the spool.
a) Before submitting the request using SUBMIT , get the print parameters using FM - GET_PRINT_PARAMETERS.
call function 'GET_PRINT_PARAMETERS'
exporting
line_size = wf_linesize
list_name = wf_list_name
no_dialog = 'X'
importing
out_parameters = wa_params
valid = wf_valid
exceptions
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
others = 4.
The wf_linessize was retrieved from the Report being submitted and wf_list_name is some UNIQUE Number.
b) In SUBMIT also pass the Print parameters using
spool parameters wa_params
c) After the Job is over, get the Spool from the table TSP01
select single * into
wa_tsp01
from tsp01
where rq2name = wf_list_name
and rqowner = wf_uname
and rqclient = sy-mandt.