Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
Showing results for 
Search instead for 
Did you mean: 


0 Kudos

not all time but sometimes we get tens of following error

This is probably due to a very large dataset, for which there are

insufficient resources in your installation.

The file "c:\remote_ole\mail\XFKJOUSI.dat" could not properly be closed by the

operating system.

The probable cause is that data sets buffered by the operating system

after they were passed by the ABAP Processor in a previously processed

TRANSFER statement were supposed to be written to the database before

the file was closed. This could not be completed properly because not

enough room was available in the file system.

File: "c:\remote_ole\mail\XFKJOUSI.dat"

Error number: 22

Error text: "Invalid argument"

what is the reason?


0 Kudos

Hi Tuncer,

<b>Good Check out the following documentation

OPEN DATASET dset FOR access IN mode [position]

[ os_addition]



This statement opens the file specified in dset for the access specified in access in a storage mode specified in mode. For dset, a character-type data object is expected, which contains the platform-specific name of the file.

Use additions position, os_addition and error_handling to determine the position at which to open the file, to specify platform-specific additions and to influence error handling.

In Unicode programs, the access and storage modes access and mode must be specified explicitly. If the additions are missing in non-Unicode programs, the file is opened implicitly as a binary file for read access.

In Unicode programs, the file must not yet be open in the current program; otherwise a treatable exception occurs. In non-Unicode programs, the file may already be open. The statement OPEN DATASET then does not reopen the file but moves the read or write position depending on the access mode. In this case, you should not change the access or storage mode.




1. ... MAXIMUM LENGTH mlen

2. ... [ACTUAL] LENGTH alen


This statement exports data from the file specified in dset into the data object dobj. For dobj, variables with elementary data types and flat structures can be specified. In Unicode programs, dobj must be character-type if the file was opened as a text file.

For dset, a character-type data object is expected - that is, an object that contains the platform-specific name of the file. The content is read from the file starting from the current file pointer. After the data transfer, the file pointer is positioned after the section that was read. Using the MAXIMUM LENGTH addition, the number of characters or bytes to be read from the file can be limited. Using ACTUAL LENGTH, the number of characters or bytes actually used can be determined.

In a Unicode program, the file must be opened with an arbitrary access type; otherwise, an exception that cannot be handled will be triggered.



This statement closes the file specified in dset. dset must be character-type data object that contains the platform-specific name of the file. If the file is already closed or does not exist, the statement is ignored and the return value sy-subrc is set to 0.

If the operating system buffers data before it is written to a file and there is still data in the buffer, this data is written to the file before closing.


An opened file that was not explicitly closed using CLOSE DATASET is automatically closed when the program is exited.

System fields

If a file was opened without the FILTER addition, sy-subrc always contains the value 0.

If a file was opened using the FILTER addition, sy-subrc contains the return value of the filter program, which is returned by the operating system. This value is generally 0 if the statement was executed successfully.</b>

Good Luck and thanks