2022 Nov 30 9:41 PM
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.
anybody had a similar problem and maybe has a solution for this?
Best regards.
2022 Dec 01 6:52 AM
2022 Dec 01 7:15 AM
Answer is here to propose a solution, do not use it if you want to reply to a comment, use comment
2022 Dec 01 7:25 AM
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.