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

Printing using SUBMIT statement

Former Member
0 Likes
2,266

Hi

I have a problem in printing using SUBMIT.

I have three printers identified to print certain orders using submit statement.

the list of printers is given in a drop down and once the user selects a printer from the list, i have to generate a spool for the corresponding printer. But this is not happening. The spool is generated for the user's default printer defined in SU50. I have my submit statement below:

SUBMIT zppprbsel WITH aufnr EQ p_wa_batch_res_process_order

WITH werks EQ c_1201 "'1201'

WITH relvn EQ c_0 "'00000000'

WITH relbs EQ c_0 "'00000000'

WITH orig EQ ' '

WITH nach EQ c_x "'X'

TO SAP-SPOOL

*SPOOL PARAMETERS l_dest

WITHOUT SPOOL DYNPRO

WITH DESTINATION = l_dest

WITH IMMEDIATELY = SPACE

WITH KEEP_IN_SPOOL = 'X'

VIA JOB v_job_name

NUMBER v_job_cnt

AND RETURN.

here my l_dest has one of the three printers that the user selects.

when i change my default printer to one of the three printers the spool is generated fine. A spool always generated for the default printer of the user?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,748

Hi,

Before the SUBMIT get the PRINT PARAMETER by using the FM --> GET_PRINT_PARAMETERS

IMPORTING
              out_parameters         = print_parameters

print_parameters-pdest = 'LOCL'. " Change the Destination before passsing the PRINT_PARAMETER to SUBMIT.

Then pass the print_parameters from the FM to the SUBMIT

SUBMIT zppprbsel WITH aufnr EQ p_wa_batch_res_process_order
WITH werks EQ c_1201 "'1201'
WITH relvn EQ c_0 "'00000000'
WITH relbs EQ c_0 "'00000000'
WITH orig EQ ' '
WITH nach EQ c_x "'X'
TO SAP-SPOOL
SPOOL PARAMETERS  print_parameters  "Pass here
WITHOUT SPOOL DYNPRO
WITH DESTINATION = l_dest
WITH IMMEDIATELY = SPACE
WITH KEEP_IN_SPOOL = 'X'
VIA JOB v_job_name
NUMBER v_job_cnt
AND RETURN.

Regards,

Madhukar Shetty

10 REPLIES 10
Read only

Former Member
0 Likes
1,749

Hi,

Before the SUBMIT get the PRINT PARAMETER by using the FM --> GET_PRINT_PARAMETERS

IMPORTING
              out_parameters         = print_parameters

print_parameters-pdest = 'LOCL'. " Change the Destination before passsing the PRINT_PARAMETER to SUBMIT.

Then pass the print_parameters from the FM to the SUBMIT

SUBMIT zppprbsel WITH aufnr EQ p_wa_batch_res_process_order
WITH werks EQ c_1201 "'1201'
WITH relvn EQ c_0 "'00000000'
WITH relbs EQ c_0 "'00000000'
WITH orig EQ ' '
WITH nach EQ c_x "'X'
TO SAP-SPOOL
SPOOL PARAMETERS  print_parameters  "Pass here
WITHOUT SPOOL DYNPRO
WITH DESTINATION = l_dest
WITH IMMEDIATELY = SPACE
WITH KEEP_IN_SPOOL = 'X'
VIA JOB v_job_name
NUMBER v_job_cnt
AND RETURN.

Regards,

Madhukar Shetty

Read only

0 Likes
1,748
  • Set default print parameters for Spool

CALL FUNCTION 'SET_PRINT_PARAMETERS'

EXPORTING

destination = l_dest

line_size = l_linsz.

SUBMIT zppprbsel WITH aufnr EQ p_wa_batch_res_process_order

WITH werks EQ c_1201 "'1201'

WITH relvn EQ c_0 "'00000000'

WITH relbs EQ c_0 "'00000000'

WITH orig EQ ' '

WITH nach EQ c_x "'X'

TO SAP-SPOOL

SPOOL PARAMETERS l_dest

WITHOUT SPOOL DYNPRO

WITH DESTINATION = l_dest

WITH IMMEDIATELY = SPACE

WITH KEEP_IN_SPOOL = 'X'

VIA JOB v_job_name

NUMBER v_job_cnt

AND RETURN.

i put that and still i get the same result... spool is generated to my default printer and not the printer i selected...

Read only

0 Likes
1,748

Hi,

please try

SUBMIT zppprbsel 
  WITH aufnr EQ p_wa_batch_res_process_order 
  WITH werks EQ c_1201 "'1201'
  WITH relvn EQ c_0 "'00000000'
  WITH relbs EQ c_0 "'00000000'
  WITH orig  EQ ' '
  WITH nach  EQ c_x "'X'
VIA JOB v_job_name
NUMBER v_job_cnt
TO SAP-SPOOL
  DESTINATION   = l_dest
  IMMEDIATELY   = SPACE
  KEEP_IN_SPOOL = 'X'
  WITHOUT SPOOL DYNPRO
AND RETURN.

What's the result?

Regards,

Klaus

Read only

0 Likes
1,748

I tried the above logic as well. My printer is still getting the spool and not the selected printer.

Read only

0 Likes
1,748

Sorry,

had a mistake with "="!

Correction:

SUBMIT zppprbsel 
  WITH aufnr EQ p_wa_batch_res_process_order 
  WITH werks EQ c_1201 "'1201'
  WITH relvn EQ c_0 "'00000000'
  WITH relbs EQ c_0 "'00000000'
  WITH orig  EQ ' '
  WITH nach  EQ c_x "'X'
VIA JOB v_job_name
NUMBER v_job_cnt
TO SAP-SPOOL
  DESTINATION   l_dest
  IMMEDIATELY   SPACE
  KEEP_IN_SPOOL 'X'
  WITHOUT SPOOL DYNPRO
AND RETURN.

You have to remove SPOOL PARAMETERS if you pass destination and other parameters and you must'nt pass spool parameters with "WITH" or "=" ...

Regards,

Klaus

Read only

0 Likes
1,748

Hi,

Just a thought.. Please see the default parameters... SYSTEM->USERPROFILE->OWNDATA.. here the you might be having the default printer.. Please keep it blank and see ,also try to put one of the three printers there and see..

Regards,.

Nagaraj

Read only

0 Likes
1,748

When i change my default printer to the required printer, the spool is generating fine. but if i dont change it to the printer i need then also my default printer gets the spool.

Read only

0 Likes
1,748

Hi,

You can specify one printer at one time.. You cannot use both of them.So use one printer.

Regards,

Nagaraj

Read only

0 Likes
1,748

Actually my requirement is like no matter what my default printer set up is, spool should be generated only for the printer that i select in my report.... i am not able to achieve this..... always spool gets generated to my default printer only...

Read only

0 Likes
1,748

Hi Ramya,

This is what i am saying..In place of default printer give the printer which you want out of the three so that it will work for you.. it won't work for other two printers.. else go for one more approach.. don't have any default printer and in the program use "SET_PRINT_PARAMTERS' and 'GET_PRINT_PARAMTERS' and tehre specify the printer and see.

Regards,

Nagaraj