# SAP S4/HANA

Frends offers seamless integration with SAP S4/HANA, enabling you to effortlessly connect and automate data flows involving SAP S4/HANA.

Frends provides tasks for performing all core SAP S4/HANA operations.

By leveraging Frends' task-based approach, you can configure and customize SAP S4/HANA integrations according to your specific requirements. Frends offers a wide range of tasks that facilitate integrations to a variety of systems and protocols.

## Installation & Prerequisites of RFC tasks

Please note that RFC tasks are not available from public Frends task repositories and cannot be found in the Frends UI Task search. Please contact support for installation of those tasks. You must have an existing SAP license before installing RFC tasks.

Tasks utilizing the RFC protocol (`ExecuteRfcQuery` and `ExecuteRfcFunction`) have the following prerequisites.

### Windows Agents

On Windows the Visual C++ Redistributable is required. You can download it from the official Microsoft website: <https://aka.ms/vs/17/release/vc\\_redist.x64.exe>

No other steps required on Windows.

### Linux Agents

#### 1. Download SAP NetWeaver RFC SDK

To use SAP RFC functionality, you need to download the **SAP NetWeaver RFC SDK** from the official SAP website:

1. Go to [SAP NetWeaver RFC SDK](https://support.sap.com/) (SAP account required).
2. Sign in with your SAP credentials.
3. Search for **SAP NetWeaver RFC SDK 7.50**.
4. Download the correct version for **Linux x86\_64**.
5. Extract the downloaded archive:

   ```
   tar -xvf <downloaded_file>.tar.gz
   ```

#### 2. Copy Libraries to System Path

Once extracted, locate the following files inside the `lib` folder of the extracted SDK:

* `libicudata.so.50`
* `libicui18n.so.50`
* `libicuuc.so.50`
* `libsapnwrfc.so`
* `libsapucum.so`

Copy them to the system directory:

```
mkdir -p /opt/frends-sap-connector
cp libicudata.so.50 libicui18n.so.50 libicuuc.so.50 libsapnwrfc.so libsapucum.so /opt/frends-sap-connector/
```

#### 3. Configure the Frends Agent

Open the Frends Agent systemd service override configuration:

```
sudo mkdir -p /etc/systemd/system/frends-agent.service.d
sudo nano /etc/systemd/system/frends-agent.service.d/override.conf
```

Add the following lines:

```
[Service]
Environment="LD_LIBRARY_PATH=/opt/frends-sap-connector"
```

Then, reload and restart the service:

```
sudo systemctl daemon-reload
sudo systemctl restart frends-agent
```

## RFC Authentication

The SAP RFC tasks support two authentication methods: connection string and INI file. Both methods ultimately use the SAP NetWeaver RFC SDK 7.50, which receives the connection parameters as a dictionary - either parsed from the connection string or read from the INI file.

### Example: Connection String

```
ashost=sap.example.com;sysnr=23;client=100;user=MYUSER;passwd=MYPASSWORD;lang=EN`
```

### Example: INI File

```
ashost=sap.example.com
sysnr=23
client=100
user=MYUSER
passwd=MYPASSWORD
lang=EN
```

### SNC and Secure Connections

All SNC (Secure Network Communication) parameters supported by the SAP NetWeaver RFC SDK can also be used in the connection string or INI file. This allows you to establish secure, encrypted RFC connections and enable single sign-on scenarios using SAP’s security libraries (such as SAPCryptoLib or CommonCryptoLib).

Typical SNC parameters include:

```
snc_mode=1
snc_partnername=p:CN=SAP/ABC@EXAMPLE.COM
snc_qop=9
snc_myname=p:CN=MYUSER@EXAMPLE.COM
```

Additionally, for Windows add :

```
snc_lib=C:\path\to\sapcrypto.dll
```

or for Linux

```
snc_lib=C:\path\to\libsapcrypto.so
```

If these parameters are provided, they will be passed as-is to the SAP RFC SDK, which handles authentication and encryption accordingly.

## Use cases

Below you will find typical use cases for SAP S4/HANA integrations and how they are implemented in Frends.

### Nightly customer data validation

By using the schedule trigger and the HTTP Request task we can create an integration that validated customer information on a nightly basis and fixes it or reports the problem to the customer's owner.

<figure><img src="https://2096450325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FevBo49UTUjEN84O2WPl6%2Fuploads%2Fgit-blob-6d464360e953d5b3d6665661a8caef590ac248c3%2Fsaphana-nightly-validation.svg?alt=media" alt=""><figcaption><p>Sync CRM data</p></figcaption></figure>
