Skip to content

Commit

Permalink
Merge pull request #25 from niveathika/main
Browse files Browse the repository at this point in the history
Add shopify to sap example
  • Loading branch information
niveathika authored Jul 11, 2024
2 parents 6148ec8 + aa6afec commit 794a4e4
Show file tree
Hide file tree
Showing 18 changed files with 332 additions and 12 deletions.
6 changes: 6 additions & 0 deletions ballerina/api_sales_order_srv/Module.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,9 @@ use cases like accessing S/4HANA Sales Order (A2X) API.
Demonstrates leveraging the `sap.s4hana.api_sales_order_srv:Client` in Ballerina for S/4HANA API interactions. It
specifically showcases how to respond to a Salesforce Opportunity Close Event by automatically generating a Sales
Order in the S/4HANA SD module.

2. [Shopify to S/4HANA Integration](https://github.com/ballerina-platform/module-ballerinax-sap.s4hana.sales/tree/main/examples/shopify-to-sap) -
Details the integration process between [Shopify](https://admin.shopify.com/), a leading e-commerce platform,
and [SAP S/4HANA](https://www.sap.com/products/erp/s4hana.html), a comprehensive ERP system. The objective is to
automate SAP sales order creation for new orders placed on Shopify, enhancing efficiency and accuracy in order
management.
9 changes: 8 additions & 1 deletion ballerina/api_sales_order_srv/Package.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ use cases like accessing S/4HANA Sales Order (A2X) API.
specifically showcases how to respond to a Salesforce Opportunity Close Event by automatically generating a Sales
Order in the S/4HANA SD module.

2. [Shopify to S/4HANA Integration](https://github.com/ballerina-platform/module-ballerinax-sap.s4hana.sales/tree/main/examples/shopify-to-sap) -
Details the integration process between [Shopify](https://admin.shopify.com/), a leading e-commerce platform,
and [SAP S/4HANA](https://www.sap.com/products/erp/s4hana.html), a comprehensive ERP system. The objective is to
automate SAP sales order creation for new orders placed on Shopify, enhancing efficiency and accuracy in order
management.

## Report Issues

To report bugs, request new features, start new discussions, view project boards, etc., go to
Expand All @@ -99,4 +105,5 @@ the [Ballerina library parent repository](https://github.com/ballerina-platform/
## Useful Links

- Chat live with us via our [Discord server](https://discord.gg/ballerinalang).
- Post all technical questions on Stack Overflow with the [#ballerina](https://stackoverflow.com/questions/tagged/ballerina) tag.
- Post all technical questions on Stack Overflow with
the [#ballerina](https://stackoverflow.com/questions/tagged/ballerina) tag.
6 changes: 6 additions & 0 deletions ballerina/api_salesdistrict_srv/Module.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,9 @@ use cases like accessing S/4HANA Sales Order (A2X) API.
Demonstrates leveraging the `sap.s4hana.api_sales_order_srv:Client` in Ballerina for S/4HANA API interactions. It
specifically showcases how to respond to a Salesforce Opportunity Close Event by automatically generating a Sales
Order in the S/4HANA SD module.

2. [Shopify to S/4HANA Integration](https://github.com/ballerina-platform/module-ballerinax-sap.s4hana.sales/tree/main/examples/shopify-to-sap) -
Details the integration process between [Shopify](https://admin.shopify.com/), a leading e-commerce platform,
and [SAP S/4HANA](https://www.sap.com/products/erp/s4hana.html), a comprehensive ERP system. The objective is to
automate SAP sales order creation for new orders placed on Shopify, enhancing efficiency and accuracy in order
management.
9 changes: 8 additions & 1 deletion ballerina/api_salesdistrict_srv/Package.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ use cases like accessing S/4HANA Sales Order (A2X) API.
specifically showcases how to respond to a Salesforce Opportunity Close Event by automatically generating a Sales
Order in the S/4HANA SD module.

2. [Shopify to S/4HANA Integration](https://github.com/ballerina-platform/module-ballerinax-sap.s4hana.sales/tree/main/examples/shopify-to-sap) -
Details the integration process between [Shopify](https://admin.shopify.com/), a leading e-commerce platform,
and [SAP S/4HANA](https://www.sap.com/products/erp/s4hana.html), a comprehensive ERP system. The objective is to
automate SAP sales order creation for new orders placed on Shopify, enhancing efficiency and accuracy in order
management.

## Report Issues

To report bugs, request new features, start new discussions, view project boards, etc., go to
Expand All @@ -99,4 +105,5 @@ the [Ballerina library parent repository](https://github.com/ballerina-platform/
## Useful Links

- Chat live with us via our [Discord server](https://discord.gg/ballerinalang).
- Post all technical questions on Stack Overflow with the [#ballerina](https://stackoverflow.com/questions/tagged/ballerina) tag.
- Post all technical questions on Stack Overflow with
the [#ballerina](https://stackoverflow.com/questions/tagged/ballerina) tag.
6 changes: 6 additions & 0 deletions ballerina/api_salesorganization_srv/Module.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,9 @@ use cases like accessing S/4HANA Sales Order (A2X) API.
Demonstrates leveraging the `sap.s4hana.api_sales_order_srv:Client` in Ballerina for S/4HANA API interactions. It
specifically showcases how to respond to a Salesforce Opportunity Close Event by automatically generating a Sales
Order in the S/4HANA SD module.

2. [Shopify to S/4HANA Integration](https://github.com/ballerina-platform/module-ballerinax-sap.s4hana.sales/tree/main/examples/shopify-to-sap) -
Details the integration process between [Shopify](https://admin.shopify.com/), a leading e-commerce platform,
and [SAP S/4HANA](https://www.sap.com/products/erp/s4hana.html), a comprehensive ERP system. The objective is to
automate SAP sales order creation for new orders placed on Shopify, enhancing efficiency and accuracy in order
management.
9 changes: 8 additions & 1 deletion ballerina/api_salesorganization_srv/Package.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ use cases like accessing S/4HANA Sales Order (A2X) API.
specifically showcases how to respond to a Salesforce Opportunity Close Event by automatically generating a Sales
Order in the S/4HANA SD module.

2. [Shopify to S/4HANA Integration](https://github.com/ballerina-platform/module-ballerinax-sap.s4hana.sales/tree/main/examples/shopify-to-sap) -
Details the integration process between [Shopify](https://admin.shopify.com/), a leading e-commerce platform,
and [SAP S/4HANA](https://www.sap.com/products/erp/s4hana.html), a comprehensive ERP system. The objective is to
automate SAP sales order creation for new orders placed on Shopify, enhancing efficiency and accuracy in order
management.

## Report Issues

To report bugs, request new features, start new discussions, view project boards, etc., go to
Expand All @@ -99,4 +105,5 @@ the [Ballerina library parent repository](https://github.com/ballerina-platform/
## Useful Links

- Chat live with us via our [Discord server](https://discord.gg/ballerinalang).
- Post all technical questions on Stack Overflow with the [#ballerina](https://stackoverflow.com/questions/tagged/ballerina) tag.
- Post all technical questions on Stack Overflow with
the [#ballerina](https://stackoverflow.com/questions/tagged/ballerina) tag.
6 changes: 6 additions & 0 deletions ballerina/api_sd_sa_soldtopartydetn/Module.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,9 @@ use cases like accessing S/4HANA Sales Order (A2X) API.
Demonstrates leveraging the `sap.s4hana.api_sales_order_srv:Client` in Ballerina for S/4HANA API interactions. It
specifically showcases how to respond to a Salesforce Opportunity Close Event by automatically generating a Sales
Order in the S/4HANA SD module.

2. [Shopify to S/4HANA Integration](https://github.com/ballerina-platform/module-ballerinax-sap.s4hana.sales/tree/main/examples/shopify-to-sap) -
Details the integration process between [Shopify](https://admin.shopify.com/), a leading e-commerce platform,
and [SAP S/4HANA](https://www.sap.com/products/erp/s4hana.html), a comprehensive ERP system. The objective is to
automate SAP sales order creation for new orders placed on Shopify, enhancing efficiency and accuracy in order
management.
9 changes: 8 additions & 1 deletion ballerina/api_sd_sa_soldtopartydetn/Package.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ use cases like accessing S/4HANA Sales Order (A2X) API.
specifically showcases how to respond to a Salesforce Opportunity Close Event by automatically generating a Sales
Order in the S/4HANA SD module.

2. [Shopify to S/4HANA Integration](https://github.com/ballerina-platform/module-ballerinax-sap.s4hana.sales/tree/main/examples/shopify-to-sap) -
Details the integration process between [Shopify](https://admin.shopify.com/), a leading e-commerce platform,
and [SAP S/4HANA](https://www.sap.com/products/erp/s4hana.html), a comprehensive ERP system. The objective is to
automate SAP sales order creation for new orders placed on Shopify, enhancing efficiency and accuracy in order
management.

## Report Issues

To report bugs, request new features, start new discussions, view project boards, etc., go to
Expand All @@ -99,4 +105,5 @@ the [Ballerina library parent repository](https://github.com/ballerina-platform/
## Useful Links

- Chat live with us via our [Discord server](https://discord.gg/ballerinalang).
- Post all technical questions on Stack Overflow with the [#ballerina](https://stackoverflow.com/questions/tagged/ballerina) tag.
- Post all technical questions on Stack Overflow with
the [#ballerina](https://stackoverflow.com/questions/tagged/ballerina) tag.
6 changes: 6 additions & 0 deletions build-config/resources/Module.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,9 @@ use cases like accessing S/4HANA Sales Order (A2X) API.
Demonstrates leveraging the `sap.s4hana.api_sales_order_srv:Client` in Ballerina for S/4HANA API interactions. It
specifically showcases how to respond to a Salesforce Opportunity Close Event by automatically generating a Sales
Order in the S/4HANA SD module.

2. [Shopify to S/4HANA Integration](https://github.com/ballerina-platform/module-ballerinax-sap.s4hana.sales/tree/main/examples/shopify-to-sap) -
Details the integration process between [Shopify](https://admin.shopify.com/), a leading e-commerce platform,
and [SAP S/4HANA](https://www.sap.com/products/erp/s4hana.html), a comprehensive ERP system. The objective is to
automate SAP sales order creation for new orders placed on Shopify, enhancing efficiency and accuracy in order
management.
9 changes: 8 additions & 1 deletion build-config/resources/Package.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ use cases like accessing S/4HANA Sales Order (A2X) API.
specifically showcases how to respond to a Salesforce Opportunity Close Event by automatically generating a Sales
Order in the S/4HANA SD module.

2. [Shopify to S/4HANA Integration](https://github.com/ballerina-platform/module-ballerinax-sap.s4hana.sales/tree/main/examples/shopify-to-sap) -
Details the integration process between [Shopify](https://admin.shopify.com/), a leading e-commerce platform,
and [SAP S/4HANA](https://www.sap.com/products/erp/s4hana.html), a comprehensive ERP system. The objective is to
automate SAP sales order creation for new orders placed on Shopify, enhancing efficiency and accuracy in order
management.

## Report Issues

To report bugs, request new features, start new discussions, view project boards, etc., go to
Expand All @@ -99,4 +105,5 @@ the [Ballerina library parent repository](https://github.com/ballerina-platform/
## Useful Links

- Chat live with us via our [Discord server](https://discord.gg/ballerinalang).
- Post all technical questions on Stack Overflow with the [#ballerina](https://stackoverflow.com/questions/tagged/ballerina) tag.
- Post all technical questions on Stack Overflow with
the [#ballerina](https://stackoverflow.com/questions/tagged/ballerina) tag.
6 changes: 6 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ use cases like accessing S/4HANA Sales Order (A2X) API.
specifically showcases how to respond to a Salesforce Opportunity Close Event by automatically generating a Sales
Order in the S/4HANA SD module.

2. [Shopify to S/4HANA Integration](https://github.com/ballerina-platform/module-ballerinax-sap.s4hana.sales/tree/main/examples/shopify-to-sap) -
Details the integration process between [Shopify](https://admin.shopify.com/), a leading e-commerce platform,
and [SAP S/4HANA](https://www.sap.com/products/erp/s4hana.html), a comprehensive ERP system. The objective is to
automate SAP sales order creation for new orders placed on Shopify, enhancing efficiency and accuracy in order
management.

## Prerequisites

Each example includes detailed steps.
Expand Down
25 changes: 18 additions & 7 deletions examples/salesforce-to-sap/Salesforce To S4hana.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,18 @@ generating a Sales Order in the S/4HANA SD module.

## Overview

Salesforce, a leading cloud-based CRM platform, empowers organizations to streamline their sales, marketing, and customer service workflows. On the other hand, SAP S/4HANA, an advanced ERP system, enables efficient management of core business processes.
Salesforce, a leading cloud-based CRM platform, empowers organizations to streamline their sales, marketing, and
customer service workflows. On the other hand, SAP S/4HANA, an advanced ERP system, enables efficient management of core
business processes.

In numerous organizations, the transition of sales orders into SAP often entails cumbersome manual data entry, leading to potential inaccuracies. Moreover, the prompt creation of sales orders following the generation of new opportunities is crucial. This integration aims to automate the generation of SAP sales orders upon the creation of Salesforce opportunities, significantly reducing manual labor and enhancing data precision.
In numerous organizations, the transition of sales orders into SAP often entails cumbersome manual data entry, leading
to potential inaccuracies. Moreover, the prompt creation of sales orders following the generation of new opportunities
is crucial. This integration aims to automate the generation of SAP sales orders upon the creation of Salesforce
opportunities, significantly reducing manual labor and enhancing data precision.

This solution actively monitors for the closing of opportunities within Salesforce. Upon detecting an opportunity closed as won, it automatically initiates the creation of a corresponding SAP sales order via the SAP API, streamlining the process.
This solution actively monitors for the closing of opportunities within Salesforce. Upon detecting an opportunity closed
as won, it automatically initiates the creation of a corresponding SAP sales order via the SAP API, streamlining the
process.

## Prerequisites

Expand Down Expand Up @@ -54,7 +61,9 @@ password = "<Password>"

### 4. Modify Configuration Constants

For ease of demonstration, certain organizational structures within S/4HANA and mappings from Salesforce to S/4HANA Material codes are predefined. To tailor these to your specific requirements, adjustments can be made in the `constants.bal` file.
For ease of demonstration, certain organizational structures within S/4HANA and mappings from Salesforce to S/4HANA
Material codes are predefined. To tailor these to your specific requirements, adjustments can be made in
the `constants.bal` file.

## Run the Example

Expand All @@ -64,10 +73,12 @@ Execute the following command to run the example:
bal run
```

## Testing
## Testing

1. **Access an Opportunity**: In Salesforce, locate and open a specific Opportunity record.

2. **Mark as Closed Won**: Update the Opportunity's status to `Closed Won`. This action simulates the successful closure of a sales deal.
2. **Mark as Closed Won**: Update the Opportunity's status to `Closed Won`. This action simulates the successful closure
of a sales deal.

3. **Verify in SAP S/4HANA**: Log into the SAP S/4HANA system. Confirm the creation of a corresponding sales order, which should have been automatically generated in response to the Opportunity's closure in Salesforce.
3. **Verify in SAP S/4HANA**: Log into the SAP S/4HANA system. Confirm the creation of a corresponding sales order,
which should have been automatically generated in response to the Opportunity's closure in Salesforce.
1 change: 1 addition & 0 deletions examples/shopify-to-sap/.github/README.md
5 changes: 5 additions & 0 deletions examples/shopify-to-sap/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[package]
org = "wso2"
name = "shopify_to_sap"
version = "0.1.0"
distribution = "2201.9.1"
69 changes: 69 additions & 0 deletions examples/shopify-to-sap/Shopify to SAP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Automated SAP Sales Order Creation from Shopify Orders

This example details the integration process between [Shopify](https://admin.shopify.com/), a leading e-commerce
platform, and [SAP S/4HANA](https://www.sap.com/products/erp/s4hana.html), a comprehensive ERP system. The objective is
to automate SAP sales order creation for new orders placed on Shopify, enhancing efficiency and accuracy in order
management.

## Overview

Shopify excels in facilitating online sales and customer interactions, while SAP S/4HANA streamlines core business
operations. This integration bridges the gap between e-commerce sales and enterprise resource planning, ensuring that
new orders on Shopify automatically generate corresponding sales orders in SAP S/4HANA.

The process is initiated by a Shopify webhook, which notifies a designated HTTP service endpoint whenever a new order is
placed. This triggers the automated creation of a sales order in SAP S/4HANA via its API, seamlessly connecting online
sales with the ERP system.

## Prerequisites

### 1. Setup the S/4HANA API

Refer to the [Setup Guide](https://central.ballerina.io/ballerinax/sap/latest#setup-guide) for necessary credentials (
hostname, username, password).

### 2. Setup the Shopify Store

1. Create a new Shopify partner account from https://www.shopify.com/partners.

2. Create a Shopify development
store (https://help.shopify.com/en/partners/dashboard/managing-stores/development-stores)

3. In the development store, navigate to `Settings -> Notifications -> Webhooks`

4. Create webhooks for Order creation event. Provide the URL http://<host>:<port>/sap-bridge/order for both webhooks.

### 3. Configuration

Configure S/4HANA API credentials in `Config.toml` in the example directory:

```toml
[s4hanaClientConfig]
hostname = "<Hostname>"
username = "<Username>"
password = "<Password>"
```

### 4. Modify Configuration Constants

For ease of demonstration, certain organizational structures within S/4HANA and mappings from Shopify to S/4HANA
Material codes are predefined. To tailor these to your specific requirements, adjustments can be made in
the `constants.bal` file.

## Run the Example

Execute the following command to run the example:

```bash
bal run
```

## Testing

1. **Customer and Product Registration**: Access the development store's online view. Register a new customer and add a
product.

2. **Order Creation**: Using the newly registered customer and product, place a new order.

3. **Verification in SAP S/4HANA**: Log into the SAP S/4HANA system and verify the presence of the sales order that was
just created.
32 changes: 32 additions & 0 deletions examples/shopify-to-sap/constants.bal
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright (c) 2024, WSO2 LLC. (http://www.wso2.org).
//
// WSO2 LLC. licenses this file to you under the Apache License,
// Version 2.0 (the "License"); you may not use this file except
// in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

// Organizational constants
const SALES_ORDER_TYPE = "OR";
const SALES_ORGANIZATION = "1710";
const DISTRIBUTION_CHANNEL = "10";
const ORG_DIVISION = "00";

// Master Data Mapping
const SOLD_TO_PARTY = "17100001";
const CODE_TO_MATERIAL = {
"8882299109698": {
Material: "FG011",
Name: "Electric Fan",
SalesOrderItemCategory: "TAN",
RequestedQuantityUnit: "PC"
}
};
Loading

0 comments on commit 794a4e4

Please sign in to comment.