We have prepared a CSV string which has Carriage Return and Line Feed at the end of each line. However when we write to to DISK SAP/ABAP is adding an additional CR. Consider this code
DATA(lv_filename) = '\\server\hot-import\test.csv'.
OPEN DATASET lv_filename FOR OUTPUT IN TEXT MODE TYPE '' ENCODING DEFAULT.
DATA(lv_csv) = 'hello' && cl_abap_char_utilities=>cr_lf && 'world'.
TRANSFER lv_csv TO lv_filename NO END OF LINE.
CLOSE DATASET lv_filename.
The result should be:
hello<cr><lf>
world
Instead we get:
hello<cr>
<cr><lf>
world
We've searched the forums but cannot find a similar issue. Using TYPE '' or not makes no difference. Neither does NO END OF LINE.