SAP Commerce Cloud - Best Practices for Development

Explore by Category:

eCommerce

SAP Commerce Cloud - Best Practices for Development

Brave Bison

December 25, 2023

This article is made available through our valuable partnership with Brave Bison as part of our collaborative efforts.

SAP Commerce Cloud, formerly known as Hybris, is more than just a tool; it's a comprehensive framework designed to meet the multifaceted demands of modern e-commerce. From handling complex B2B transactions to providing seamless integration across various platforms, its capabilities are vast. 

However, leveraging the platform’s full potential requires a deep understanding of its features and a strategic approach to implementation. In this article, we explore the best practices for working with SAP Commerce Cloud, shedding light on the key aspects that can make or break your e-commerce strategy. 

2024-report-small-banner-trans5.png
Get the latest industry insights in Composable Trends

Crucial facts to know about SAP Commerce Cloud before development

SAP Commerce Cloud’s multi-layered and flexible framework offers a plethora of out-of-the-box functionalities, but is also highly extensible. From being Java-based and employing Spring MVC to having its own persistence layer, caching implementation, and search indexer, the platform is rich with features.

However, this richness can be a pitfall for those new to the platform. Inexperienced developers may attempt to build new functionalities that already exist within the platform, effectively reinventing the wheel. This underscores the importance of understanding the platform's capabilities and leveraging existing features rather than building from scratch.

The platform's flexibility also extends to meeting license compliance standards, allowing for customised installation and configuration for development, and facilitating the creation of Spring MVC web shops. It's a comprehensive solution, but one that demands a nuanced approach. 

Coding principles and naming conventions

Code formatting

SAP Commerce Cloud publishes specific recommended practices and guidelines for defining or creating data types, ImpEx files, dynamic attributes, services, events, automated tests, and interceptors. Adhering to these guidelines is crucial; failure to do so can lead to complications during platform upgrade time. If extensions are not created correctly according to SAP's recommendations, the process of updating the core platform can become painful and messy.

What data types are available?

The flexibility of SAP Commerce Cloud is evident in its ability to store any data that can be stored in a database or Java class. This vast array of available data types enables customisation to meet various business needs, providing a tailored solution for different applications.

Where and how should exceptions be handled?

Exception handling in SAP Commerce Cloud largely aligns with standard Java conventions. However, it's essential to use the platform's built-in logging tool, specifically chosen by SAP for Commerce Cloud. This ensures that logs are properly recorded in the SAP backend, maintaining consistency and traceability within the system.

Use of null

Being Java-based, SAP Commerce Cloud follows standard Java practices for handling null values. This consistency with widely accepted programming norms further streamlines the development process, making it accessible for those familiar with Java and reinforcing the platform's commitment to industry standards.

Order fulfillment with SAP Commerce Cloud‏

Order fulfilment in SAP Commerce Cloud is more than a mere sequence of tasks; it's a carefully orchestrated business process that follows a specific order based on predefined conditions. This standardised approach includes out-of-the-box steps such as fraud checks, shipping notifications, and updating the order status to reflect shipment.

The platform's design allows for the addition of custom steps into this business process. Whether it's a unique shipping requirement or a specific verification step, these can be seamlessly integrated into the existing flow. This approach ensures a clear, auditable log of what happens with each order, providing transparency and accountability.

Unlike firing off individual code snippets, the business process method allows for tracking and replaying the process if needed. In a bustling production system with numerous orders being processed simultaneously, this method offers a way to navigate through the SAP backend, view the business process, and see which steps have run. For each step, success or failure can be determined, and if anything goes wrong, the process can be paused, examined, fixed, and resumed from where the mistake occurred.

Setting up the environments

SAP Commerce Cloud V2 offers three environments as standard: development, staging, and production. Each environment serves a specific purpose and is progressively more stable.

Development environment

The development environment is where the initial installation and configuration of SAP Commerce Cloud take place. Here, developers create new extensions and test initial builds. Nightly builds are often deployed using the SAP Commerce Cloud deployment API, wiping the database clean every night. This ensures that quality assurance teams have consistent data to work with every morning, facilitating continuous testing and development.

Staging environment

A step closer to the final product, the staging environment is more stable and secure. It often includes a sanitised version of production data, excluding any sensitive customer information. This environment is essential for running the final tests on a release candidate before moving it to production. Additional configurations might include IP whitelisting and pointing the staging system at other staging versions of integrated systems, such as payment gateways.

Production environment

The production environment is the final stage, where the fully tested and approved build is deployed for public access. It's the culmination of the development and staging processes, reflecting the finished product that customers interact with.

SAP assists in setting up and securing these environments, sizing them according to your needs. The flexibility to negotiate additional environments and the ability to configure specific properties across systems adds to the service. This tiered approach ensures a systematic progression from development to deployment, aligning with best practices and facilitating a seamless transition through the various stages of the project.

How to structure the database in SAP Commerce Cloud?

Structuring the database in SAP Commerce Cloud is a relatively straightforward process, thanks to the predefined data model that comes with the platform. This data model includes essential concepts like orders, products, customers, and more, covering all the fundamental data needed to run a basic commerce website.

While the predefined model covers the basics, it's common for SAP Commerce projects to require additional attributes tailored to specific business needs. SAP provides clear guidelines and an XML configuration file to assist in defining or creating custom data types, ImpEx files, dynamic attributes, services, events, automated tests, and interceptors. This flexibility ensures that the database can be moulded to fit various business requirements without compromising the integrity of the core structure.

SAP-CC-small-banner.png
Transition to composable without replatforming

How to build a well-performing storefront?

The performance of a storefront is paramount to its success. A fast and responsive user experience can significantly impact customer satisfaction, conversion rates, and search engine rankings. When building a well-performing storefront in SAP Commerce Cloud, the goal is to create a seamless and efficient user experience that not only meets but exceeds customer expectations. 

Here's how different components contribute to building a high-performing storefront:

Content delivery network

Utilising cloud technology in SAP Commerce Cloud ensures future-proof technology and seamless integration. By distributing the service spatially relative to end-users, it minimises latency and ensures a smooth user experience.

Caching

SAP Commerce Cloud's caching implementation enhances the efficiency of systems. By storing instances of frequently accessed data closer to the user, it reduces load times and provides a modern, intuitive design on any device. This is particularly beneficial for scaling both horizontally and vertically.

Server-side rendering

Server-side rendering in SAP Commerce Cloud supports performant up-selling and cross-selling features, positively impacting business. It allows for quicker page loads and a more interactive user experience, essential for modern e-commerce platforms.

Alokai

As a headless storefront, Alokai moves a lot of the presentation logic out of the platform, reducing the load on the database. Alokai provides its own layer of caching and integration, making it a powerful choice for enhancing the SAP Commerce Cloud experience. It has been shown to outperform other options like SAP’s own Accelerator or Spartacus storefronts, mainly due to its modern technology and efficient caching mechanisms.

Share:

shape

Ready to dive in? Schedule a demo

Get a live, personalised demo with one of our awesome product specialists.