Monday, March 9, 2015

Manipulating line end marker for files in ABAP

None SAP system is standalone and needs to communicate with other systems therefore interfaces are very important ABAP deliverables. One of interface techniques is just transfer of the data via files or sometimes called flat files. While they are transferred sometimes even over different OS; there are requirements for different end line markers.
Here it is very important to have a possibility to influence what will be a end line marker set in particular file. This is possible within ABAP command called OPEN DATASET. Within its addition called WITH XXX LINEFEED this can be achieved. In case the statement for WINDOWS OS it looks like:

OPEN DATASET lv_filename FOR OUTPUT 
IN TEXT MODE 
ENCODING DEFAULT 
WITH WINDOWS LINEFEED.


Possible values of line feed:

XXX
End line marker
Unix
LF
WIN
CRLF
NATIVE
line end marker is interpreted in accordance with the current code page
SMART
line end marker depends on access type (INPUT/OUTPUT/APPENDING/UPDATE)

No comments: