This post was originally published on this site

As part of the SAP ecosystem, SAP Commerce Cloud is particularly well-positioned to help extend your ERP investment, but before moving forward with a SAP Commerce Cloud implementation, the first step is to plan out the integrations between SAP Commerce Cloud and the other third-party systems within your application infrastructure. We’ve put together this document to outline an example of technical considerations involved in this type of implementation, as well as offer guidance based on our own experience to integrate these two powerful systems.

Of course, the technical considerations involved in integrating are many, and this blog serves as the tip of the iceberg. Here, we’ll focus on the integrations between SAP AIN and SAP Commerce Cloud which lay the groundwork for SAP C/4HANA as an External System in SAP Asset Intelligence Network.

Technical Considerations

In SAP C/4HANA System

  • You have the administrator role configured to your user in the SAP C/4HANA system.
  • Omni Commerce Connect (OCC) v2 must be enabled.
  • Download and unzip the sapjumpinurl addon.
  • Steps to download the addon:
  1. Download file from https://help.sap.com/http.svc/download?deliverable_id=20575991.
  2. Unzip the sapjumpinurl.zip from the downloaded folder.
  3. Install the files from sapjumpinurl

Note

After downloading the file, you must extract the zip file again. Install the addon on SAP C/4HANA system using the following command addon installation procedure: ant addoninstall -Daddonnames=”sapjumpinurl” -DaddonStorefront.yacceleratorstorefront=<enter store front name in the SAP Commerce Cloud system>

In SAP AIN system

  • You must have the privileges of an organization administrator, CONFIGURATION_DELETE or CONFIURATION_EDIT.
  • You have already integrated the external system with SAP Asset Intelligence Network. For details, see: Admin Guide at help.sap.com/ain.

Procedure

  1. Log on to SAP Asset Intelligence Network.
  2. Launch the Application Settings
  3. Choose the External Systems
  4. Choose Add.
  5. Choose the external system of type SAP Commerce Cloud.
  6. In the Add System dialog box, provide the details as listed:
  • System Name: Provide a unique system name
  • System Status: Active or Inactive
  • URL Information: URL of the external system.
  • Base Site ID: Base site ID maintained in the SAP Commerce Cloud system
  • Webroot: Webroot of the store front name in the SAP Commerce Cloud system. If you have maintained a webroot in your SAP Commerce Cloud system, then it is mandatory to maintain the same in AIN system as well.
  1. Choose OK.
  2. Make sure that the Manufacturer Part Number of the spare part in the AIN system is maintained same as the Product ID in the SAP Commerce Cloud system.

 

 

Note

After the configuration is in place, you can view the “Add to Cart” icon for the relevant spare parts in the Spare Part app together with Equipment and Models app.

SAP C/4HANA Cart via REST API (OCC v2)

This integration works for SAP Commerce Cloud B2C solutions, as well as for SAP Commerce Cloud B2B solutions. The only impediment could be “secureportaladdon” extension of SAP Commerce Cloud, which requires user to authenticate before any SAP Commerce Cloud page could be rendered in the browser.

Prerequisites

  • SAP C/4HANA with OCC v2 enabled
  • sapjumpinurl addon installed, standard addon installation procedure: ant addoninstall -Daddonnames=”sapjumpinurl” -DaddonStorefront.yacceleratorstorefront=”yourstorefront” or
  • define a controller/web method like following (extends de.hybris.platform.addonsupport.controllers.AbstractAddOnController or de.hybris.platform.acceleratorstorefrontcommons.controllers.pages.AbstractPageController if used without addons): @Controller @RequestMapping(value = “/jump-in”) public class JumpinUrlController extends AbstractAddOnController { private static final String CART_GUID_PATH_VARIABLE_PATTERN = “/ {cartGuid:.*}”;

@Resource private CartFacade cartFacade;

@RequestMapping(value = “/cart/” + CART_GUID_PATH_VARIABLE_PATTERN, method = RequestMethod.GET) public String prepareCart(@PathVariable(“cartGuid”) final String cartGuid) throws CommerceCartRestorationException { cartFacade.restoreSavedCart(cartGuid); return REDIRECT_PREFIX + “/cart”; } }

