How to expose a CSV file as a Service with SAP PI/PRO

Imagine you need to read a file content from a remote application and you do not want to set up a replication?
This scenario explains how to expose a CSV file (here a product list) as a WebService using the standard SOAP Adapter and the WHINT FileReader Adapter.


CSV File:

Design (ESR):

  • Create Service Interfaces (Sender and Receiver side)
  • For the receiver side you can also use the synchronous Inbound Service Interface FileReaderQueryResponse_In which is shipped with the Adapter
  • Optional: Create a Mapping if you do not want to expose the result of the CSV-to-XML conversion of the MessageTransformBean




Configuration (Eclipse/NWDS):


Receiver Channel (FileReader):

SFTP Connectivity (of course you can read the file from NFS or FTP as well):

Module Configuration (MessageTransformBean: CSV->XML):

Upload File to SFTP Server:

Test from SOAP UI:

Update: I think it is obvious that the Files can be also queried with other sender channels, not only from SOAP (like e.g. REST providing the response in JSON format):


How to check if a file exists with SAP PRO/SAP PI

Sometimes we have to check if a file has been written on a file system and perform actions on that. With PI we usually poll a directory using the File Sender Adapter (e.g. in TEST mode if we can not delete the file). Here´s a smarter way:

  1. Schedule a Trigger that runs the File Check periodically (based on your requirement)
  2. Read the directory of the NFS/FTP/SFTP using the FileReader Adapter

Example Configuration

  • Sender: SOAP Message coming from WHINT MessageTrigger Job
  • Receiver: FileReader Query using WHINT FileReader Adapter
  • Both sides use BusinessComponent “FileChecker” here

Create Business Component:

FileChecker 1

Define iFlow/IntegratedConfiguration (SOAP to FileReader):

FileChecker 2

Configure the FileReader Adapter Channel with the file name you look for:

FileChecker 7

As the FileReader Adapter reads synchronously, we have to switch from Async to Sync using the RequestResponseBean and back to Async using the RequestOnewayBean:

FileChecker 8

If the file is found, we need to have a second (Dummy) iFlow/ICO that is receiving the Response Message from the adapter but without processing it:

FileChecker 9

Set up a MessageTriggerJob in NWA / Operations / Jobs according to your needs (the period is configurable very flexible: daily / every 10 minutes / …):

FileChecker 4FileChecker 6

If the file can not be found, the message goes into error:

FileChecker 5

VOILÁ – here is the message in error (System Error).
If you have defined alerting, an automatic E-Mail is triggered!

In case the file is found, no additional message is being generated. This behaviour can be changed if you change the routing of the Dummy iFlow.

This blog is using the following stand-alone solutions:

Simple MFT with SAP PI/SAP PRO

MFT (Managed File Transfer) scenarios are not clearly described by SAP, so please follow this short description to set up a simple MFT scenario:


Polling a source directory/folder via standard FILE/FTP(S)/SFTP adapter, delete or archive the file and write the file(s) to a target directory/folder.

Design Time

No activities needed/mandatory for SLD or ESR (!).
The Service Interfaces (Outbound/Inbound) can be designed of course, but this is not mandatory for the configuration/runtime.
As the file content is not XML, the modeling of a data type is not obligatory.
However, to apply a proper naming and reuse, it would be recommended to create a Software Component (e.g. MFT 1.0 of and create Dummy Service Interfaces (e.g. File_Out / File_In in a namespace e.g.


In the Integration Directory the routing configuration can be done based on the created Service Interfaces or by using Dummy Interfaces explicitly (iFlow in NWDS) or by manually entering the name of the Service Interface in the Integrated Configuration.
For the sender channel configuration make sure you read the Adapter Specific Message Attributes (ASMA) for the File Name to transport it accordingly as meta data to the target communication channel.

And then you are done, no rocket science here…


MFT – Managed File Transfer

Whenever possible, please try to avoid file-based integration (flat or not, going through the file system is not a good integration pattern), see blog post: Avoid using flat files!. However, sometimes it is still the best fit when the connected system does not provide a clean (RESTful or WebService-based) API. This blog series is about how to set up MFT scenarios with SAP PI/SAP NetWeaver Process Orchestration (PRO) in a smart way.

SAP PI/SAP PRO for MFT scenarios