Requirement: Consider a scenario where the communication channel has to automatically start upon availability of data for once in every few months and we are not sure when the data comes in. Furthermore, the data is processed from an SFTP server and client requirement was to automate the process for this scenario.
So, once the data is sent from proxy to PI, it should automatically start the SFTP channel and after processing, the corresponding channel should be automatically stopped.
Background: In many PI interfaces, there is a provision to create ATP to directly pick the data provided we know the date when it has to be scheduled.
This blog concentrates on how to automate start/stop for processing data from SFTP server.
In this scenario, Proxy is triggered from ECC which will invoke XI adapter. The XI Header will contain target URL of XI receiver channel which is overridden by UDF in message mapping, which in turn will invoke respective SFTP channel. After processing, a new flow invoked for common XI channel to stop the respective SFTP sender channel and this is done using External control mechanism of Runtime Workbench.
A proxy will be triggered from SAP ECC whenever the data has to be picked from SFTP server.
There are 2 flows in this scenario:
First flow: Proxy to XI (starts SFTP sender channel)
Second flow: SFTP to XI (stops SFTP sender channel)
Interface Designing in ESR:
Based on particular ID, corresponding channel should start, process the file and stop the channel automatically.
|InterfaceID||Channel to be invoked|
Operation Mapping1: To start particular SFTP channel
Below is the java code to set target URL in XI receiver channel:
To build the source structure using java mapping code and then stop the channel (Parameters binded at runtime(java mapping) to identify particular SFTP channel that has to be stopped)
Below screenshot shows the Parameters binded at runtime(graphical mapping) to create URL for stopping the corresponding channel
Step 1 of Operation mapping (java mapping is used to build source structure for second mapping to run
Attaching the .txt file that contains the java code.
Step 2 of Operation mapping: Graphical mapping is used to generate URL for invoking (start/stop) the channel based on “Action” field from Interface Determination.
Configuring the Channels:
XI Sender Channel: Proxy sender channel is configured to trigger proxy from SAP ECC
XI receiver channel: It is used to start or stop channel based on URL overridden in XI Header
SFTP sender channel (InterfaceID=’JOBUPDATE’ and so it invokes “SFTP_Sender_TNCompensation” channel.
Configuring the collaboration profile agreements:
Sender agreement1: For triggering proxy
Sender agreement2: For invoking SFTP sender channel
Receiver Determination 1:
Receiver Determination 2:
Interface Determination1: For starting SFTP sender channel
Interface Determination2: For stopping SFTP sender channel
Header Mapping : Sender communication component should be changed to SuccessFactors else it will throw binding error as we are invoking channel for SuccessFactors component
On triggering the proxy, based on InterfaceID, the channel will be initiated, processed and stopped eventually.
Note: The SFTP sender channel should be kept in External Control Mode.