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

Open Dataset BINARY mode problem

Former Member
0 Likes
2,500

Hi Experts !

We have done an upgrade from 4.6c to ECC 6.0. We have a program which downloads a BINARY file on application server. After upgrade the file output has blank spaces between each character. Any pointers to fix this issue would be highly appreciated.

4.6c output

MAS02 ORDERS01 ORDERS02 EDI_DC403

MAS03 ORDERS01 ORDERS02 EDI_DC401

ECC 6.0 output

M A S 0 2 O R D E R S 0 1 O R D E R S 0 2 E D I _ D C 4 0 3

M A S 0 3 O R D E R S 0 1 O R D E R S 0 2 E D I _ D C 4 0 1

Every character has a blank space in between

The syntax in the program is as follows :-

outfile_path = '/tmp/test2.z'.

  OPEN DATASET outfile_path FOR output IN BINARY MODE.

  rec_out = 'MATMAS02 ORDERS01 ORDERS02 EDI_DC403'.
  CONCATENATE rec_out crlf INTO rec_out.
  clear seg_length.
  seg_length = strlen( rec_out ).
  TRANSFER rec_out TO outfile_path LENGTH seg_length.

  clear rec_out.
  rec_out = 'MATMAS03 ORDERS01 ORDERS02 EDI_DC401'
  CONCATENATE rec_out crlf INTO rec_out.
  clear seg_length.
  seg_length = strlen( rec_out ).
  TRANSFER rec_out TO outfile_path LENGTH seg_length.

  CLOSE DATASET outfile_path.

Thanks,

Best regards,

Prashant

1 ACCEPTED SOLUTION
Read only

mvoros
Active Contributor
0 Likes
1,611

Hi,

I guess that you converted to Unicode during upgrade as well. I guess that your extra spaces are a second byte of UTF-16. You should try with LEGACY BINARY MODE where you can defined a codepage. Have a look at the ABAP documentation for command OPEN DATASET.

Cheers

5 REPLIES 5
Read only

mvoros
Active Contributor
0 Likes
1,612

Hi,

I guess that you converted to Unicode during upgrade as well. I guess that your extra spaces are a second byte of UTF-16. You should try with LEGACY BINARY MODE where you can defined a codepage. Have a look at the ABAP documentation for command OPEN DATASET.

Cheers

Read only

Former Member
0 Likes
1,611

Hi Martin,

Yes that correct. I missed that out earlier. If i change the Open dataset binary mode to Open dataset legacy binary mode then i get the desired output.

But if i run the same program in another ECC6 system with Open dataset binary mode i get the desired output. So i have following concerns :-

1. Why is the open dataset binary mode not working in my system

2. Is there any impact of using legacy binary mode instead of binary mode

My program :-

REPORT  ZTEST1234.

DATA: outfile_path LIKE rlgrap-filename,
      seg_length TYPE i VALUE 0.

DATA: BEGIN OF rec_out,
      char(2000) TYPE c.
DATA: END OF rec_out.

DATA: BEGIN OF crlf,
          lf(1) TYPE c,
      END OF crlf.

CLASS: CL_ABAP_CONV_IN_CE DEFINITION LOAD.
crlf-lf = CL_ABAP_CONV_IN_CE=>UCCP('000A').
*crlf-lf = CL_ABAP_CHAR_UTILITIES=>cr_lf.


start-of-selection.

  outfile_path = '/tmp/test2.z'.

    OPEN DATASET outfile_path FOR output IN BINARY MODE.
 
  rec_out = 'MATMAS02 ORDERS01 ORDERS02 EDI_DC403'.
  CONCATENATE rec_out crlf INTO rec_out.
  clear seg_length.
  seg_length = strlen( rec_out ).
  TRANSFER rec_out TO outfile_path LENGTH seg_length.
 
  clear rec_out.
  rec_out = 'MATMAS03 ORDERS01 ORDERS02 EDI_DC401'
  CONCATENATE rec_out crlf INTO rec_out.
  clear seg_length.
  seg_length = strlen( rec_out ).
  TRANSFER rec_out TO outfile_path LENGTH seg_length.
 
  CLOSE DATASET outfile_path.

Thanks,

Best regards,

Prashant

Read only

mvoros
Active Contributor
0 Likes
1,611

Hi,

1) Unicode wasn't mandatory for all Netweaver 7.0 installation. So maybe the other system wasn't installed as Unicode system. Just my guess.

2) I don't know about any impact. Definitely, the system will have to convert it to another code page, hence some performance degradation.

Cheers

Read only

Former Member
0 Likes
1,611

Hi,

I checked the other system in which open dataset BINARY mode worked & that system is also unicode enabled !

Then what is it that my system is missing because of which i am getting such a output.

Thanks,

Best regards,

Prashant

Read only

Former Member
0 Likes
1,611

guys how do you define the file to open for writing?

here whats the extension ? ".Z" in the file?