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

Unicode 'OPEN 004' error

Former Member
0 Likes
1,507

Hi,

For OPEN DATASET statement, I get error OPEN 004 error in UCCHECK.

Can you please let me know what addition should be used to solve this problem?

ENCODING DEFAULT ??

ENCODING UTF-8 ??

ENCODING NON_UNICODE ??

As per SAP Help, I have added ENCODING DEFAULT but still not sure as I have seen ENCODING NON_UNICODE in some of the SAP standard programs.

Please advice.

Regards,

yogita

1 ACCEPTED SOLUTION
Read only

uwe_schieferstein
Active Contributor
0 Likes
1,337

Hello Yogita

UCCHECK error OPEN 004 means that the ENCODING option is missing for the OPEN DATASET statement. Under unicode this option is mandatory.

If your SAP system is a Unicode system then there is no difference between ENCODING UTF-8 and ENCODING DEFAULT because under unicode default = utf-8.

Which encoding you need to choose depends on the file that is to be read or written. Recently I adjusted a file interface program for a customer who had upgraded his systems to ECC 6.0 Unicode (from 4.6c non-Unicode). For almost all file interfaces the ENCODING DEFAULT worked. However, for a specific interface I had to use ENCODING NON_UNICODE.

Thus, for reading files you have to check the read file contents (in debugging mode) to check which encoding works.

For writing files you have to check what the receiver expects.

Regards

Uwe

9 REPLIES 9
Read only

Former Member
0 Likes
1,337

Hi

We have added the option ENCODING NON-UNICODE and it works.

Regards

Shounak

Read only

0 Likes
1,337

OPEN DATASET lv_file for OUTPUT IN TEXT MODE ENCODING NON-UNICODE.

<i>ENCODING NON_UNICODE</i> corresponds to NON-UNICODE in non-Unicode systems. So can somebody clarify if ENCODING utf-8 is the appropriate addition in Unicode system?

Thanks,

Yogita

Read only

former_member194669
Active Contributor
0 Likes
1,337

Hi,

Try to use


open dataset fnam for output in legacy text mode code page '1100'.

aRs

Read only

0 Likes
1,337

Hi,

I am really confuse now. I have many OPEN 004 errors in my UCCHECK list. I wanted to know to solve the OPEN 004 error what is the appropriate addition. As per SAP help documentation, it seems ENCODING utf-8 should solve the OPEN 004 error.

Can somebody confirm what is the correct addition with ENCODING to solve this error?

Thanks,

Yogita

Note : I had checked all the additions ex. DEFAULT, NON-UNICODE and UTF-8 and it all solves the UCCHECK error, so want to know which is more appropriate solution

Read only

former_member194669
Active Contributor
0 Likes
1,337

Hi,

Please find OPEN error in UCCHECK and how to correct the same

OPEN 004 --> Add ENCODING addition to statement i.e.

OPEN DATASET G_DATAFILE for OUTPUT IN TEXT MODE.

would be replaced with

OPEN DATASET G_DATAFILE for OUTPUT IN TEXT MODE ENCODING ON-UNICODE.

OPEN 002 --> IN..Mode is expected within open dataset command. i.e.

OPEN DATASET wfilepath FOR OUTPUT.

would be replaced with

OPEN DATASET wfilepath FOR OUTPUT IN TEXT MODE ENCODING NON-UNICODE. Or

OPEN DATASET wfilepath FOR OUTPUT IN BINARY MODE.

OPEN 001--> FOR INPUT, FOR OUTPUT, FOR APPENDING or FOR UPDATE expected! i.e.

OPEN DATASET wfilepath FOR OUTPUT.

would be replaced with

OPEN FOR OUTPUT DATASET wfilepath FOR OUTPUT IN TEXT MODE.

aRs

Points are always welcome.

Read only

0 Likes
1,337

Hi,

From your reply what I understand is :

OPEN DATASET G_DATAFILE for OUTPUT IN TEXT MODE.

would be replaced with

OPEN DATASET G_DATAFILE for OUTPUT IN TEXT MODE ENCODING <b>NON-UNICODE.</b>

If that is the case, then in which scenario we should use ENCODING utf-8?

Thanks for your help!,

Regards,

Yogita

Read only

uwe_schieferstein
Active Contributor
0 Likes
1,338

Hello Yogita

UCCHECK error OPEN 004 means that the ENCODING option is missing for the OPEN DATASET statement. Under unicode this option is mandatory.

If your SAP system is a Unicode system then there is no difference between ENCODING UTF-8 and ENCODING DEFAULT because under unicode default = utf-8.

Which encoding you need to choose depends on the file that is to be read or written. Recently I adjusted a file interface program for a customer who had upgraded his systems to ECC 6.0 Unicode (from 4.6c non-Unicode). For almost all file interfaces the ENCODING DEFAULT worked. However, for a specific interface I had to use ENCODING NON_UNICODE.

Thus, for reading files you have to check the read file contents (in debugging mode) to check which encoding works.

For writing files you have to check what the receiver expects.

Regards

Uwe

Read only

0 Likes
1,337

Thanks Uwe and All!

Read only

former_member194669
Active Contributor
0 Likes
1,337

Hi,

As per my understanding:

Unlike other standard code pages, Unicode defines a character set that includes virtually all characters used in the world and therefore provides a consistent, global character encoding.

When converting from UTF-16 to UTF-8 and algorithm determines the number of bytes required and "inserts" the Lead Byte Indicator and Follow Byte Indicator(s) as needed.

UTF-8 : Unicode Transformation Format based on 8 bit representation CESU-8 : Compatibility Encoding Scheme of UTF-16 on an 8-bit base. UTF-16 : Unicode Transformation Format based on 16 bit representation. UTF-32 .

Each encoding offers advantages and disadvantages. The 8-bit encodings are well-suited for data transfer, because all 7-bit US ASCII characters retain the same code points and this makes communication with legacy, non-Unicode systems easier.

aRs