Use Case

  1. Create a new shopping cart via SAP Commerce Cloud REST API for anonymous user (no authentication is required)

  • Request: POST https://{host}:{port}/rest/v2/{baseSite}/users/anonymous/carts
  • Response example: { “type”: “cartWsDTO”,    “code”: “00003000”,    “guid”: “d1d5cd58-26c9-4a5e-9925-81ff56ef11aa”,    “totalItems”: 0,    “totalPrice”: {        “currencyIso”: “USD”,        “value”: 0    },    “totalPriceWithTax”: {        “currencyIso”: “USD”,        “value”: 0

} }

  • Description: This call creates a new empty shopping cart on SAP Commerce Cloud side for the user “anonymous” (as specified in URL). The guid attribute in response identifies the shopping cart, this attribute is to be used in further API calls related to this cart. BaseSite identifies the site from SAP Commerce Cloud (one SAP Commerce Cloud instance might serve multiple sites).
  1. Add product to the cart by SAP Commerce Cloud product code

  • Request: POST https://{host}:{port}/rest/v2/{baseSite}/users/anonymous/carts/{cartGuid}/entries Parameters: • qty – quantity of the product to be added, for example 1 • code – product code as defined in SAP Commerce Cloud, for example 816780
  • Response example: {   “entry”: {        “entryNumber”: 0,        “product”: {            “availableForPickup”: true,            “code”: “816780”,            “name”: “DSLR-A100H”,            “purchasable”: true,            “stock”: {                “stockLevel”: 2            },            “url”: “/Open-Catalogue/Cameras/Digital-Cameras/Digital-SLR/DSLRA100H/p/816780”        },        “quantity”: 1,        “totalPrice”: {            “currencyIso”: “USD”,            “value”: 1086        }    },    “quantity”: 1,    “quantityAdded”: 1,    “statusCode”: “success” }
  • Description: This request adds specified quantity (qty) of the product (code) to the cart, identified by guid (obtained in step 1). The unit of measure is specified in request, as in SAP Commerce Cloud every product has unit of measure, which will be used automatically, as configured in SAP Commerce Cloud. The response contains following important information: • statusCode – “success” if the product was added to the cart successfully; • entryNumber – number of the shopping cart entry that was created during this API call. Should be used in update quantity/delete cart entry requests.
  1. Redirect to the SAP Commerce Cloud shopping cart page

  • Request (end-customer should be redirected to the following URL): Redirect to  https://{host}:{port}/{webContext}/jump-in/cart/{cartGuid}
  • No parameters are passed with this request to the SAP Commerce Cloud. When browser is redirected to the following URL, the new anonymous session is created on SAP Commerce Cloud side and shopping cart identified by {cartGuid} is restored. After this, user will be redirected to the SAP Commerce Cloud cart page.
  • {webContext} should be explicitly provided by the SAP Commerce Cloud team/customer, since this depends on the SAP Commerce Cloud configuration (in some configurations the webContext is empty, therefore is not required; in some other cases the webContext differs from the SAP Commerce Cloud baseSite).

Conclusion

SAP AIN and SAP Commerce Cloud form a powerful combination, enabling organizations to create robust digital commerce experiences that simplify existing commerce channels, and open up new opportunities for growth. To make this happen, the systems need to be tightly integrated, and to a large extent these integration decisions need to be driven at an organizational level to determine what makes the most business sense. The key things to consider are making use of existing datasets whenever possible to avoid duplication of effort and unnecessary complexity, and leveraging the strengths of each system to form the best possible business and customer experience.

See Videohttps://video.sap.com/media/t/0_yw0zm8n8

 

This story originally appeared on and is accredited to SAP Hybris Blogs (Official)