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: 

How to maintain the report output in Spool

Former Member
0 Kudos

Hi All,

I have a requirement to display a normal report and also send the same report output to spool simultaneously while executing in foreground. How can this be done? Any kind of help is welcome.

Regards,

Bansi

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

try creating your own spool request.

Sample


FORM maak_aparte_spool .
  DATA: l_layout       LIKE tsp01-rqpaper,
        l_doctype      LIKE tsp01-rqdoctype,
        l_name         TYPE tsp01-rq0name,
        l_length       TYPE i,
        l_pri_params   TYPE pri_params,
        l_spool_handle TYPE sy-tabix,
        lv_lines       TYPE i,
        l_line_length  TYPE i.

  l_doctype = 'LIST'.
  l_layout = 'X_PAPER'.
  l_name = l_pri_params-plist.

** Open Spool

  CALL FUNCTION 'RSPO_SR_OPEN'
    EXPORTING
      dest             = 'PDUM'
      layout           = l_layout
      name             = l_name
      immediate_print  = l_pri_params-primm
      titleline        = 'this'
      receiver         = l_pri_params-prrec
      division         = l_pri_params-prabt
      authority        = l_pri_params-prber
      doctype          = l_doctype
    IMPORTING
      handle           = l_spool_handle
      spoolid          = gv_spool_nr
    EXCEPTIONS
      device_missing   = 1
      name_twice       = 2
      no_such_device   = 3
      operation_failed = 4
      OTHERS           = 5.



** Schrijven naar spool
  LOOP AT gt_spool INTO gs_spool.

    lv_lines = lv_lines + 1.

    l_line_length = 255.

    CALL FUNCTION 'RSPO_SR_WRITE'
      EXPORTING
        handle = l_spool_handle
        text   = gs_spool
        length = l_line_length.

    IF lv_lines EQ '65'.
      CALL FUNCTION 'RSPO_SR_PAGE_BREAK'
        EXPORTING
          handle           = l_spool_handle
        EXCEPTIONS
          handle_not_valid = 1
          operation_failed = 2
          OTHERS           = 3.
      CLEAR: lv_lines.
    ENDIF.

  ENDLOOP.

* Zorg ervoor dat er op het einde zoiezo een page break zit
* dit ivm met het openen van de PDF
  CALL FUNCTION 'RSPO_SR_PAGE_BREAK'
    EXPORTING
      handle           = l_spool_handle
    EXCEPTIONS
      handle_not_valid = 1
      operation_failed = 2
      OTHERS           = 3.

** Spool sl
  CALL FUNCTION 'RSPO_SR_CLOSE'
    EXPORTING
      handle = l_spool_handle.

ENDFORM.                    " MAAK_APARTE_SPOOL

Best regards,

John

2 REPLIES 2

Former Member
0 Kudos

Hi,

try creating your own spool request.

Sample


FORM maak_aparte_spool .
  DATA: l_layout       LIKE tsp01-rqpaper,
        l_doctype      LIKE tsp01-rqdoctype,
        l_name         TYPE tsp01-rq0name,
        l_length       TYPE i,
        l_pri_params   TYPE pri_params,
        l_spool_handle TYPE sy-tabix,
        lv_lines       TYPE i,
        l_line_length  TYPE i.

  l_doctype = 'LIST'.
  l_layout = 'X_PAPER'.
  l_name = l_pri_params-plist.

** Open Spool

  CALL FUNCTION 'RSPO_SR_OPEN'
    EXPORTING
      dest             = 'PDUM'
      layout           = l_layout
      name             = l_name
      immediate_print  = l_pri_params-primm
      titleline        = 'this'
      receiver         = l_pri_params-prrec
      division         = l_pri_params-prabt
      authority        = l_pri_params-prber
      doctype          = l_doctype
    IMPORTING
      handle           = l_spool_handle
      spoolid          = gv_spool_nr
    EXCEPTIONS
      device_missing   = 1
      name_twice       = 2
      no_such_device   = 3
      operation_failed = 4
      OTHERS           = 5.



** Schrijven naar spool
  LOOP AT gt_spool INTO gs_spool.

    lv_lines = lv_lines + 1.

    l_line_length = 255.

    CALL FUNCTION 'RSPO_SR_WRITE'
      EXPORTING
        handle = l_spool_handle
        text   = gs_spool
        length = l_line_length.

    IF lv_lines EQ '65'.
      CALL FUNCTION 'RSPO_SR_PAGE_BREAK'
        EXPORTING
          handle           = l_spool_handle
        EXCEPTIONS
          handle_not_valid = 1
          operation_failed = 2
          OTHERS           = 3.
      CLEAR: lv_lines.
    ENDIF.

  ENDLOOP.

* Zorg ervoor dat er op het einde zoiezo een page break zit
* dit ivm met het openen van de PDF
  CALL FUNCTION 'RSPO_SR_PAGE_BREAK'
    EXPORTING
      handle           = l_spool_handle
    EXCEPTIONS
      handle_not_valid = 1
      operation_failed = 2
      OTHERS           = 3.

** Spool sl
  CALL FUNCTION 'RSPO_SR_CLOSE'
    EXPORTING
      handle = l_spool_handle.

ENDFORM.                    " MAAK_APARTE_SPOOL

Best regards,

John

Former Member
0 Kudos

Hi,

Please refer the below link for the options,

http://help.sap.com/saphelp_45b/helpdata/en/d9/4a99d051ea11d189570000e829fbbd/content.htm

Regards,

Selva K