cancel
Showing results for 
Search instead for 
Did you mean: 

Encoding Must be Addtion

Former Member
0 Kudos

Hi all,

This is what my Program I have written but it is showing error like

In "Text mode " the "Encoding" addition must be specified.

My Program:

parameters filename(128) default '/usr/tmp/testfile.dat' lower case.

data msg_text(50).

open dataset filename for output in text mode message msg_text.

if sy-subrc ne 0.

write: 'File canot be opened. Reason:', msg_text.

exit.

endif.

Could you please tell me how to solve this Error.

Thanks and Regards,

Ashok.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

In unicode enabled system........you need to add "ENCODING DEFAULT" at the ending.

Otherwise you wil get error.

open dataset filename for output in text mode ENCODING DEFAULT message msg_text.

regards

Sandeep Reddy

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Ashok,

Award points if useful..


The addition IN TEXT MODE opens the file as a text file. 
The addition ENCODING defines how the characters are represented in the text file. 

When writing to a text file, the content of a data object is converted to the representation entered after ENCODING, and transferred to the file. If the data type is character-type and flat, trailing blanks are cut off. In the data type string, trailing blanks are not cut off. 

In Unicode programs, only the content of character-type data objects can be transferred to text files and read from text files. The addition encoding must be specified in Unicode programs, and can only be omitted in non-Unicode programs. 

Thanks,

Ravee...

naimesh_patel
Active Contributor
0 Kudos

If you use TEXT MODE than you have to use one of the following:

TEXT MODE ENCODING {DEFAULT|UTF-8|NON-UNICODE}

Please refer Online Help for more info.

Regards,

Naimesh Patel