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: 

Display a spool on screen.

Former Member
0 Kudos

Hi team ABAP,

well, at first i thought that this is gonna be easy. I have a spoolnumber and i simply want to display the spool on the screen.

I was looking a bit in TA SP01, how they do it.

But what they are doing there is quite komplex and nowhere documented properly so i got problem following, understanding and rebuilding all the steps they take.

I also was sacnning the function group SPOOL_SP01R (whcih is used in SP01) for other FM´s that do the job, but wasnt really sucessful.

Isnt there some easy way to display a spool, like a FM that wants just the spoolnumber from me? I dont really get it, since the spoolnumber should be everything you need to display a spool, since it is unique.

I scanned the forum as well for promising threads, but either there are none relating my subject properly or i have to enhance my search algorithm.

9 REPLIES 9

Former Member
0 Kudos

RSPO_RETURN_ABAP_SPOOLJOB ,Pass the spool number and move the data to Internal table .

Display it as you would want .

0 Kudos

This one RSPO_RETURN_ABAP_SPOOLJOB sounded promising, but i get exception NOT_ABAP_LIST.

The spool i´m refering to is a spool created from an output type procession, so it is a SAP-SCRIPT spool.

0 Kudos

Hi,,

Scritps & smart forms generate PDF format in the Spool it is not easy to show on the screen.

Try to download after the conversion



PARAMETERS : p_spool type tsp01-rqident.
 
SELECT SINGLE * FROM tsp01 into rq WHERE rqident = p_spool  .

"Convert spool request into PDF, dependent on document type for scripts & smart forms
IF tsp01-rqdoctype = 'OTF' OR tsp01-rqdoctype = 'SMART'.    "Doc Type is of Sap Script or Smart form
 
    CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
      EXPORTING
        src_spoolid              = p_spool               "Spool Request Number
        no_dialog                = 'X'
        pdf_destination          = 'X'
        no_background            = 'X'
      IMPORTING
        pdf_bytecount            = bin_size
        bin_file                 = pdf_xstring                     "This fm will convert the spool data into
                                                                        "PDF Format in this importing string
      EXCEPTIONS
        err_no_otf_spooljob      = 1
        err_no_spooljob          = 2
        err_no_permission        = 3
        err_conv_not_possible    = 4
        err_bad_dstdevice        = 5
        user_cancelled           = 6
        err_spoolerror           = 7
        err_temseerror           = 8
        err_btcjob_open_failed   = 9
        err_btcjob_submit_failed = 10
        err_btcjob_close_failed  = 11
        OTHERS                   = 12.
    IF sy-subrc  0.
      MESSAGE e712(po) WITH sy-subrc 'CONVERT_OTFSPOOLJOB_2_PDF'.
    ENDIF.
ENDIF.

Former Member
0 Kudos

Hi,

All the spool number are Stored in the table TSP01.


data : Begin of t_data occurs 0,
             text(3000),
          end of t_data.

PARAMETERS : p_spool type tsp01-rqident.

* Fetching Spool data into internal table
  CALL FUNCTION 'RSPO_RETURN_ABAP_SPOOLJOB'
    EXPORTING
      rqident = p_spool
    TABLES
      buffer  = t_data.

Loop at t_data.
   Write :/t_data-text.
Endloop.

OR


TABLES : tsp01.
DATA: rq            TYPE tsp01,
      Dummy         TYPE TABLE OF rspoattr,
      bin_size      TYPE I,
      pdf_size      TYPE so_obj_len,
      pdf_xstring   TYPE xstring,
      la_byte_count TYPE tst01-dsize.
*-- data definition ---------------------------------------------------*
* BCS data
DATA  send_request       TYPE REF TO cl_bcs.
DATA  text               TYPE bcsy_text.
DATA  document           TYPE REF TO cl_document_bcs.
DATA  recipient          TYPE REF TO if_recipient_bcs.
DATA: bcs_exception      TYPE REF TO cx_bcs.
DATA  sent_to_all        TYPE os_boolean.
DATA  pdf_content        TYPE solix_tab.
DATA  lp_pdf_size        TYPE so_obj_len.


PARAMETERS : p_spool type tsp01-rqident.

SELECT SINGLE * FROM tsp01 into rq WHERE rqident = p_spool  .

*   To get attributes of spool request
 CALL FUNCTION 'RSPO_GET_ATTRIBUTES_SPOOLJOB'
    EXPORTING
      rqident     = p_spool             "Spool Request Number
    IMPORTING
      rq          = rq                                 "Consists the Spool Document Type Details
    TABLES
      attributes = dummy
    EXCEPTIONS
      no_such_job = 1
      OTHERS      = 2.
  IF sy-subrc <> 0.
  ENDIF.
*Convert spool request into PDF, dependent on document type
IF rq-rqdoctype = 'OTF' OR rq-rqdoctype = 'SMART'.    "Doc Type is of Sap Script or Smart form

    CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
      EXPORTING
        src_spoolid              = p_spool               "Spool Request Number
        no_dialog                = 'X'
        pdf_destination          = 'X'
        no_background            = 'X'
      IMPORTING
        pdf_bytecount            = bin_size
        bin_file                 = pdf_xstring                     "This fm will convert the spool data into
                                                                        "PDF Format in this importing string
      EXCEPTIONS
        err_no_otf_spooljob      = 1
        err_no_spooljob          = 2
        err_no_permission        = 3
        err_conv_not_possible    = 4
        err_bad_dstdevice        = 5
        user_cancelled           = 6
        err_spoolerror           = 7
        err_temseerror           = 8
        err_btcjob_open_failed   = 9
        err_btcjob_submit_failed = 10
        err_btcjob_close_failed  = 11
        OTHERS                   = 12.
    IF sy-subrc <> 0.
      MESSAGE e712(po) WITH sy-subrc 'CONVERT_OTFSPOOLJOB_2_PDF'.
    ENDIF.
  ELSEIF rq-rqdoctype = 'LIST'.                 "Doc Type of List

* Convert spool to PDF
    CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
      EXPORTING
        src_spoolid              = p_spool               "Spool Request Number
        no_dialog                = ' '
        dst_device               = 'LOCL'
        pdf_destination          = 'X'
        no_background            = 'X'
      IMPORTING
        pdf_bytecount            = la_byte_count
        bin_file                 = pdf_xstring                     "This fm will convert the spool data into
                                                                        "PDF Format in this importing string
      TABLES
        pdf                      = it_pdf
      EXCEPTIONS
        err_no_abap_spooljob     = 1
        err_no_spooljob          = 2
        err_no_permission        = 3
        err_conv_not_possible    = 4
        err_bad_destdevice       = 5
        user_cancelled           = 6
        err_spoolerror           = 7
        err_temseerror           = 8
        err_btcjob_open_failed   = 9
        err_btcjob_submit_failed = 10
        err_btcjob_close_failed  = 11
        OTHERS                   = 12.
    IF sy-subrc <> 0.
      MESSAGE e712(po) WITH sy-subrc 'CONVERT_ABAPSPOOLJOB_2_PDF'.
    ENDIF.
  ELSE.
    MESSAGE e789(po) WITH rq-rqdoctype.
  ENDIF.

"Next call GUI_DOWNLOAD to download the Spool data

Prabhudas

Edited by: Prabhu Das on Sep 22, 2010 4:01 PM

0 Kudos

hmmm thank you, but i have problem in realizing how this helps me.

Stating clearly now what i have and what i need.

I have a write list on screen, including some spool numbers.

When i double click such a spoolnumber the spool shall display, thats all.

The catching of the double click event and such are all done, i jst dont know how to display the spool.

And to be honest i dont really understand why there is no simple solution for this where i just provide spoolnumber.

I dont need a PDF nor do i need to mail it or whatever

0 Kudos

seems i found it!

COM_SE_SPOOL_DISPLAY seems to display a spool with just providing spoolnumber to it.

0 Kudos

Good function module COM_SE_SPOOL_DISPLAY just call by passing th FUnction module in the Program

0 Kudos

Nicely Done Florian !!

will look forward to such more questions from your end

Former Member
0 Kudos

Hi,

if you only want to display a spool try this:


  TYPE-POOLS: SP01R.
*
  DATA: WA_SPOOL   TYPE TSP01-RQIDENT VALUE 28661. "<- your spool-no
  DATA: ID_LIST    TYPE SP01R_ID_LIST.
  DATA: WA_ID_LIST TYPE SP01R_ID.
*
  WA_ID_LIST-ID = WA_SPOOL. APPEND WA_ID_LIST TO ID_LIST.
*
  CALL FUNCTION 'RSPO_RID_SPOOLREQ_DISP'
       EXPORTING
            ID_LIST = ID_LIST.

regards, Dieter