Skip to main content

SAP S/4HANA Connector

Connect to SAP S/4HANA to index ERP data including business partners, sales orders, purchase orders, and master data for AI-powered search.

Overview

The SAP connector allows you to:

  • Access OData v2 and v4 services
  • Index business partner, customer, and supplier data
  • Sync sales and purchasing documents
  • Query master data tables (products, cost centers, GL accounts)
  • Perform incremental sync based on modification dates
  • Enable permission-aware search based on entity-level authorizations

Prerequisites

  • SAP S/4HANA system with OData services exposed
  • A service user with read access to the required OData entity sets
  • Network connectivity between ZenSearch and the SAP system
  • API credentials (Basic authentication or OAuth for SAP Cloud)

Authentication

Basic Authentication

Standard username and password against the SAP system:

  1. Enter the SAP OData service base URL
  2. Provide the SAP username and password
  3. Specify the SAP client number (e.g., 100)

OAuth 2.0 (SAP Cloud Platform)

For SAP systems hosted on SAP Business Technology Platform:

  1. Register an OAuth client in the SAP BTP cockpit
  2. Obtain the client ID, client secret, and token endpoint URL
  3. Enter these credentials in ZenSearch

Configuration Reference

SettingTypeRequiredDescription
Base URLstringYesSAP OData service endpoint (e.g., https://my-sap.com/sap/opu/odata/sap/)
Service PathstringNoOData service path (e.g., API_BUSINESS_PARTNER)
OData VersionstringNoProtocol version: v2 or v4 (default: v4)
Auth TypestringYesAuthentication method: basic or oauth2
UsernamestringYes*SAP username (*required for basic auth)
PasswordstringYes*SAP password (*required for basic auth)
Client IDstringNoOAuth client ID (for oauth2 auth)
Client SecretstringNoOAuth client secret (for oauth2 auth)
Token URLstringNoOAuth token endpoint (for oauth2 auth)
SAP ClientstringNoSAP client number (e.g., 100)
LanguagestringNoSAP language key (e.g., EN)
Entity SetsarrayNoSpecific OData entity sets to sync (empty = default set)
FilterstringNoOData $filter expression for record filtering
SelectarrayNoOData $select fields to fetch
ExpandarrayNoOData $expand navigation properties to include
Modified AfterstringNoISO 8601 datetime — only sync records modified after this date
Include PermissionsbooleanNoSync entity-level permissions for permission-aware search
Page SizeintegerNoRecords per page (default: 1,000; max: 5,000)
Max RecordsintegerNoMaximum records per entity set (default: 100,000; 0 = unlimited)

Setup Steps

  1. Add Connector: Navigate to Knowledge → Add Data Source → SAP S/4HANA
  2. Enter Base URL: The OData service endpoint for your SAP system
  3. Configure Authentication: Basic auth or OAuth credentials
  4. Set SAP Client: Specify the SAP client number
  5. Select Entity Sets: Choose which OData entities to index
  6. Configure Filters (optional): Add OData filter expressions
  7. Test & Create: Verify the connection and save

Common Entity Sets

Entity SetModuleContent
A_BusinessPartnerMaster DataCustomer and vendor master records
A_CustomerMaster DataCustomer-specific data
A_SupplierMaster DataSupplier-specific data
A_SalesOrderSalesSales order headers
A_SalesOrderItemSalesSales order line items
A_PurchaseOrderProcurementPurchase order headers
A_PurchaseOrderItemProcurementPurchase order line items
A_ProductMaster DataMaterial master records
A_ProductDescriptionMaster DataMaterial descriptions in multiple languages
A_CostCenterFinanceCost center master data
A_GLAccountInChartOfAccountsFinanceGeneral ledger account definitions

OData Filtering

Use OData $filter expressions to limit which records are synced:

# Sales orders from the last year
CreationDate gt datetime'2025-01-01T00:00:00'

# Business partners in a specific country
Country eq 'US'

# Active customers only
CustomerAccountGroup eq 'KUNA'

Best Practices

  1. Start with key entities — Begin with A_BusinessPartner and A_SalesOrder, then expand to other entity sets
  2. Use OData v4 when available — v4 offers better filtering, pagination, and data type support
  3. Filter by date — Use modified_after for incremental sync to reduce load on the SAP system
  4. Use $select to limit fields — Only fetch the properties you need to reduce data transfer
  5. Use $expand for related data — Include navigation properties to fetch related entities in a single request
  6. Monitor OData rate limits — SAP systems may enforce concurrent request limits; the connector defaults to 20 requests/second
  7. Set a language key — Configure language (e.g., EN) to get descriptions in the correct language
  8. Coordinate with your SAP Basis team — Ensure the OData services are activated and the service user has appropriate authorizations

Troubleshooting

Connection failed

  • Verify the base URL is correct and includes the full OData service path
  • Check that the OData service is activated in SAP (transaction /IWFND/MAINT_SERVICE)
  • Verify network connectivity between ZenSearch and the SAP system

Authentication error

  • Check the username, password, and client number
  • Verify the user has authorization for the specified OData services
  • For OAuth, confirm the client ID, secret, and token URL are correct

Missing data

  • Check that the entity sets are activated in the SAP system
  • Verify the user has authorization objects for the requested data
  • Check if OData $filter expressions are filtering out expected records

Timeout on large entity sets

  • Reduce page_size for entity sets with large records
  • Use $filter to limit the scope of the sync
  • Set max_records to cap the total volume

OData version mismatch

  • Some SAP services only support v2 — check the service definition and switch if needed
  • v4 services use different URL patterns and query syntax than v2