Receiving Operating System Messages Locate the document in its SAP Library structure

To receive the system message sent by the operating system when you try to open a file, use the MESSAGE addition in the OPEN DATASET statement:

Syntax

OPEN DATASET <dsn> MESSAGE <msg>.

This statement imports the message from the operating system and places it in the variable <msg>.

You can use this addition along with the system field SY-SUBRC for error handling.

Example

DATA: MESS(60),
      FNAME(10) VALUE 'hugo.xyz'.

OPEN DATASET FNAME MESSAGE MESS.

IF SY-SUBRC <> 0.
  WRITE: 'SY-SUBRC:', SY-SUBRC,
       / 'System Message:', MESS.
ENDIF.

If the R/3 System is running under UNIX and the file "hugo.xyz" does not exist, this program would display the following:

This graphic is explained in the accompanying text

 

 

 

 

 

 

Leaving content frame