ballerinax/sap Ballerina library

1.0.0

Overview

SAP is a global leader in enterprise resource planning (ERP) software. Beyond ERP, SAP offers a diverse range of solutions including human capital management (HCM), customer relationship management (CRM), enterprise performance management (EPM), product lifecycle management (PLM), supplier relationship management (SRM), supply chain management (SCM), business technology platform (BTP), and the SAP AppGyver programming environment for businesses.

The ballerinax/sap package provides an HTTP client for interfacing with APIs across SAP's product suite. This client comes with built-in SAP system-complient CSRF token authentication.

Setup guide

In this guide, we'll be utilizing the S/4HANA Sales Order API to showcase the capabilities of the SAP Client.

Step 1: Login

  1. Sign in to your S/4HANA dashboard.

Step 2: Create a Communication System

  1. Under the Communication Management section, click on the Display Communications Scenario title.

    Communication Systems

  2. In the top right corner of the screen, click New.

    Click New

  3. Give a system id.

    System Id

  4. Give the hostname as your S/4HANA hostname.

    Give Hostname

  5. Add Users for Inbound Communication.

    Add User

  6. Select the Authentication Method and User.

    Select User

  7. Click Save.

Step 3: Create a Communication Arrangement

  1. Under the Communication Management section, click on the Display Communications Scenario title.

    Display Scenarios

  2. In the search bar, type Sales Order Integration and select the corresponding scenario from the results.

    Search Sales Order

  3. In the top right corner of the screen, click on Create Communication Arrangement.

    Click Create Arrangement

  4. Enter a unique name for the arrangement.

    Give Arrangement Name

  5. Choose an existing Communication System from the dropdown menu and save your arrangement.

    Select Existing Communication Arrangement

  6. The hostname (<unique id>-api.s4hana.cloud.sap) will be displayed in the top right corner of the screen.

    View Hostname

Quickstart

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

Step 1: Import the module

Import the sap module.

Copy
import ballerinax/sap;

Step 2: Instantiate a new connector

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

sap:Client sapClient = check new (string `https://${hostname}/sap/opu/odata/sap/API_SALES_ORDER_SRV`, {
    auth: {
        username,
        password
    }
});

Step 3: Invoke the connector operation

Now, utilize the available connector operations.

Copy
json salesOrderList = check sapClient->/A_SalesOrder();

Step 4: Run the Ballerina application

Copy
bal run

Examples

The sap connector provides practical examples illustrating usage in various scenarios. Explore these examples, covering use cases like accessing S/4HANA Sales Order (A2X) API.

  1. Send a reminder on approval of pending orders - This example illustrates the use of the sap:Client in Ballerina to interact with S/4HANA APIs. Specifically, it demonstrates how to send a reminder email for sales orders that are pending approval.

Import

import ballerinax/sap;Copy

Metadata

Released date: 5 months ago

Version: 1.0.0

License: Apache-2.0


Compatibility

Platform: java17

Ballerina version: 2201.9.0

GraalVM compatible: Yes


Pull count

Total: 38027

Current verison: 25226


Weekly downloads


Source repository


Keywords

Business Management/ERP

Cost/Paid


Contributors

Other versions

1.1.0

1.0.0