Other recent blogs
Let's talk
Reach out, we'd love to hear from you!
In middleware projects, we come across messages/files that need to be transmitted between computers having different operating systems (Windows, UNIX, or Mac). All operating systems expect end-of-line in different ways. Windows expect Carriage Return and Line Feed (CRLF), UNIX expects Line Feed (LF), and Mac expects Carriage Return (CR).
Here are a few steps to develop a common utility that can handle any type of file and carry out the end-of-line conversion. This utility is generic and can be used without doing any content conversion.
Step 1: There is no need to define objects in the Enterprise Services Repository (ESR). You can directly create an Integrated Configuration (ICO) in the Integration directory. Create ICO and give a generic (dummy) name to “Interface” and “Namespace.” The interface and the Namespace do not need to be defined in the ESR.
Step 2: Define the sender communication channel which will pick the files. There is no need to do File Content Conversion. You can specify multiple source directories too.
Step 3: Assign the sender channel under “Inbound Processing.”
Step 4: Specify the receiver business system/component.
Step 5: For the receiver interface, specify the same name as the sender interface and Namespace.
Step 6: Create a receiver communication channel. For the same, you can use “Adapter Specific message attributes” as the sender file.
Step 7: Go to the Modules table and specify the below Adapter Module before CallSapAdapter.
Module Name: SAP XI Sample/ConvertCRLFfromToLF
Type: Local Enterprise Bean
Parameter Name: convert
Parameter Value: CRLFtoLF (You can also specify LFtoCRLF if you want UNIX (LF) to Windows (CRLF) conversion)
Now you can begin testing your configuration. Here, I am using two files with different formats:
Source File 1: Windows Format
Receiver File 1: UNIX Format
Source File 2: Windows Format
Receiver File 2: UNIX Format
The SAP standard Adapter Module (ConvertCRLFfromToLF) can be used in any communication channel which will allow enhancements via Adapter module and convert line feeds from one format to the other.