Skip to Content
author's profile photo Former Member
Former Member

Spool File

Hi Group,

How to conver Spool file into text file in SAP.

I got Spoll request number when I printed the foem,now in SP01 I am able to see the form,I need to convert it into text file.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on Sep 19, 2006 at 07:48 PM

    Hi,

    By using FM <b>RSPO_RETURN_ABAP_SPOOLJOB</b> you will be able to get the ASCII text of your Spool, which you can download to your local HD and open with MS Word.

    Hope this will help.

    Regards,

    Ferry Lianto

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Ferry,

      When I am using RSPO_RETURN_ABAP_SPOOLJOB Fm by passing spool request as import parameter its throwing exception

      <b>NOT_ABAP_LIST</b>,here I am attaching the code.

      INCLUDE OLE2INCL.
      *------TABLAS INTERNAS-------------------------------------------------*
      DATA I_BUFFER(132) OCCURS 1000000 WITH HEADER LINE.
      DATA  P_SPOOL LIKE TSP01-RQIDENT.
      P_SPOOL = '13215'.
      CALL FUNCTION 'RSPO_RETURN_ABAP_SPOOLJOB'
      EXPORTING
      RQIDENT = P_SPOOL
      FIRST_LINE = 1
      LAST_LINE = 9999999
      TABLES
      BUFFER = I_BUFFER
      EXCEPTIONS
      NO_SUCH_JOB = 1
      NOT_ABAP_LIST = 2
      JOB_CONTAINS_NO_DATA = 3
      SELECTION_EMPTY = 4
      NO_PERMISSION = 5
      CAN_NOT_ACCESS = 6
      READ_ERROR = 7
      OTHERS = 8.
      
      IF SY-SUBRC NE 0.
      MESSAGE E398(00) WITH 'Error' SY-SUBRC
      'al leer la orden de spool' P_SPOOL.
      ENDIF.
      
      
      
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
      *   BIN_FILESIZE                    =
          FILENAME                        = 'B:DMIGSPOOLCONVERT'
          FILETYPE                        = 'ASC'
      *   APPEND                          = ' '
      *   WRITE_FIELD_SEPARATOR           = ' '
      *   HEADER                          = '00'
      *   TRUNC_TRAILING_BLANKS           = ' '
      *   WRITE_LF                        = 'X'
      *   COL_SELECT                      = ' '
      *   COL_SELECT_MASK                 = ' '
      *   DAT_MODE                        = ' '
      *   CONFIRM_OVERWRITE               = ' '
      *   NO_AUTH_CHECK                   = ' '
      *   CODEPAGE                        = ' '
      *   IGNORE_CERR                     = ABAP_TRUE
      *   REPLACEMENT                     = '#'
      *   WRITE_BOM                       = ' '
      *   TRUNC_TRAILING_BLANKS_EOL       = 'X'
      *   WK1_N_FORMAT                    = ' '
      *   WK1_N_SIZE                      = ' '
      *   WK1_T_FORMAT                    = ' '
      *   WK1_T_SIZE                      = ' '
      * IMPORTING
      *   FILELENGTH                      =
        TABLES
          DATA_TAB                        = I_BUFFER
      *   FIELDNAMES                      =
      * EXCEPTIONS
      *   FILE_WRITE_ERROR                = 1
      *   NO_BATCH                        = 2
      *   GUI_REFUSE_FILETRANSFER         = 3
      *   INVALID_TYPE                    = 4
      *   NO_AUTHORITY                    = 5
      *   UNKNOWN_ERROR                   = 6
      *   HEADER_NOT_ALLOWED              = 7
      *   SEPARATOR_NOT_ALLOWED           = 8
      *   FILESIZE_NOT_ALLOWED            = 9
      *   HEADER_TOO_LONG                 = 10
      *   DP_ERROR_CREATE                 = 11
      *   DP_ERROR_SEND                   = 12
      *   DP_ERROR_WRITE                  = 13
      *   UNKNOWN_DP_ERROR                = 14
      *   ACCESS_DENIED                   = 15
      *   DP_OUT_OF_MEMORY                = 16
      *   DISK_FULL                       = 17
      *   DP_TIMEOUT                      = 18
      *   FILE_NOT_FOUND                  = 19
      *   DATAPROVIDER_EXCEPTION          = 20
      *   CONTROL_FLUSH_ERROR             = 21
      *   OTHERS                          = 22
                .
      IF SY-SUBRC <> 0.
      * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
      *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      

  • Posted on Sep 20, 2006 at 01:14 AM

    Hi,

    <b>Steps to Download Spool to a File</b>

    1. Goto SP01 transaction.

    2. Enter the Spool no. and click EXECUTE

    3. Tick the CHECK BOX on Left hand side and Click DISPLAY

    4. Spool Request -> Forward -> Save to Local File -> Unconverted/Excel ( as per your requirement ) -> Provide the path and file name -> Transfer

    This will save the file.

    Best regards,

    Prashant

    PS : Please reward all helpful answers

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 20, 2006 at 08:54 AM

    Hi,

    * <b>The program select spools
    *          and export then under PDF format</b>.
    REPORT YYJPL14                        "NO STANDARD PAGE HEADING
                    LINE-SIZE 170
                    LINE-COUNT 58
                    MESSAGE-ID Y_LOCAL_FR22.
    *=-------------------------------------------------------------------=*
    TABLES: TSP01, RSPOTYPE.
    *----------------------------------------------------------------------*
    DATA: DEFDIR(256) VALUE 'C:SAP'
         ,_TSP01 LIKE TSP01 OCCURS 0 WITH HEADER LINE,
          AUTHORITY LIKE  RSTSTYPE-AUTHCHECKD,
          CLIENT LIKE  RSTSTYPE-CLIENT,
          NAME LIKE  RSTSTYPE-NAME,
          PART LIKE  TST01-DPART,
          CHARCO LIKE  RSTSTYPE-CHARCO,
          CREATER LIKE  RSTSTYPE-CREATER,
          CREDATE LIKE  RSTSTYPE-CREDATE,
          DELDATE LIKE  RSTSTYPE-DELDATE,
          MAX_CREDATE LIKE  RSTSTYPE-CREDATE,
          MAX_DELDATE LIKE  RSTSTYPE-DELDATE,
          NON_UNIQ LIKE  RSTSTYPE-SEL_OK,
          NOOF_PARTS LIKE  TST01-DNOPARTS,
          RECTYP LIKE  RSTSTYPE-RECTYP,
          SIZE LIKE  TST01-DSIZE,
          STOTYP LIKE  TST01-DSTOTYP,
          TYPE LIKE  RSTSTYPE-TYPE,
          OBJTYPE LIKE  RSTSTYPE-TYPE,
          NUMBYTES TYPE I,
          PDFSPOOLID LIKE TSP01-RQIDENT,
          jobname like tbtcjob-jobname,
          JOBCOUNT LIKE TBTCJOB-JOBCOUNT,
          PDF LIKE TLINE OCCURS 0 WITH HEADER LINE,
          P_FILE LIKE RLGRAP-FILENAME VALUE 'C:tempfile.pdf'.
    RANGES: S_RQFIN FOR TSP01-RQFINAL.
    RANGES: _CRETIME FOR TSP01-RQCRETIME.
    *----------------------------------------------------------------------*
    SELECT-OPTIONS:
           _RQIDENT FOR TSP01-RQIDENT,
           _RQOWNER FOR TSP01-RQOWNER,
           _CREDATE FOR RSPOTYPE-CREDATE,
                                           "_cretime FOR tsp01-rqcretime,
           _RQ2NAME FOR TSP01-RQ2NAME,
           _RQDEST  FOR TSP01-RQDEST .
    PARAMETERS:
           DIR LIKE RLGRAP-FILENAME DEFAULT DEFDIR.
    *----------------------------------------------------------------------*
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR DIR.
    *----------------------------------------------------------------------*
      CALL FUNCTION 'WS_FILENAME_GET'
           EXPORTING
                DEF_FILENAME     = '*.*'
                DEF_PATH         = DEFDIR
                MASK             = ',All files,*.*.'
                MODE             = 'O'
                TITLE            = 'Get filename for directory'
           IMPORTING
                FILENAME         = DIR
           EXCEPTIONS
                INV_WINSYS       = 01
                NO_BATCH         = 02
                SELECTION_CANCEL = 03
                SELECTION_ERROR  = 04.
      IF SY-SUBRC <> 0.
        SY-SUBRC = SY-SUBRC + 0.
      ENDIF.
      DEFDIR = DIR.
    *=-------------------------------------------------------------------=*
    START-OF-SELECTION.
    *=-------------------------------------------------------------------=*
    *here inspiration comes from RSPOSP01 (transaction SP01)
      REFRESH S_RQFIN.            " select all C & . required for index!!!
      S_RQFIN-LOW = 'C'.
      S_RQFIN-SIGN = 'I'.
      S_RQFIN-OPTION = 'EQ'.
      APPEND S_RQFIN.
      S_RQFIN-LOW = '.'.
      APPEND S_RQFIN.
    
      CLEAR _CRETIME.
      REFRESH _CRETIME.
      LOOP AT _CREDATE.
        _CRETIME-SIGN = _CREDATE-SIGN.
        _CRETIME-OPTION = _CREDATE-OPTION.
        IF _CREDATE-LOW IS INITIAL.
          CLEAR _CRETIME-LOW.
        ELSE.
          _CRETIME-LOW(8) = _CREDATE-LOW.
          _CRETIME-LOW+8(8) = '00000000'.
        ENDIF.
        IF _CREDATE-HIGH IS INITIAL.
          CLEAR _CRETIME-HIGH.
        ELSE.
          _CRETIME-HIGH(8) = _CREDATE-HIGH.
          _CRETIME-HIGH+8(8) = '23595900'.
        ENDIF.
        APPEND _CRETIME.
      ENDLOOP.
    *find the spool list
      SELECT * FROM TSP01
             INTO CORRESPONDING FIELDS OF TABLE _TSP01
             WHERE RQFINAL IN S_RQFIN AND
                   RQIDENT IN _RQIDENT AND
                   RQOWNER IN _RQOWNER AND
                   RQCRETIME IN _CRETIME AND
                   RQ2NAME IN _RQ2NAME AND
                   RQDEST  IN _RQDEST .
      LOOP AT _TSP01.
        MOVE-CORRESPONDING _TSP01 TO TSP01.
    *authority to work with spool
        CALL FUNCTION 'RSPO_CHECK_JOB_PERMISSION'
             EXPORTING
                  ACCESS        = 'BASE'
                  SPOOLREQ      = TSP01
             EXCEPTIONS
                  NO_PERMISSION = 1
                  OTHERS        = 2.
    *check authority
        CHECK SY-SUBRC = 0.
    *here inspiration comes from RSTXPDFT4
    *retrieve spool attributes
        client = tsp01-rqclient.
        name   = tsp01-rqo1name.
        CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
             EXPORTING
                  AUTHORITY     = 'SP01'
                  CLIENT        = CLIENT
                  NAME          = NAME
                  PART          = 1
             IMPORTING
                  CHARCO        = CHARCO
                  CREATER       = CREATER
                  CREDATE       = CREDATE
                  DELDATE       = DELDATE
                  MAX_CREDATE   = MAX_CREDATE
                  MAX_DELDATE   = MAX_DELDATE
                  NON_UNIQ      = NON_UNIQ
                  NOOF_PARTS    = NOOF_PARTS
                  RECTYP        = RECTYP
                  SIZE          = SIZE
                  STOTYP        = STOTYP
                  TYPE          = TYPE
                  OBJTYPE       = OBJTYPE
             EXCEPTIONS
                  FB_ERROR      = 1
                  FB_RSTS_OTHER = 2
                  NO_OBJECT     = 3
                  NO_PERMISSION = 4
                  OTHERS        = 5.
        IF SY-SUBRC <> 0.
          MESSAGE E020 WITH SY-SUBRC CLIENT NAME.
          CONTINUE.
        ENDIF.
    *spool À traiter
        WRITE:/
                  TSP01-RQIDENT  ,
                  TSP01-RQ0NAME  ,
                  TSP01-RQ1NAME  ,
                  TSP01-RQ2NAME  ,
                  TSP01-RQOWNER  ,
              (19) TSP01-RQCRETIME USING EDIT MASK '____/__/__ __:__:__',
                  TSP01-RQDEST   ,
                  TSP01-RQPAPER.
        "              client        ,
        "              name          ,
        "              part          ,
        "              charco        ,
        "              creater       ,
        "              credate       ,
        "              deldate       ,
        "              max_credate   ,
        "              max_deldate   ,
        "              non_uniq      ,
        "              noof_parts    ,
        "              rectyp        ,
        "              size          ,
        "              stotyp        ,
        "              type          ,
        "              objtype       .
        if objtype(3) = 'OTF'.
          CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
              EXPORTING
                SRC_SPOOLID                    = TSP01-RQIDENT
                NO_DIALOG                      = ' '
    *       DST_DEVICE                     =
    *       PDF_DESTINATION                =
              IMPORTING
                PDF_BYTECOUNT                  = numbytes
                PDF_SPOOLID                    = pdfspoolid
    *       OTF_PAGECOUNT                  =
                BTC_JOBNAME                    = jobname
                BTC_JOBCOUNT                   = jobcount
              TABLES
                PDF                            = pdf
              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.
          case sy-subrc.
            when 0.
             WRITE: / 'Funktion CONVERT_OTFSPOOLJOB_2_PDF erfolgreich'(001)
                          COLOR COL_POSITIVE.
            when 1.
              WRITE: / 'Kein OTF- und kein ABAP-Spoolauftrag'(002)
                    COLOR COL_negative.
              exit.
            when 2.
              WRITE: / 'Spoolauftrag existiert nicht'(003)
                    COLOR COL_negative.
              exit.
            when 3.
              WRITE: / 'Keine Berechtigung zum Lesen Spoolauftrag'(004)
                    COLOR COL_negative.
              exit.
            when others.
              WRITE: / 'Fehler bei Funktion CONVERT_OTFSPOOLJOB_2_PDF'(005)
                        COLOR COL_negative.
              exit.
          endcase.
        else.
          CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
              EXPORTING
                SRC_SPOOLID                    = TSP01-RQIDENT
                NO_DIALOG                      = ' '
    *       DST_DEVICE                     =
    *       PDF_DESTINATION                =
              IMPORTING
                PDF_BYTECOUNT                  = numbytes
                PDF_SPOOLID                    = pdfspoolid
    *       LIST_PAGECOUNT                 =
                BTC_JOBNAME                    = jobname
                BTC_JOBCOUNT                   = jobcount
              TABLES
                PDF                            = 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.
          case sy-subrc.
            when 0.
            WRITE: / 'Funktion CONVERT_ABAPSPOOLJOB_2_PDF erfolgreich'(006)
                                COLOR COL_POSITIVE.
            when 1.
              WRITE: / 'Kein OTF- und kein ABAP-Spoolauftrag'(002)
                    COLOR COL_negative.
              exit.
            when 2.
              WRITE: / 'Spoolauftrag existiert nicht'(003)
                    COLOR COL_negative.
              exit.
            when 3.
              WRITE: / 'Keine Berechtigung zum Lesen Spoolauftrag'(004)
                    COLOR COL_negative.
              exit.
            when others.
             WRITE: / 'Fehler bei Funktion CONVERT_ABAPSPOOLJOB_2_PDF'(007)
                              COLOR COL_negative.
              exit.
          endcase.
        endif.
    * download PDF file
        TRANSLATE TSP01-RQ2NAME USING '/  : * < > | ? '' " '.
        CONDENSE TSP01-RQ2NAME NO-GAPS.
        CONCATENATE DIR '' TSP01-RQ2NAME '-' TSP01-RQCRETIME '.pdf'
        INTO P_FILE.
    
        CALL FUNCTION 'WS_DOWNLOAD'"or GUI_DOWNLOAD
             EXPORTING
                  BIN_FILESIZE = NUMBYTES
                  FILENAME     = P_FILE
                  FILETYPE     = 'BIN'
             IMPORTING
    *             act_filename = p_file
                  FILELENGTH   = NUMBYTES
             TABLES
                  DATA_TAB     = PDF.
        WRITE: / NUMBYTES, 'Bytes heruntergeladen in Datei'(009),
                 (100) P_FILE.
        ULINE.
      ENDLOOP.
    

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.