We can Retain Original Filename While Transferring Files Between Two SFTP Servers in SAP CPI
What else we can do:
Receives a file from SFTP Server 1
Extracts the original filename
Transfers the file to SFTP Server 2 while retaining the original filename
What will we doing:
We will explore how to efficiently manage and route files in SAP CPI based on their file type. We'll demonstrate how to:
Here i have used sftp with poll enrich you can use from start message as well
Scenario Overview
We are dealing with files on an SFTP server:
Step 1: Setup SFTP server, File zilla and SFTP adapter
Here, I have used free SFTP server and used file zilla to create directory and upload files.
Click - https://sftpcloud.io/tools/free-sftp-server and create
In SAP CPI > Monitor > Security Material, we create a credential entry with:
Username & password from the SFTP server.
This allows CPI to authenticate and access the server.
Prevents man-in-the-middle attacks.
Enhances security and compliance.
Ensures only trusted SFTP servers are accessed.
CPI checks the SFTP server’s fingerprint against the Known Hosts file.
If the fingerprint matches, the connection is established; otherwise, it is blocked.
sample.xml (valid processing file)
sample.txt (to trigger an alert)
Step 2: Configuring SFTP adapter.
Configure Content Modifier to Capturing File Name and Extension
Here, we will use the Content Modifier to extract the file name and extension from the incoming files.
SOME MORE EXAMPLES:
file:name → Returns the full name of the file, including the path (e.g., HCI\InputFile.xml).
file:name.ext → Returns only the file extension (e.g., xml).
file:name.noext → Returns the file name without the extension (e.g., HCI\InputFile).
file:onlyname → Returns only the file name with the extension (e.g., InputFile.xml).
file:onlyname.noext → Returns only the file name without the extension (e.g., InputFile).
file:ext → Returns only the file extension (e.g., xml).
file:parent → Returns the parent directory of the file path.
file:path → Returns the full file path.
file:absolute → Returns a boolean indicating if the file path is absolute.
file:absolute.path → Returns the absolute file path.
file:length or file:size → Returns the file size as a Long type.
file:modified → Returns the last modified date of the file as a Date type.
Here we need only name and extension.
Step 3: Routing Files Using Router
The next step is to route files based on their extension using the Router.
Router Configuration:
FTP – Receiver Side Configuration:
Step 4: Setup mail in SAP CPI (JUMP TO STEP 5 If already Configured.)
Gmail’s SMTP server uses SSL/TLS encryption to secure communication.
When SAP CPI tries to send an email via smtp.gmail.com, it needs to verify Gmail's identity to ensure it’s not connecting to a fraudulent or malicious server.
The certificate provides proof that the SMTP server is authentic and belongs to Google.
Step 5: Configuring Email Alerts for Missing XML Files
If no XML file is found, an alert email is sent notifying about the missing file.
Mail Adapter Configuration:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 26 | |
| 25 | |
| 24 | |
| 20 | |
| 13 | |
| 13 | |
| 12 | |
| 12 | |
| 11 | |
| 11 |