Module sap.s4hana.api_material_stock_srv

ballerinax/sap.s4hana.api_material_stock_srv Ballerina library

1.0.0

Overview

SAP S/4HANA is a robust enterprise resource planning (ERP) solution, designed for large-scale enterprises by SAP SE. It covers core business processes such as finance, procurement, sales, and materials management, including inventory and warehouse operations.

WSO2 SAP S/4HANA Material Stock provides a way to interact with the Material Stock - Read API. The service allows to retrieve material stock information, for example, for consumption by external warehouse applications.

Key Features

  • Query material stock quantities by material, plant, storage location and batch
  • Read stock types and special stock indicators for accurate availability checks
  • Read serial numbers of materials held in stock

Setup guide

This connector uses Basic Authentication with an SAP S/4HANA Cloud communication user. Each S/4HANA API is exposed through a communication scenario, so the user must be assigned to a communication arrangement for the Material Stock Integration (SAP_COM_0164) scenario before the connector can call it.

All the apps used below are in the Communication Management group of the SAP Fiori launchpad.

Communication Management apps

Step 1: Create a communication user

  1. Sign in to your SAP S/4HANA Cloud system as an administrator.
  2. Open the Maintain Communication Users app and choose New.
  3. Enter a user name and a description, set a password, and choose Create.

Note the user name and password. These are the credentials the connector uses.

Step 2: Create a communication system

  1. Open the Communication Systems app and choose New.

  2. Enter a system ID and a system name, and choose Create.

    Create a communication system

  3. Under General > Technical Data, enter a host name and a Logical System (an uppercase ID of up to 10 characters, for example, INTEGRATOR). Some scenarios refuse to activate when the logical system is empty.

  4. Under Users for Inbound Communication, add the communication user from Step 1 with the User Name and Password authentication method.

    Add the communication user for inbound communication

  5. Choose Save.

Step 3: Create a communication arrangement

  1. Open the Communication Arrangements app and choose New.

  2. In the Scenario value help, search for Material Stock Integration and select SAP_COM_0164. This is the scenario that exposes API_MATERIAL_STOCK_SRV, the service this connector calls.

    Search for the communication scenario

  3. Enter a unique name for the arrangement and choose Create.

    Name the communication arrangement

  4. Select the communication system from Step 2. The communication user from Step 1 is filled in as the inbound user. If the scenario lists outbound services that the integration does not need, clear their Active check boxes so that no outbound user is required.

    Communication arrangement details

  5. Choose Save.

Step 4: Note the hostname

Open the saved arrangement. The API-URL next to Own SAP Cloud System shows the hostname (<unique id>-api.s4hana.cloud.sap).

View Hostname

You now have everything the connector needs:

  • hostname - the API hostname, for example, my123456-api.s4hana.cloud.sap
  • username - the communication user name
  • password - the communication user password

Quickstart

To use the sap.s4hana.api_material_stock_srv connector in your Ballerina application, modify the .bal file as follows:

Step 1: Import the module

Import the sap.s4hana.api_material_stock_srv module.

Copy
import ballerinax/sap.s4hana.api_material_stock_srv as materialstock;

Step 2: Instantiate a new connector

Use the hostname and credentials to initiate a client.

Copy
configurable string hostname = ?;
configurable string username = ?;
configurable string password = ?;

materialstock:Client materialStockClient = check new (
    {
      auth: {
        username,
        password
      }
    },
    hostname
);

Step 3: Invoke the connector operation

Now, utilize the available connector operations.

Copy
materialstock:CollectionOfA_MaterialStockWrapper listAMaterialStocks = check materialStockClient->listA_MaterialStocks();

Step 4: Run the Ballerina application

Copy
bal run

Examples

The SAP S/4HANA Inventory Ballerina connectors provide practical examples illustrating usage in various scenarios. Explore these examples, covering use cases like point-of-sale stock reservations and warehouse document automation.

  1. POS Integration with S/4HANA - Check real-time material stock and create reservation documents in S/4HANA from point-of-sale orders.

  2. Warehouse Automation through S/4HANA Integration - Digitize paper delivery notes with OCR and create material documents in S/4HANA from the extracted data.

Import

import ballerinax/sap.s4hana.api_material_stock_srv;Copy

Other versions

1.0.0

Metadata

Released date: 1 day ago

Version: 1.0.0

License: Apache-2.0


Compatibility

Platform: any

Ballerina version: 2201.13.0

GraalVM compatible: Yes


Pull count

Total: 2

Current verison: 2


Weekly downloads


Source repository


Keywords

Name/SAP S/4HANA Material Stock

Type/Connector

Vendor/SAP

Area/ERP & Business Operations

Business Management/ERP

Cost/Paid

S/4HANA

Inventory

Materials Management

MM

Material Stock

Stock


Contributors