Checking Files on the Presentation Server 

To retrieve information about files on the presentation server and the presentation server operating system, use the function module WS_QUERY. The most important parameters are listed below. For more information, refer to the function module documentation in the Function Builder (Transaction SE37).

Important Import Parameters

Parameter

Function

FILENAME

Filename for query commands ‘FE’, ‘FL’, and ‘DE’

QUERY

Query command

The import parameter QUERY defines the query. Important query commands:

Export Parameter

Parameter

Function

RETURN

Result of the query (‘0’ = no, ‘1’ = yes)

Exception Parameter

Parameter

Function

INV_QUERY

QUERY or FILENAME contains an incorrect value

 

Suppose the presentation server is running under Windows NT, and the file SYSTEM.INI exists as shown below:

The following program returns some of the attributes of the operating system and of the file:

PROGRAM SAPMZTST.

DATA:  FNAME(60), RESULT(30), FLENGTH TYPE I.

FNAME = 'C:\WINNT35\SYSTEM.INI'.

CALL FUNCTION 'WS_QUERY'
     EXPORTING
          QUERY       = 'OS'
     IMPORTING
          RETURN      = RESULT
     EXCEPTIONS
          INV_QUERY   = 1.

IF SY-SUBRC = 0.
  WRITE: / 'Operating System:', RESULT.
ENDIF.

CALL FUNCTION 'WS_QUERY'
     EXPORTING
          QUERY       = 'WS'
     IMPORTING
          RETURN      = RESULT
     EXCEPTIONS
          INV_QUERY   = 1.

IF SY-SUBRC = 0.
  WRITE: / 'Windows:', RESULT.
ENDIF.

CALL FUNCTION 'WS_QUERY'
     EXPORTING
          FILENAME    = FNAME
          QUERY       = 'FE'
     IMPORTING
          RETURN      = RESULT
     EXCEPTIONS
          INV_QUERY   = 1.

IF SY-SUBRC = 0.
  WRITE: / 'File exists ?', RESULT.
ENDIF.

CALL FUNCTION 'WS_QUERY'
     EXPORTING
          FILENAME    = FNAME
          QUERY       = 'FL'
     IMPORTING
          RETURN      = FLENGTH
     EXCEPTIONS
          INV_QUERY   = 1.

IF SY-SUBRC = 0.
  WRITE: / 'File Length:', FLENGTH.
ENDIF.

Output:

Operating System: NT

Windows: WN32

File exists ? 1

File Length: 210

The windowing system WN32 is the windows system of WINDOWS NT. For information about the abbreviations used, place the cursor on the QUERY field in the documentation screen and choose Help.