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

how to create spool and output simultaneously ?

venky_k
Explorer
0 Likes
834

Hi All,

How to create spool and output simultaneously?

Let say...

WRITE:/ 'HELLO WORLD'.

The above code displays 'HELLO WORLD', however, I need to create a spool also?

Thanks in advance.

Hi All,

How to create spool and output simultaneously?

Let say...

WRITE:/ 'HELLO WORLD'.

The above code displays 'HELLO WORLD', however, I need to create a spool also?

Thanks in advance.

5 REPLIES 5
Read only

former_member194669
Active Contributor
0 Likes
778

Create another program say B with


Report B.
Write : / 'hello world'.

Then in Program A


Report A.

write : 'Hello World'.

SUBMIT B TO SAP-SPOOL 
    SPOOL PARAMETERS PARAMS 
     WITHOUT SPOOL DYNPRO.

Read only

0 Likes
778

Hi a®s,

Thanks for the quick reply.

Is there any way to create without writing two programs ?

Read only

0 Likes
778

Then try something this way



Report A.

Write : /  'Hello World'.

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.

IF l_val  space AND sy-subrc = 0.
  lw_pripar-prrel = space.
  lw_pripar-primm = space.
  NEW-PAGE PRINT ON
    NEW-SECTION
    PARAMETERS lw_pripar
    ARCHIVE PARAMETERS lw_arcpar
    NO DIALOG.
ENDIF.
WRITE :/ 'Hello World'.
NEW-PAGE PRINT OFF.

Read only

Former Member
0 Likes
778

Hi,

Just goto abap editor..write ur code...i.e

WRITE:/ 'HELLO WORLD'.

click on F8 button..or execte it..you can find the print option after cancel button..click on it..you can see the print screen list..clcik on properties...and cilck on ok button..

A spool request will be automatically created.and the document also ready to be printed..

Hope it helps..

Read only

0 Likes
778

Thanks for the replies..

I have solved the issue as below:

NEW-PAGE PRINT ON
    NEW-SECTION
    PARAMETERS         wa_pripar
    ARCHIVE PARAMETERS wa_arcpar
    NO DIALOG
    NO-TITLE.
    
    WRITE:/ 'HELLO WORLD'.

    NEW-PAGE PRINT OFF.

  v_rqident = sy-spono.

* Display the spool contents as output.
  CALL FUNCTION 'RSPO_DISPLAY_SPOOLJOB'
    EXPORTING
      rqident                    = v_rqident
*     FIRST_LINE                 = 1
*     LAST_LINE                  =
   EXCEPTIONS
     no_such_job                = 1
     job_contains_no_data       = 2
     selection_empty            = 3
     no_permission              = 4
     can_not_access             = 5
     read_error                 = 6
     OTHERS                     = 7
            .
  IF sy-subrc NE 0.
    IF v_rqident NE 0.
      WRITE: 'Spool Error, Spool Number: ', v_rqident.
    ENDIF.
  ENDIF.

Let me know if there are any other approach to solve this.