17.08.2013 Views

Data Interfaces

Data Interfaces

Data Interfaces

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Opening a File<br />

© SAP AG<br />

OPEN DATASET <br />

OUTPUT<br />

FOR INPUT<br />

APPENDING<br />

IF SY-SUBRC NE 0.<br />

.<br />

.<br />

.<br />

To open a file, you use the statement OPEN DATASET . Depending on whether this is<br />

successful, SY-SUBRC is set to 0 or 8. Errors are ignored.<br />

If you do not specify any further options, the file is opened for reading.<br />

Possible options:<br />

FOR OUTPUT<br />

Opens the file for writing. If the file already exists, its contents are deleted, but this applies only after<br />

the end of the program. If the statement occurs in a program, the cursor is simply positioned at the<br />

beginning of the file. You must then specify CLOSE DATASET in order to delete the file. If the file<br />

does not exist, it is generated.<br />

FOR INPUT<br />

Opens an existing file for reading. If the file is already open, the cursor is positioned at the beginning of<br />

the file. You do not have to specify FOR INPUT explicitly.<br />

FOR APPENDING<br />

Opens the file for writing at the end of the file. If the file does not exist, it is generated. If the file is<br />

already open, the cursor is positioned at the end.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!