2013 Mar 19 5:58 AM
Hello Experts,
Here's my code:
g_print_parameters = p_print. (p_print is the Printer Name)
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = g_jobname
IMPORTING
jobcount = g_jobcount
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc = 0.
SUBMIT z_xyz_report TO SAP-SPOOL
SPOOL PARAMETERS g_print_parameters
WITHOUT SPOOL DYNPRO
USER g_user
VIA JOB g_jobname NUMBER g_jobcount
WITH p_file = p_file
AND RETURN.
IF sy-subrc = 0.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = g_jobcount
jobname = g_jobname
strtimmed = c_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 e003(zvxyz).
ENDIF.
MESSAGE s002(zxyz) WITH g_jobname.
ENDIF.
ENDIF.
Job is getting scheduled immediately as well as the Spool is generated successfully. But it is not printing immediately.
How can I print the Spool immediately from the Printer?
Thanks & Regards,
Sowmya
2013 Mar 19 10:12 AM
The structure for print parameter, is a little more complex than printer name
Read some documentation like Setting Program-Driven Print Parameters.
For immediate print on a specified printer device :
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
destination = tsp03-padest " p_print
copies = 1
immediately = 'X'
mode = 'BATCH'
no_dialog = 'X'
report = 'Z_XYZ_REPORT'
IMPORTING
out_parameters = pri_params " g_print_parameters
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
Regards,
Raymond
Hello Experts,
Here's my code:
g_print_parameters = p_print. (p_print is the Printer Name)
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = g_jobname
IMPORTING
jobcount = g_jobcount
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc = 0.
SUBMIT z_xyz_report TO SAP-SPOOL
SPOOL PARAMETERS g_print_parameters
WITHOUT SPOOL DYNPRO
USER g_user
VIA JOB g_jobname NUMBER g_jobcount
WITH p_file = p_file
AND RETURN.
IF sy-subrc = 0.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = g_jobcount
jobname = g_jobname
strtimmed = c_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 e003(zvxyz).
ENDIF.
MESSAGE s002(zxyz) WITH g_jobname.
ENDIF.
ENDIF.
Job is getting scheduled immediately as well as the Spool is generated successfully. But it is not printing immediately.
How can I print the Spool immediately from the Printer?
Thanks & Regards,
Sowmya
2013 Mar 19 6:07 AM
Hope this helps:
http://help.sap.com/saphelp_45b/helpdata/en/34/8e739c6df74873e10000009b38f9b8/content.htm
Try using the FM GET_PRINT_PARAMETERS and pass it in the print parameters.
Found this useful:
http://www.sapdev.co.uk/reporting/rep_submit.htm
-SS-
2013 Mar 19 7:08 AM
Dear Sowmya.
Try to use the following fields in g_print_parameters (PRI_PARAMS).
PDEST = Printer name
PRIMM = 'X'
PRNEW = 'X'
Regards
Michael
2013 Mar 19 10:12 AM
The structure for print parameter, is a little more complex than printer name
Read some documentation like Setting Program-Driven Print Parameters.
For immediate print on a specified printer device :
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
destination = tsp03-padest " p_print
copies = 1
immediately = 'X'
mode = 'BATCH'
no_dialog = 'X'
report = 'Z_XYZ_REPORT'
IMPORTING
out_parameters = pri_params " g_print_parameters
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
Regards,
Raymond
2013 Mar 20 10:21 AM
Thanks for the reply Raymond.
How do I check if the Output has been printed in the given Printer? Since I'm in different location, how to track the same?
The Background Job is 'Completed', but there is no Spool in it. How to check the Output?
I'm unable to find in SP01.
Earlier, I could see the Spool list in my job.
Thanks & Regards,
Sowmya
2013 Mar 20 10:42 AM
There will no longer be a spool via SP01 if you don't also explicitly initialize RELEASE 'Delete after print' parameter of GET_PRINT_PARAMETERS (*) or in user Default values for "Delete after output".
You will be able to see a spool number in SM37 or in table TBTC_SPOOLID even if spool is no longer stored in database/file system.
Regards,
Raymond
(*) Print Parameters
2013 Mar 20 11:00 AM
Hi Raymond,
Thanks again!
Here's my SM37 list:
Yesterday, it was not printing, but Spool was there.
Today, after I used 'GET_PRINT_PARAMETERS'; there's no SPOOL.
My question is:
1) How do we know whether it has printed or not?
2) Why is it not showing the Spool? How do I display the output in the Job Spool?
Thanks & Regards,
Sowmya
2013 Mar 20 12:44 PM
2013 Mar 20 3:17 PM
Hi Raymond,
There's no Spool number
Here's my code:
DATA: g_jobcount TYPE tbtcjob-jobcount,
g_jobname TYPE tbtcjob-jobname
VALUE 'JOB XYZ',
g_user TYPE sy-uname VALUE 'XYZ',
g_printname TYPE rspopshort, "Printer's Short name
g_print_parameters TYPE pri_params.
START-OF-SELECTION .
* Getting Short Name for the Printer
SELECT SINGLE padest
INTO g_printname
FROM tsp03d
WHERE name EQ p_print.
IF sy-subrc EQ 0.
ENDIF.
* Job Open
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = g_jobname
IMPORTING
jobcount = g_jobcount
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc = 0.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
copies = 1
list_name = 'ZVXY'
list_text = 'SUBMIT FROM Z_XYZ'
destination = g_printname
immediately = 'X'
mode = 'BATCH'
no_dialog = 'X'
release = 'X'
user = 'XYZUSR'
IMPORTING
out_parameters = g_print_parameters
valid = g_valid
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 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.
SUBMIT z_xyz_prog_batch TO SAP-SPOOL
SPOOL PARAMETERS g_print_parameters
WITHOUT SPOOL DYNPRO
USER g_user
VIA JOB g_jobname NUMBER g_jobcount
WITH p_file = p_file
AND RETURN.
IF sy-subrc = 0.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = g_jobcount
jobname = g_jobname
strtimmed = c_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 e003(zxy).
ENDIF.
MESSAGE s002(zxy) WITH g_jobname.
ENDIF.
ENDIF.
Earlier when I was not using the Function Module, I was able to see the Spool. Now, I can't see..
Thanks for your help.
Thanks & Regards,
Sowmya
2013 Mar 20 3:54 PM
Should not be related, changing the print parameters should not prevent spool generation, only its content if size not correct. (In my sample I used 'BATCH' mode, but for this reason I also passed Report name.)
Double-click on the step and display print parameters actually used to create the step, click on "Print specifications"
Also if some wrong parameter was passed, you could look to job log.
Regards,
Raymond
2013 Mar 21 4:31 AM
Thanks so much Raymond. I had missed to give 'Report Name' in the FM.
I'm getting the below Spool Problem now:
What is the reason for this?
Thanks & Regards,
Sowmya
2013 Mar 21 7:14 AM
No problem, your spool was printed, only one character may not have been converted between character set 1100 of your system and character set 1116 of the printer device. As both character sets comply to ISO-8859-1 (Latin-1) set that should not matter much.
NB: The report name take line size and count per page from the program.
Regards,
Raymond
2013 Mar 21 7:29 AM
2013 Mar 20 11:06 AM
Hi ,
Check this Link "Spool Consistency Check (SAP Library - SAP Printing Guide (BC-CCM-PRN))"
Regard's
Smruti
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |