SAP S/4HANA and SFTP / Flat Files integration
SAP S/4HANA stores your procurement and finance data in OData APIs. SFTP and flat files are the standard transport for EDI and legacy systems. Connecting SAP S/4HANA to an SFTP server allows you to export your invoices, purchase orders, and GL records as CSV files on a regular schedule. Downstream systems, trading partners, and file-based integrations can pick up those files without needing direct access to SAP. ml-connector handles the credential management, polling on your schedule, field mapping to CSV format, and the file drop to your SFTP server.
What moves between them
The main flow is from SAP S/4HANA into SFTP / Flat Files. ml-connector polls SAP on a configurable schedule (typically every 4 to 24 hours) and extracts new and modified supplier invoices, purchase orders, GL account line items, and cost center records. Each entity is written as a CSV file to your SFTP server in the inbound folder. SAP S/4HANA is read-only for this integration; ml-connector does not write back into SAP.
How ml-connector handles it
ml-connector caches the OAuth 2.0 access token from SAP after initial authentication and refreshes it before expiry to avoid token errors mid-flow. It polls the OData APIs for each entity using the LastChangeDateTime filter, capturing records added or modified since the last sync. Each record set is transformed into CSV format according to your field mapping specification. ml-connector then connects to your SFTP server using SSH key or password authentication, creates the CSV files in the inbound folder, and records the file names and row counts in its audit log. If the SFTP connection fails, ml-connector retries with exponential backoff and alerts you. File naming conventions are configurable; column order and headers are preserved in every file so downstream systems can parse them reliably.
A real-world example
A mid-sized manufacturing company runs SAP S/4HANA on-premise for procurement and accounting. Their trading partners and internal EDI hub expect invoices, purchase orders, and GL entries as CSV files delivered daily to a shared SFTP server. Before the integration, the procurement team exported data from SAP manually each morning, converted it to CSV in a spreadsheet, and uploaded it to SFTP by hand. This was slow, error-prone, and left a gap if someone forgot. With SAP S/4HANA connected to SFTP via ml-connector, every supplier invoice and PO is automatically extracted overnight and placed on the SFTP server as a CSV file. The EDI hub picks up the files at 6am, processes them automatically, and the trading partners never see a delay. The manual export step is gone.
What you can do
- Export supplier invoices from SAP S/4HANA as CSV files to your SFTP server on a configurable daily or weekly schedule.
- Sync purchase orders and purchase requisitions from SAP S/4HANA to SFTP in CSV format, with full line-item detail.
- Extract GL account line items and post them as CSV to SFTP, preserving cost center and account dimensions for downstream accounting systems.
- Authenticate SAP S/4HANA with OAuth 2.0 Client Credentials and your SFTP server with SSH key or password, both managed encrypted.
- Poll SAP on schedule using OData LastChangeDateTime filters, with retry logic, audit logging, and file delivery confirmation.
Questions
- Does ml-connector write data back into SAP S/4HANA from SFTP?
- No. This integration is one-directional: SAP S/4HANA to SFTP only. ml-connector exports invoices, orders, and GL records from SAP as CSV files. SAP records are read-only from SFTP perspective. If you need two-way sync, that is a separate flow from SFTP or another source into SAP.
- How does ml-connector know which records are new since the last export?
- ml-connector uses the OData LastChangeDateTime filter to query only records created or modified since the last successful poll. On the first run, it exports the full dataset from SAP. On subsequent runs, it captures deltas. This reduces API load and keeps exports fast and lean.
- What happens if the SFTP connection fails or the file upload is interrupted?
- ml-connector retries the SFTP connection with exponential backoff and jitter. If the connection or file write fails after retries, it logs the failure in the audit trail and triggers an alert so you are notified immediately. You can then investigate the SFTP server or network and replay the export on demand.
Related integrations
More SAP S/4HANA integrations
Other systems that connect to SFTP / Flat Files
Connect SAP S/4HANA and SFTP / Flat Files
Free to use. Add your credentials, ping your real systems, and see if we fit.
Get started