# SAP S/4HANA

SAP S/4HANA is a core enterprise resource planning (ERP) system that manages finance, procurement, supply chain, and operations data. Connecting SAP S/4HANA to Duvo enables your assignments to query and retrieve live enterprise data directly from your SAP environment, eliminating manual data extraction and SAP transactions. This connection is read-only — assignments can search and retrieve records but cannot create, update, or delete data in your SAP system.

## Setup

### Prerequisites

* An SAP S/4HANA Cloud or on-premise system with OData APIs enabled.
* An OAuth 2.0 client configured in your SAP system for the Client Credentials grant type. This requires an SAP administrator to create a technical user and register an OAuth client with the appropriate API scopes.
* The following OData APIs activated in your SAP Gateway (each API must be explicitly enabled by an administrator):
  * `API_BUSINESS_PARTNER` — Business partner, customer, and vendor data
  * `API_PRODUCT_SRV` — Product and material master data
  * `API_SLSPRICINGCONDITIONRECORD_SRV` — Sales pricing conditions
  * `api_warehouse_2` — Extended Warehouse Management (EWM) data

### Required Permissions

* The technical user (OAuth client) must have read access to each activated OData API.
* OAuth scopes must be registered and assigned for every API the connection will use (for example, `ZAPI_BUSINESS_PARTNER_0001` for the Business Partner API).
* The SAP client number associated with the technical user must have authorization for the relevant business data.

### Connection Fields

| Field             | Description                                                                                                          |
| ----------------- | -------------------------------------------------------------------------------------------------------------------- |
| **SAP Host**      | Your SAP S/4HANA host URL (for example, `https://your-sap-host.com`). This is the base URL for all OData API calls.  |
| **Token URL**     | The OAuth 2.0 token endpoint for your SAP system (for example, `https://your-sap-host.com/sap/bc/sec/oauth2/token`). |
| **Client ID**     | The OAuth client ID for your technical user, created during OAuth client registration in SAP.                        |
| **Client Secret** | The OAuth client secret paired with the Client ID.                                                                   |

### Third-Party Documentation

* [SAP Help Portal — OData API activation](https://help.sap.com/docs/SAP_S4HANA_CLOUD) — Guides for enabling and configuring OData services in SAP Gateway.
* [SAP Help Portal — OAuth 2.0 configuration](https://help.sap.com/docs/SAP_NETWEAVER_AS_ABAP_752/916a7da9481e4265809f28010a113a6a/cdb122d5c82e4b4da48e7c6f18535dfa.html) — Setting up OAuth clients and scopes for API access.

## Capabilities

* **Business partner management** — Search, filter, and retrieve detailed records for customers, vendors, and organizations, including addresses, bank accounts, tax numbers, and roles.
* **Product and material lookup** — Query the product master for materials, finished goods, services, and raw materials with descriptions, plant-level data, and inventory valuations.
* **Sales pricing analysis** — Look up base prices, discounts, and surcharges for products, filter by customer or sales organization, and review pricing validity periods.
* **Warehouse visibility** — List EWM warehouses and inspect storage types and warehouse details.
* **Flexible OData queries** — Run advanced queries against 90+ SAP entity sets across the Business Partner, Product, and Pricing APIs when standard searches are not sufficient.

## Key Benefits

* **Live enterprise data** — Assignments read directly from your SAP system, so reports and decisions reflect current data without manual exports.
* **Secure OAuth authentication** — Uses the standard OAuth 2.0 Client Credentials flow with automatic token caching and refresh, keeping credentials safe and minimizing token endpoint calls.
* **Cross-functional coverage** — A single connection spans finance, procurement, supply chain, pricing, and warehouse data across four SAP APIs.
* **No SAP expertise required** — Assignments translate natural-language questions into the correct OData queries, so business users do not need to know SAP transaction codes or API structures.

## Works Well With

* **Google Sheets or Microsoft Excel** — Pull SAP business partner lists, pricing tables, or inventory valuations into spreadsheets for analysis and stakeholder reporting.
* **Gmail or Microsoft Outlook** — Retrieve SAP records and include them in automated notification or compliance reporting emails.
* **Slack or Microsoft Teams** — Query SAP data and post operational summaries, procurement alerts, or pricing updates to team channels.
