OPEN DATASET dsn.
Effect
Opens the specified file. If no addition is specified, the file is opened for reading and in binary mode .
The return code value is set as follows:
SY-SUBRC = 0 The file was opened.
SY-SUBRC = 8 The file could not be opened.
Example
DATA: DSN(20) VALUE '/usr/test',
RECORD(80).
OPEN DATASET DSN.
DO.
READ DATASET DSN INTO RECORD.
IF SY-SUBRC NE 0.
EXIT.
ELSE.
WRITE: / RECORD.
ENDIF.
ENDDO.
CLOSE DATASET DSN.
The file must be accessible from the application server. You cannot use OPEN DATASET to process files on the current presentation server (whether PC or workstation). The function modules WS_DOWNLOAD and WS_UPLOAD exist for this purpose.
The format of file names depends largely on the operating system. You can access portable programs by using the function module FILE_GET_NAME which returns the physical file name for a given logical file name.
You should specify the path name of any file you wish to open in its absolute form ('/usr/test'), not in its relative form ('test'). Otherwise, the file may be opened in the directory where the SAP System is already running.
When you create a file, it exists under the user name used to start the SAP System. This user name is not normally identical with the user's UNIX name. To be able to create the file, the user must have the appropriate write authorization.
Addition 1
... FOR OUTPUT
Effect
Opens the file for writing. If the file already exists, its contents are deleted unless it is already open. If it is open, the positioning is set back to the start of the file. If the file does not exist, it is generated.
Addition 2
... FOR INPUT
Effect
Opens an existing file for writing. If the file is already open, the positioning is set back only to the start of the file. The addition FOR INPUT does not have to be specified explicitly.
Addition 3
... FOR APPENDING
Effect
Opens the file for writing to the end of the file. If the file does not exist, it is generated. If the file is already open, positioning is only set back to the end.
ABAP TOPIC WISE COMPLETE COURSE
BDC OOPS ABAP ALE IDOC'S BADI BAPI Syntax Check
Interview Questions ALV Reports with sample code ABAP complete course
ABAP Dictionary SAP Scripts Script Controls Smart Forms
Work Flow Work Flow MM Work Flow SD Communication Interface
OTHER PROGRAMMING COURSES:
Dot Net Complete Course Part one and two ASP.NET part one and two
Programming with C and C Sharp
Interview Questions in dot net and asp.net part one part two
Software Testing Complete course part one and two and Interview Questions
Team blog recent posts
ALE EDI work flow and work item
ABAP Syntax for On
Software testing prospective
SHM and Simple Pendulum(physics)
Thank you for visiting SAP ABAP REPORTS.If you liked the post, please subscribe to RSS FEED or get the updates directly into your mail box through EMAIL SUBSCRIPTION.You can contact me at d_vsuresh[at the rate of]yahoo[dot]co[dot]in for any specific feed back.
No comments:
Post a Comment