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.
cancel
Showing results for 
Search instead for 
Did you mean: 

Open Dataset Output (transfer) adds a new line

hergardinho
Explorer
0 Kudos
246

Hello guys,

i'm facing a strange issue which i wasn't able to solve by now.

We got a requiremnt to export data from SAP to another destination. This data has packed numbers (p decimals 2 or curr) in it and has to be transferred this way (so no conversion into string or char).

When we transfer the data, (no change if we stay in start-of-selection -> get pernr end-of-selection or collecting the data and looping through itab), some of the rows add a newline to the output file. In the other system it shows that after each iteration the rows move one char to right.

We tried several different methos (binary, legacy binary and preferred legacy binary codepage '1100') but some of the rows just add "randomly" a new line. When watch the hex-values i still dont see any issues.

open dataset file for appending in legacy binary mode codepage '1100'.

loop at itab into row.

transfer row to file.

endloop.

close dataset file.

newline-2.jpg

anybody had a similar problem and maybe has a solution for this?

Best regards.

3 REPLIES 3

FredericGirod
Active Contributor
0 Kudos
181

Why do you use BINARY MODE ? it is not a text file ?

FredericGirod
Active Contributor
0 Kudos
181

Answer is here to propose a solution, do not use it if you want to reply to a comment, use comment

Sandra_Rossi
Active Contributor
0 Kudos
181

A "newline" is a character i.e. one byte or a sequence of bytes (hex 0A in SAP code page 1100) among others. There's also the "carriage return" hex 0D in SAP code page 1100.

A packed number can contain exactly the same byte or sequence e.g. -990 might be represented as hex 990D, where 0D is interpreted as carriage return by a text editor.

If you need further explanations, please show the concerned line in the file in hexadecimal representation and the corresponding ABAP values.