> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stackone.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect SAP S/4HANA with OAuth 2.0 (Multiple Companies) – StackOne Hub

> Link a SAP S/4HANA account in the StackOne Hub using OAuth 2.0 (Multiple Companies). End-user guide to authorize the integration and start using SAP S/4HANA actions.

> [!WARNING]
>
> Administrator access to the SAP S/4HANA Cloud tenant is required to create the Communication System and Communication Arrangements. The user who connects needs business roles that allow the APIs they will call.

## Find your API host and login host

The API host is where StackOne sends requests and the login host is where you sign in. This method is for SAP S/4HANA Cloud Public Edition.

<ul>
  <li>Take your Fiori launchpad host and add `-api` after the system ID.</li>
  <li>Format: **Login Host** `{system-id}.s4hana.cloud.sap`, **API Host** `{system-id}-api.s4hana.cloud.sap`</li>
  <li>Example: launchpad `https://my123456.s4hana.cloud.sap/ui` gives **Login Host** `my123456.s4hana.cloud.sap` and **API Host** `my123456-api.s4hana.cloud.sap`.</li>
</ul>

## Register StackOne as an OAuth client

The OAuth client is defined on a Communication System in your own tenant.

**1. Create the Communication System**

Open **Communication Systems**, click **New** and create a system for StackOne (mark it **Inbound Only** if offered).

**2. Set the redirect URI**

Under **Inbound OAuth 2.0 Client Settings**, enter the **Callback URL** StackOne shows you as the **Client Redirect URI**.

**3. Add the OAuth 2.0 client**

Under **Users for Inbound Communication**, click **Add**, select **OAuth 2.0** as the authentication method and enter an **OAuth 2.0 Client ID**, for example `STACKONE`.

<ul>
  <li>Copy the same Client ID across when you link.</li>
  <li>No client secret is needed.</li>
</ul>

## Create the Communication Arrangements

Each API is enabled by a Communication Arrangement using the Communication System above.

**1. Create the arrangements**

Open **Communication Arrangements** and create one arrangement per API.

<ul>
  <li>`SAP_COM_0008` for Business Partner, Customer and Supplier</li>
  <li>`SAP_COM_0118` for Sales Quotation, `SAP_COM_0119` for Sales Contract</li>
  <li>`SAP_COM_0294` for Sales Pricing Condition Records, `SAP_COM_0134` for Customer Material</li>
  <li>`SAP_COM_0164` for Material Stock, `SAP_COM_0108` for Material Documents</li>
  <li>Product, Sales Order, Billing and Warehouse APIs do not accept OAuth; connect them with Basic Auth or Client Certificate.</li>
</ul>

**2. Copy the scopes**

In each arrangement, open **Inbound Communication > OAuth 2.0 Details** and copy the scope ID (for example `API_BUSINESS_PARTNER_0001`). Enter all of them in **Scopes**, separated by spaces, then sign in with your SAP business user and consent.

## Link the Account

**1. Connect**

<ul>
  <li>Click **Connect**.</li>
  <li>If applicable, the provider will redirect you to a sign-in or authorization page. Complete the provider's authorization flow.</li>
  <li>Once authorization is successful, you will see a confirmation popup.</li>
</ul>

**2. Use Actions**

Connect an AI platform to the linked account's actions. See [AI Platforms](https://docs.stackone.com/ai-platforms/overview.md).

Other ways to call actions are listed in [Protocols & SDKs](https://docs.stackone.com/connect/protocols-and-sdks.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.