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: 

Without SPOOL Dynpro!

Former Member
0 Kudos

Hi friends!

We are trying to submit a SAP Standard program in FOREGROUND mode that gives the output in form of SAP SCRIPT but we are unable to generate a spool from it.

Whenever a SUBMIT statement is triggered a BOX is popped up and spoils the show.

CALL FUNCTION 'GET_PRINT_PARAMETERS'

EXPORTING

no_dialog = 'X'

IMPORTING

valid = w_valid

out_parameters = e_params.

submit ZPROGRAM

to SAP-SPOOL without spool dynpro

spool parameters e_params

AND RETURN

USING SELECTION-SET '28951'.

Any thoughts, how do we generate a SPOOL number from this. As later we need to take this spool and convert into PDF.

Thanks.

11 REPLIES 11

Former Member
0 Kudos

Hi ,

see the sample code..



CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
no_dialog = 'X'
IMPORTING
valid = w_valid
out_parameters = e_params.

submit ZPROGRAM
TO SAP-SPOOL SPOOL PARAMETERS e_PARAMS
                  WITHOUT SPOOL DYNPRO
USING SELECTION-SET '28951'
AND RETURN.

 
 
* To fetch the spool number from TSP01 table
  SELECT rqident
         FROM tsp01
         INTO w_rqident
         UP TO 1 ROWS
         WHERE rq2name = e_params-plist.
  ENDSELECT.

* Function Module to Convert Spool to PDF file
  CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
    EXPORTING
      src_spoolid     = w_rqident
      no_dialog       = 'X'
      dst_device      = 'LP01'
      pdf_destination = 'X'
    TABLES
      pdf             = t_pdf.


* Now t_pdf table contains the PDF data...
" now call the function module in backgrond task destination and push the PDF format dat to external system... 
 

Prabhu

0 Kudos

Prabhu, thanks.

Question is not to generate a PDF from SPOOL, but how to generate a SPOOL number.

If I SUBMIIT a program that gives OUTPUT as a SAP SCRIPT, SPOOL number is not getting generated by the above code provided earlier if I execute in foreground mode.

0 Kudos

in fore ground u cannot get a spool number assigned..

0 Kudos

Thanks for the reply.

Any ideas how to go for it as I need to generate a PDF from a SAPSCRIPT output program and that is possible from a SPOOL number.

Has any one encountered this type of issue?

0 Kudos

Try this way


CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
no_dialog = 'X'
IMPORTING
valid = w_valid
out_parameters = e_params.

e_params-prnew = 'X'.    "<<-==

submit ZPROGRAM
to SAP-SPOOL without spool dynpro
spool parameters e_params
AND RETURN
USING SELECTION-SET '28951'.

0 Kudos

By e_params-prnew = 'X' flag, the document is gettin printed but we wouldnt require that.

Any more thoughts?

Thank you.

0 Kudos

Hey Anderson, Check this program . It works.


REPORT ztest_notepad.

TABLES: tsp01.
"Variables
DATA:
   l_lay    TYPE pri_params-paart,
   l_lines  TYPE pri_params-linct,
   l_cols   TYPE pri_params-linsz,
   l_val    TYPE c.
*Types
TYPES:
   t_pripar TYPE pri_params,
   t_arcpar TYPE arc_params.
"Work areas
DATA:
   lw_pripar TYPE t_pripar,
   lw_arcpar TYPE t_arcpar.

l_lay   = 'X_65_132'.
l_lines = 65.
l_cols  = 132.
CONCATENATE sy-uname sy-datum sy-uzeit  INTO lw_pripar-plist."Give spool name.should be unique

CALL FUNCTION 'GET_PRINT_PARAMETERS'
  EXPORTING
    in_archive_parameters  = lw_arcpar
    in_parameters          = lw_pripar
    layout                 = l_lay
    line_count             = l_lines
    line_size              = l_cols
    no_dialog              = 'X'
  IMPORTING
    out_archive_parameters = lw_arcpar
    out_parameters         = lw_pripar
    valid                  = l_val
  EXCEPTIONS
    archive_info_not_found = 1
    invalid_print_params   = 2
    invalid_archive_params = 3
    OTHERS                 = 4.

lw_pripar-prrel = space.
lw_pripar-primm = space.

SUBMIT zprogram
TO SAP-SPOOL SPOOL PARAMETERS lw_pripar
                  WITHOUT SPOOL DYNPRO
USING SELECTION-SET '28951'
AND RETURN.

* To fetch the spool number from TSP01 table
SELECT SINGLE *
       FROM tsp01
       WHERE rq2name = lw_pripar-plist."Give spool name.should be unique
IF sy-subrc = 0.
  WRITE tsp01-rqident.
ENDIF.
Thanks Venkat.O

0 Kudos

Hello,

what happened? Have you got it solved?

Thanks

Venkat.O

0 Kudos

Many Thanks, Venkat.

We had tried earlier the steps provided but are unable to make it work coz the UNIQUE identifier for the SPOOL is not getting filled.

Because the SUBMIT PROGRAM is calling a SAP SCRIPT and this inturn is calling a GET_PARAMETER box.

Thanks much.

0 Kudos

Hi,

If you check CLOSE_FORM parameters closely, you will get Spool number there itself.

Thanks

Venkat.O

0 Kudos

I cant import the CLOSE_FORM parameter to my Z program as it is a SAP STANDARD program.

Thanks.