Online Tutorials & Training Materials | STechies.com
Register Login
Advertisement

Read Temse (spool files)

|| 0

Read Temse (spool files)
Stechies

Function: Read Temse data from UNIX filesystem and display. You must reconstruct the relationship between Temse tables and the spool files (tables TST01 and TSP01) for this to work. Dname, Rqident, Dsize are the important fields.

This was used to retreive deleted spool output pertaining to an important project. Spool cleanup job RSPO0041 :-( deleted the spool files regardless of the 'Delete after date'

Procedure :

Restore the spool files (assuming you employ spool_method 'G' and also backup /sapmnt/SID/global/xxxSPOOL directory) in a temp. directory and rename them to numbers which will not overwrite the existing max(dname) in TST01.

Using ABAP or SQL copy in the same table, a row from both TST01 and TSP01 and update TST01:Dname (spool name), TST01:Dsize (size of the spool file in bytes) and TSP01:Rqident (spool number)

REPORT ZREADSP.

PARAMETERS: ZNAME(6).

DATA: HAND4(28) TYPE X,

      LN TYPE I,

      LN2 LIKE RSTSTYPE-LINELENGTH,

      BUFFER(132),

      RSTSRC(6),

      ERRMSG(50),

      HIDE_CLIENT LIKE TST01-DCLIENT VALUE '200',

      HIDE_NAME   LIKE TST01-DNAME ,

      HIDE_PART   LIKE TST01-DPART VALUE '1',

      FULL_NAME(40).

DATA:BEGIN OF BUFTAB OCCURS 1002,

            TXT(8000),

      END OF BUFTAB.

CONCATENATE 'SPOOL' ZNAME INTO HIDE_NAME.

CALL 'C_RSTS_OPEN_READ' ID 'HANDLE' FIELD HAND4

                       ID 'CLIENT' FIELD HIDE_CLIENT

                       ID 'NAME'   FIELD HIDE_NAME

                       ID 'PART'   FIELD HIDE_PART

                       ID 'RC'     FIELD RSTSRC

                       ID 'ERRMSG' FIELD ERRMSG.

CALL 'C_RSTS_READ' ID 'HANDLE' FIELD HAND4

                   ID 'BUFTAB' FIELD BUFTAB-*SYS*

                   ID 'MAXIX'  FIELD 10000

                   ID 'RC'     FIELD RSTSRC

                   ID 'ERRMSG' FIELD ERRMSG.

CALL FUNCTION 'RSPO_SPOOLDATA_WRITE_INIT'.

LOOP AT BUFTAB.

  LN = STRLEN( BUFTAB-TXT ).

  IF LN > 0.

    LN2 = LN.

    CALL FUNCTION 'RSPO_SPOOLDATA_WRITE'

     EXPORTING

          SPOOL_DATA     = BUFTAB-TXT

         DATA_LENGTH    = LN2

     EXCEPTIONS

          DATA_TOO_SHORT = 1

          OTHERS         = 2.

  ELSE.

    SKIP.

  ENDIF.

ENDLOOP.

 


Advertisement
Advertisement
Advertisement