0% found this document useful (0 votes)
99 views179 pages

C4H341_EN_Col24

The document outlines the SAP Commerce Cloud Developer Training - Part II (C4H341), which includes in-class lectures and hands-on exercises focused on building e-commerce functionalities using SAP Commerce Cloud. It covers essential topics such as system initialization, data modeling, and the architecture of the SAP Commerce Cloud platform, while also providing a structured schedule for training sessions. The training is designed for SAP employees and partners, emphasizing the use of standard extensions and customization techniques.

Uploaded by

venkat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
99 views179 pages

C4H341_EN_Col24

The document outlines the SAP Commerce Cloud Developer Training - Part II (C4H341), which includes in-class lectures and hands-on exercises focused on building e-commerce functionalities using SAP Commerce Cloud. It covers essential topics such as system initialization, data modeling, and the architecture of the SAP Commerce Cloud platform, while also providing a structured schedule for training sessions. The training is designed for SAP employees and partners, emphasizing the use of standard extensions and customization techniques.

Uploaded by

venkat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 179

SAP Customer Experience

SAP Commerce Cloud Developer Training - Part Il


C4H341
Material Number: 50162817
Col24

INTERNAL - SAP and Partners Only

Some Necessities

= Participant List

= Course Material

= Accessing Remote Training VMs

ERNAL SAP ard Partners Only

© SAP SE C4H341
We will learn about:

Training Overview
Vv

> SAP Commerce Cloud — Platform & Basics

Review of SAP Commerce Cloud Dev. Training — Part |


Vv

> Exercise How-To

INTERNAL SAP and Partnors Only 3

Training Overview

2 C4H341 © SAP SE
Personal Introduction

SAP Commerce Cloud


Trainer
Name

Spring/JEE
Role . .
Project experience

Company
Previous SAP
Commerce
Hobbies experience

INTERNAL SAP and Parners Only

Training Content

This course consists of two parts:


= In-class lectures
— illustrate the theory behind e-commerce features of SAP Commerce Cloud
— demonstrate the software
— give an idea of what’s available out-of-the-box and what requires implementation

= Instructor-led exercises
— give you the opportunity to complete the creation of a store with basic functionality
— the instructor can answer your questions and assist you with the lab exercises
= It will not cover the following topics:
— Customer-specific problems
— System Administration
° for that, we offer the live session series: SAP Commerce Cloud — System Administrator
— Dynatrace / APM for SAP Commerce Cloud
* for that, we offer the live session: Monitoring Commerce Cloud with Dynatrace

INTERNAL SAP and Parners Only

© SAP SE C4H341
Instructor-Led Hands-On

= The exercises for this class are based on SAP Commerce


Cloud and SAP Commerce Cloud, composable storefront
(aka. simply Composable Storefront)

= You will extend the OOTB SAP Commerce Cloud features


and work with the Composable Storefront

= The labs instructions are high-level. You will develop the


design provided by referring to the lectures and
documentation.

= Are you stuck in a lab?


— Please ask the instructor during the class

INTERNAL SAP and Partnors Only 7

Training Environment Intro


< @ Home c4h341_2211 +

« Laptop or personal computer © Recent

» Access to SAP VM ey Seca P| Exercises


(through SAP Training Landscape) a
ft Home | | Handouts

The VM environment contains D Documents /~) advancedRestClient


» JDK 17 (SapMachine) + Downloads FR ectipse-bundle
» Exercise PDFs (in Exercises) dd Music =
"Slide PDFs (in Handouts) — morepe
=» SAP Commerce Cloud (in workspace)
® AnIDE
— we provide a pre-configured Eclipse instance (in eclipse-bundle)

« Exercise-related apps (advancedRestClient, Visual Studio Code)

INTERNAL SAP and Partnors Only 8

4 C4H341 © SAP SE
Working Hours — Day 1

9:00 Overview

Exercise — Setup

Day1 Backoffice

Exercise — Backoffice
12:30
Lunch

13:30
. Validation

Exercise — Validation

17:00 Personalization

INTERNAL SAP and Parners Only

Working Hours — Day 2

9:00
Exercise — Personalization

Day 2
. Search & Navigation

12:30
Lunch

13:30
Exercise — Search & Navigation

Promotions & Coupons

17:00 Exercise — Promotions & Coupons

INTERNAL SAP and Parners Only

© SAP SE C4H341
Working Hours — Day 3

9:00 8. SAP Commerce Cloud Web Services - Omni


Commerce Connect

Exercise — Omni Commerce Connect


Day 3
9. Cron Jobs

12:30 Exercise — Cron Jobs

Lunch

13:30
10. Event System

11. Process Engine

12. Order Management

17:00 Exercise 19 — Order Management

INTERNAL SAP and ParnersOnly

SAP Commerce Cloud — Platform &


Basics

C4H341 © SAP SE
The SAP Commerce Cloud - Platform

= Composed of a standard set of extensions providing base functionality


— You will build your site atop standard extensions, maintaining a clear separation between
code and configuration

=» An extension:
— Is the packaging mechanism for a Commerce feature
— Contains business logic, type definitions, RESTful web service customization, etc.

=" Database and application server abstraction layer


— ORM framework
— Build framework
— Data modeling, validation and imports
— Configuration files
— SAP Commerce Cloud Server

INTERNAL SAP and Partnors Only 13

Architecture Overview
Client TT Back Office a

Web Touch Point Backoffice Framework


. Administration Customer Support
Front End

cohen MINKE
composable
RESTful
WebSvc
F
Adaptive Search
,
Order fulfillment
SmartEdit SAP BTP
storefront Product etc... Integration Suite
APIs

SAP BTP
Ext.

Kyma Runtime

Business Services (Classification, Catalog, price Calculation, ...)


Platform

Infrastructure Services (Authentication, User, i18n, ...) Core Platform Intelligent Selling

System Services (Session, Model, Tenant, Cluster, ...) Services

Core Persistence Framework

ee Apache
Server
App

Tomcat

EYHANA = ORACLE" > 86l server usd


DB

INTERNAL SAP and Parners Only 14

© SAP SE C4H341 7
Architecture Review — SAP Commerce Cloud Service Layer
. 5 Web
= The Commerce architectural layer Web Shop | | Backotfice | | services
where you implement your logic g g g
. . Presentation
= Provides a number of services, MVC Model-View-Controller Oat
ata
each with well-defined Objects

responsibilities

|
Commerce ServiceLayer
= Service-oriented architecture

ModelSve, FlexibleSearchSvc,
Cache, Interceptors, Events
Business Services
based on the Spring framework Services, Strategies

Infrastructure Services
= Provides hooks into model life- EmailService, CronjobService, ValidationService, etc

cycle events for performing


custom logic

» Provides a framework for t g


publishing and receiving events Persistence Layer lteme
JALO, SLD

Database
INTERNAL SAP ane Partners Only 15

Extensions Review

= Modules include extensions

= Configure SAP Commerce Cloud by enabling and disabling


extensions

=» Extension templates may be used as blueprints <<

= Extend, use, leverage OOTB extension functionality by creating


custom extensions

INTERNAL SAP and Partnors Only 16

8 C4H341 © SAP SE
Data Modeling Review

= How to create new types:


— Define “completely new types”:
<itemtype code="Car">
(implicitly extends from Genericltem)

— Define a type by inheriting from already existing types, such as:

<itemtype code="Car" extends="Product">

= Extend existing types:


— By adding attribute definitions to existing types (attribute injection):
<itemtype code="Product" autocreate="false”..>

<attribute qualifier="myAttribute” type="SomeCommerceType”...>

INTERNAL SAP and Parners Only

Initialize or Update the System


Platform Monitoring Maintenance Console

Tenants Configuration System Logging Extensions [nitialialtion’ Update SQL Scripts License Support PK Analyzer Classpath Analyzer
Ny
System Initialization:
= Entire type system is created from scratch.
= ALL database tables are dropped, both SAP Commerce Cloud data and type data
= Type Data is created from scratch as defined in the items. xm1 files.
= New tables with initial dataset are created

System Update:
= Existing tables are updated to match changes in the domain model.
= No loss of data!
= Two major aspects:
— Adding newly defined types to the type system definition in the database
— Modifying type system definition in the database to match the definition in the domain model

INTERNAL SAP and Parners Only

© SAP SE C4H341 9
Essential Data vs. Project Data

Essential Data

= Necessary during initialization:


Creates the Default catalog, restrictions, and basic CronJobs, for example

Project Data: cig


= Extension-specific project data Faae
create geocoding
cron job

~ mobdileservices

~ oms2
How to include:

= Convention over Configuration essentialdata*.impex, projectdata*.impex

= Hook Service Layer code into Commerce initialization and update life-cycle events using the
@SystemSetup annotation

INTERNAL SAP and Partnors Only 19

Basic PCM Types

= = (@@1& fete] typically holds two or more catalog versions but


only one can be active a a
7 Catalog version represents the product assortment
SS CatalogVersion
. are held in catalog versions, contain \
Pp roducts and other categories
9 x
. S&o Category
= [JREMPEE
are the basic elements of each product ax
catalog. They have references to one or more categories,
and a catalog version —-
e

INTERNAL SAP and Partnors Only 20

10 C4H341 © SAP SE
Further Suggestions for Discussion

Flexible Search

ImpEx

Facades

Composable Storefront

WCMS

Cloud Portal

Security management

INTERNAL SAP and ParnersOnly 24

Review of SAP Commerce Cloud Dev.


Training — Part |

© SAP SE C4H341 11
What you have done in Part |

: Our starting point: the OOTB commerce shop with composable storefront

» Itis accessible at https:/Aocalhost:4200 or https://localhost:4200/electronics-spa/en/USD/

« You should see a electronics shop where you can browse and search for electronics products

« You have extended the shop regarding different aspects (cf. next slides)

INTERNAL SAP and Partnors Only 23

The Data Model

[ Avice OTS tn Commenaa peste |


Definition provided as part of exercise setup
items and relations you will have to define

Product User

- rewardStatusLevel : RewardStatusLevel[@..1] - <enum constant>> SILVER: int


- <enum constant>> GOLD: int

T (ebooks), *

EBook

edition: Integer[@..1]
ISBN1@ : String[@..1] (authors), *
ISBN13 : String[@..1] - EBook2AuthorRelation
language : String[@..1]
publication : String[@..1]
publishedDate : Date[@..1]
publisher : String[@..1]

INTERNAL SAP and Parners Only 24

12 C4H341 © SAP SE
Classification System
Electronics onan Electronics
Classification s
mal Catalogue
Product
Catalog

Data
Storage

Advanced
Audio Hand-held
Camcorders

classifies

L L \ Camcorders_Red

E ya Camcorders_Blue

Gore ee SP
de BoPro HERO — 2018_blue
:
i GoPro HERO — 2018_red

INTERNAL SAP and Parners Only 25

Data Access

« Defined the Spring bean defaultGenericCustomerDao as an instance


of DefaultGenericDao

» Created a DAO for Orders: MyOrderDaoImpl. java


— (has a method for getting recent orders of a customer)

: Defined the bean: defaultMyOrderDao and its alias myOrderDao

: Bean definitions are in trainingflexiblesearch-spring.


xml

INTERNAL SAP and Parners Only 26

© SAP SE C4H341 13
Miscellaneous:

« Wrote ImpEx

» Created/extended new services

» Created a populator at the facade level

» Installed SAP Commerce Cloud, composable storefront

» Managed CMS content using SmartEdit

« Configured security —_

INTERNAL SAP and Partnors Only 27

Exercise How-To

14 C4H341 © SAP SE
General Information

« Course Material: Exercises + Handouts < @ Home | c4h341_2211° | workspace ~


. . © Recent
« Environment: IDE (eclipse-bundle) + workspace READIN
. . ® Starred
=» SAP Commerce Cloud (hybris) + Training Lab Tools
@ Home

D Documents | build-tools
< > @ Home = c4h341_2211 ~

© Recent N dd Music s
= : | hybris-sbg
W® Starred Exercises G Pictures
wm Videos installer
2 Home ~ | Handouts

DB Documents ™™) advancedRestClient @ Wastebasket | | ticenses

Downloads D cclipaetadla 3) Floppy Disk mystore

od, Wish = workspace + Other Locations


© Pictures

INTERNAL SAP and Parners Only

Training Lab Tools

= Automates the exercise setup

: Before starting most exercises


— Read instructions carefully
— If needed, stop the server
— If needed, run “setup” ant task to prepare environment for each exercise

« For each exercise, we have provided an XML ant script. You can either:
— run it from command line
— drag the ant file to the ant view in your IDE

« Each ant file includes a solution target you can use if you can’t finish the exercise

INTERNAL SAP and Parners Only

© SAP SE C4H341
Training Lab Tools
y me TrainingLabTools (C4H134% iIt23updste)
> BB JRE System Library [JRE [7 05)) DON’T change the content of any file inside the
——< TrainingLabTools folder
> Giyexercise_Addon
> Gyexercise_Backottice
[Stmwe — s Contains every file and data you'll
-faaltaeir aera = need to complete the exercises
JaultMultiCurreneyPricing java
(Gj MockCurrencyRateProvider.java
MutticurrencyPricing java
(1) projectdata-cronjobs.impex
% trainingcronjobs~spring.xm!
UpdateCurrencyPricesJob.java
Contains the files needed by setup ant target to
prepare the environment for this exercise
sp config.json
() CurrencyRateProvider.java
(Gj DefaultMultiCurrencyPricing
java
Ui[Gj eceisrerey
MutticurreneyPricing teenies
java Contains
ontains the the filTlles used d byby th the solution
luti ant tt target tt to complete
lete th the
1 elects crete impex exercise. You can compare your solution with them
/, trainingcronjobs-spring.xmi
A. Updat neyPricesJob java

> Gyexercise_Exampie
> Gyexercise_occe
> @yexercise_Orders Contains the ant target definitions
> Gyexercise_Personalization
> Gyexercise_PromotionsAndCoupons
> @yexercise_SearchAndNavigation
Gy exercise_Validation Properties (such as the location of the platform on the file system) |
> Qyexercise_Worktiows
~ Glib

pero USF 32

Verification of Your Solution

: Verification scripts are loaded by setup ant task (© hybris administration console

(© hybris administration console

Scripting Languages Console

INTERNAL SAP and Partnors Only 33.

16 C4H341 © SAP SE
What’s next...

In part 2 we'll focus on the store and user experience. You will:

« Enable personalized behavior

« Enable and configure the search engine for the storefront

« Create promotions and coupons

= Customize OCC webservices

« Customize the order management process

INTERNAL SAP and Partnors Only Rad

Setup Exercise

— ©
J

i.

© SAP SE C4H341 17
SAP Customer Experience

Thank you.

©2023 SAP SE or an SAP affiliate company. All rights reserved. Soe Legal Notice on wa". sap comilegal-notice for use terms, disclaimers, disclosures, of restrictions relate’ to SAP Materials for genoral audiences

SAP Customer Experience

Backoffice

INTERNAL — SAP and Partners Only

18 C4H341 © SAP SE
What we will cover in this topic

qt Methodology Ecommerce Features

Data Product Coupons and Order Search and


Modeling Modeling [Pisin Promotions [Pear Management [Rensmelizatitsm Navigation

Development | General Services r Maintenance

-{ Web Layer = rt Service Layer L -t Background Task = impex Flexible Building

Pr Search Framework
WCMS Facade Cronjobs

en P Installation
Validation Security Gonteurnttan
occ Service Process
Engine
2
Event Cache Update and
. System Initialization
occ Workflows

| Scripting

INTERNAL SAP and Partners Only 2

We will learn about:

> Overview

> Application Orchestrator

>» Custom Backoffice Extensions

> Backoffice Configuration

INTERNAL SAP and Partners Only 3

© SAP SE C4H341 19
The Context

Backoffice is a user-centric backend interface that


enables all users (business and technical) to easily
manage any kind of data within SAP Commerce Cloud.

INTERNAL SAP and Parners Only

A history of SAP Commerce Cloud Backoffice tools

1st Generation > 2nd Generation > Next Generation Framework

hMC Cockpits Backoffice/Cockpit NG

= Tool for technical business users, " Cockpits available: Single, easy to use and role based
developers and administrators interface for all business and
— Product Cockpit — Product & administrative users
" Highly generic, component-based category administration
Highly extensible and configurable via
" Database-oriented view — WCMS Cockpit —- Web XML
administration
" Easy to configure and customize Application mashup can be designed
— Customer Service Cockpit — at runtime
using XML configuration
Call center activities
" Manage Product, Order, Customer Cockpits/Perspectives available:
— Import Cockpit - Manage data
data and business processes imports - Backoffice Administration Cockpit
" Manage users and access rights — Report Cockpit — Access to - Backoffice Adaptive Search Cockpit
operational reports
— Backoffice Customer Service Cockpit
— Admin Cockpit — Manage
validations & B2B data - Backoffice Data Hub Cockpit

— Print Cockpit - Manage printed - Backoffice Order Fulfilment Cockpit


catalogs - Backoffice Product Cockpit
INTERNAL SAP and Parners Only " Can be configured using XML - Backoffice Integration Cockpit 5

20 C4H341 © SAP SE
Overview

SAP Commerce Cloud Backoffice

= A Single User Interface for all Backend Business Tools


)
= Capable of Managing any kind of data, even from outside el @
of the Commerce domain
= For Business and Administrative/Technical Users

= Based on Backoffice Framework

= Highly Extensible and Configurable

INTERNAL SAP and Parners Only

© SAP SE C4H341 21
Key Concepts of Backoffice

= Web application with a ready-to-use library of Ul components called widgets.

=" By combining and connecting widgets, a backoffice business process can be quickly designed
and put together.

= The mashup can also be designed at runtime using the Application Orchestrator interface and
XML configuration.

= Users will only see the set of widgets made available to their user roles. For example, OMS
widgets are only visible to fulfilment users.

INTERNAL SAP and Parners Only

Backoffice Administration Cockpit

= Preconfigured data and configuration tools for all platform extensions


= Default Mashup (Explorer Tree, Search, Result List, Editor Area)
= SAN TY Administration Cockpit ~ & @ 6

Products a mM &

@ tere +)v @€- @ 8 {1B


| a i
(nto ProguctT... Afice Number it Ider: st seus Ceaiog version
D syn 2 | = 5004583 EasyShare M531 ace Electronics
Product Catalog : Ontine
@ catnlog. { = ses4s07 EssyShare M531 age Eiectroreca Product Catalog : Onine

Cunlogs seas 5000 + EFS 38-55 IS ago Eiectrorics Product Catalog : Onin
~~ s203775 ALP IOAN ava hectronics Product Catalog : Oniine
Catalog versions
2 (th > 542 ters
Categoring
Prides EasyShare M531 [5864583] - Electronics Product Catalog : Online a

Predict Variant Types @es t L — satresn BS


Units: Properties Attributes Category System Prices Multimedia Variants Extended Attributes Reviews Stock Administration

Kerwords
Essential a
Saved queries v
wea wees hr © conta ver? ree
‘5864583 ‘EasyShare M631, Blectronics Product Catalog : Online check

INTERNAL SAP and F

22 C4H341 © SAP SE
Backoffice Framework Extensions

= backoffice extension:
— Backoffice framework and Administration Cockpit with standard widgets
— Single web application which is a container for all Backoffice modules
— Contains the Application Orchestrator (F4) to design your custom mashup
— Accessible by default at https: //localhost:9002/backoffice

= ybackoffice extension template


— Template you can use to generate a custom extension where you can implement your own
Backoffice module, widgets, or UI configuration
— The Application Orchestrator can help you generate the configuration that adds your
custom components to Backoffice
— Each extension based on ybackoffice will contribute to the main Backoffice application

INTERNAL SAP and Parners Only

Application Orchestrator

© SAP SE C4H341 23
Application Orchestrator — key features

= Accessible by pressing F4 key in the Backoffice application


— only for administrators.
= Add, remove and connect widgets, areas and other components
= Add or change settings of a widget instance
= Connect widgets using their sockets
= Manage UI localization by providing values for labels
= Manage access restrictions (allowed roles)
= View and reset application configuration (widgets.xml) and UI configuration (cockpit-config.xml)
= Runtime configurations are not persisted and will be lost after configuration reset
= Inspect application mash-up and communication flow
= Consists of two views

INTERNAL SAP and Partnors Only 12

Main view

The main widget view is a place where you should add widgets and design a mash-up of your
application. Here you can see two types of components: widgets and slots/children.
Oumar level
Salact Authorty Gecup . ° ——«> Symbolic witgets Wager Cipdoars =

ackntice Main Uryout 7URex

Flenible Layout @GeRex


Vew Sentcner eR Re x
[vene} +
[unetled) coLaboration container

Bachotlice Perspective Container e¢Geamnex

pespectves) +
edminarea name name

Border Layout 7GoeReaex


Virw Savitcher PCT RW PX —_ dackotice Permpective Container e2aerex

{Mews} + perspectives}, +

[untitied) [unttted) {united} [umtitied) [uuntitted] (untitied} untitled) _{urvtitted)

ter FORMA X Omshboart 7Gagex


site Osstoosrcevamgets) 7 +
in FRO Got FOB
Saved queriey v =
INTERNAL SAP and Pa 13

24 C4H341 © SAP SE
Symbolic widgets view
The symbolic widgets view helps to get an overview of your application’s mash-up. It shows
widget dependencies and how connections are established. You can also add widgets here.
‘Select Aumorty Group » © [Y) sympmcwages [Y) snow stotias [7] stow conrections i=
{7 Show tabets [| Show input connections
=
Aackotfice Main Layout cocipiewicgesChidrerirnisibie pander

eats

View Switcher vows Profle Setting


h

views) | Paseward Setting

compfrWiogerChicrertrnisiole detiViewContent

Custom Backoffice Extensions

© SAP SE C4H341 25
Custom Backoffice Extensions

= Acustom backoffice extension can contribute to the whole and unique Backoffice web app with
new modules (areas), widgets and/or UI configuration
= Create a new backoffice extension:
— Create the extension with ant
ant extgen

— Select the ybackoffice template


— Provide the name and default package for the new extension, can leave the other values to their defaults
(sample widget and style sheet)

— Add the new extension to config/localextensions.xml


— Perform complete build of the platform

ant all

— Import the extension project into the IDE

INTERNAL SAP and Partnors Only 16

Custom Backoffice Extensions: Essential XML Files (in resources’ folder)


Wrainingbackoffice
The following xml files are relevant inside the > URE System Library [JRE (170.2
resources folder of a custom Backoffice extension oO
(e.g., the trainingbackoffice extension): acta
? testsrce

— trainingbackoffice/resources/trainingbackoffice- ; areos
backoffice-config.xml: Configuration of custom context > Boclasses
components. It can be reloaded at runtime by doing a
reset in the Application Orchestrator. > Eebackottics
> Boockpitng
— trainingbackoffice/resources/ trainingbackoffice- > Blocalization
backoffice-widgets.xml: Configuration of custom widget 5 Mee
a omneemarnnnn
components and their connections. It can also be [S| beans.xsd
reloaded at runtime by doing a reset. ners.
rainins
\X) trainingbackoffice-backoffice-config.xml
— trainingbackoffice/resources/ trainingbackoffice- 2) trainingbackoffice-backoffice-spring.xml
backoffice-spring.xml: Contribution to the Widget 2) traininabackoffice-backoffice-widgets.xml

Application Context. This is an additional Spring context BD trairarghoankomioe:ttonwve


with auto reload possibilities during runtime. It's shared ¥) trainingbackoffice-spring.xml
among all the Backoffice extensions. ®)bulla xm!
#)buitdcalibacks.xmi
x) extensioninfo.xml
{8) extensioninio.xsd
}) plattormhome.properties
INTERNAL SAP and Partners Only | project. properties

26 C4H341 © SAP SE
Backoffice Configuration

Config.xml - Context Configuration for the UI

= Context configuration defined in config.xml is


responsible for the user interface configuration. {__} symbolic widgets (©) Widget Clipboard i=
= Here you define context components used to control
| Refresh
how widgets are displayed.
« There are 2 principal versions of the context Show widgets.xml
configuration, consulted in the following order: | Reset to Defaults

— cockpit-config.xml: Merged configuration of the whole | Show cockpit-config.xml


Backoffice application. You can modify it at runtime
from the Application Orchestrator --> Show cockpit- Reset to Defaults
config.xml. This file is stored as a Media item. :
Simulate config resolution
— trainingbackoffice/resources/trainingbackoffice-
Reset Everything
backoffice-config.xml: Configuration of context
components defined in the trainingbackoffice extension. Widget Toolbar Color »
It can be loaded at runtime by performing a reset in the
Application Orchestrator

INTERNAL SAP and Partnors Only 20

© SAP SE C4H341 27
UI Configuration
= SARA Administration Cockpit ~ a
Bl js Golar vari <context type="ELectronicsColorvaritantProduct " =
Fate ree (at Oo ropa) lectronics Color Variant component="advanced-search"> [#] &
[2] Secale * Electronics Color Variant Q = Globaloperstor: and =» [7] ncwae suneypes. i=
© __rternationatization > Product variants type Enaale ~ aw x

SA Marhenng, > ‘Anemative io equats . 4:


& wows >
S _a : . ” aps et
BE ane = e +1 <context type="ElectronicsColorVaritantProduct” component="Listview >|
{—] Product... Article Number 17 Identifier it Status (Catalog Version
@ Deeplink
Urs > =
fa 1O7AAMD rad DSC-H20 Red Avi Electronics
Product Catalog : Cintina

“J _ Rule Engine 2 fo 6] 1978440_green DSC-H20 Green ave Blacionick Product Cutalog <-Ontima |

DSC-H20 Green [1978440_preen] - Electronics Product Catalog : Online g

8 @ec <context type="ElectronicsColorVvariantProduct" component="base"> =

Propertios Attributes Gategory System Prices Multimedim Variants Extended Attributes Reviews Stock Administration

<context Essential a
component=
n n Article Nurmiber* Idencifier 9] Catalog version® Approval*
explorer-tree">
1978440_green DSC-H20 Green
<context type=”ElectronicsColorVariantProduct "
component="editor-area"> =

UI Configuration - Explorer Tree


f.] Price Settings >

Internationalization >
Explorer Tree Configuration: ©
Marketing >

<context component="explorer-tree" merge—by="module"> B


<n:explorer-tree ¥ Weus J
xmlins:n="http://www.hybris.com/cockpitng/config/explorertree">
<n:navigation-node id="SAP Commerce Training"> 53 Base Commerce >

<n:type-node id="ElectronicsColorVariantProduct"
: : Deeplink Uris >
code="ElectronicsColorVariantProduct" /> 2 7

<n:itype-node id="UserPasswordChangeAudit” < Rule Engine >


code="UserPasswordChangeAudit" />
; ; SAP Commerce Training v
</n:navigat ion—node>
</niexplorer—tree> ;
</context> Electronics Color Variant

my :
25 Personalization >
INTERNAL SAP and Partnors Only 22

28 C4H341 © SAP SE
UI Configuration * Advanced Search (for Product)
<context type="Product" Component="advanced=search"” merge-by="type" parent="GenericItem">
<as:advanced-search>
<as:field-list>

<as:field name="EuropelPriceFactory_PDG"/>
<as:field name="EuropelPriceFactory_PPG"/>
<as:field name="EuropelPriceFactory_PTG"/>
<as:field name="approvalStatus"/>
<eac'field name="articleStatuc" />
Products

Product Q__ Global Operator: And -

Attribute Comparator Value Sort Order

a
Article Number Contains ~ .

Identifier Contains
A » en -
ass

Catalog version Equals ’ oon

Product variants type Equals - oe

Alternative 1D ’ Equals a

INTERNAL SAP ane Partners Only 23

UI Configuration ¢ List View (for Product)


{_} Product... Article Number 41 identifier 1 Status Catalog Version
Oo = 1978440_md_red DSC-H20_MD Red Avb Electronics Product Catalog ; Online

D = 1978440_md_green DSC-H20_MD Green a4-b Electronics Product Catalog ; Online

Om 1978440_md_blue DSC-H20_MD Blue Avb Electronics Product Catalog : Online


OO = 1978440_md DSC-H20_MD ave Electronics Product Catalog : Online

Ba 5097548 '500D + 18-55mm IS + EF-S 55-250 1S aos Electronics


Product Catalog : Online
D = 5864583 EasyShare M531 y Yor) Electronics Product Catalog ; Online

oO ss 5864567 EasyShare M531. AgS Electronics


Product Catalog ; Online

OD oO s473u5 500D + EFS 18-55mm 1s aos Electronics


Product Catalog : Online
oO # 5103775 ‘AC-PWAOAM avo Electronics
Product Catalog : Online
oO ™ 5103712 ACNOVIO avs Electronics Product Catalog
: Online

0D B 4873607 8G8 SDHC Card aoa Electronics


Product Catalog : Online

<context component="listview" type="Product">


<list-view:list-view
xmlns :list-view="http://ww.hybris.com/cockpitng/component/listView">
<list-view:column pring-bean="previewListCellRenderer" width="26px"/>
<list-view:column ifi code" />
<list-view:column ifier="name"/>
<list-view:column approvalstatus"/>
<list-view:column qualifier="catalogversion"/>
</list-view:list-view>
</context>
INTERNAL SAP ane Partners Only 24

© SAP SE C4H341 29
Create New Product x

Ul Config * Create Wizard (for Product) {teentets


Ali rege fekds 2 thewtifers and dese
pees 9 Caegertantion
Assign ts copegores a Medio mecie coreern
‘Crna

@-. @ 8 Anicie Number:*

{ Product T.... Article Number 11 identifier 41 Ul J


[ a 1978440_md_red DSC-H20_MO Red Approval *
Oo 1978440_md_green check -

{) 1978440_md_blue Catalog version.”


Os 1978440_md
@ 8897548

</wziprepare>
<wz:step id="step1" label="create.product.essential. label"
sublabel="create.product.essential.sublabel">
<wz:content id="step1.content">
<wz:property-list root="newProduct”>
<wz:property qualifie "code" type="java.lang.String"/>
<wz:property qualifie approvalStatus"/>
<wz:property qualifie "catalogVersion"/>

</wzistep>
<wz:step id="step2" label="create.product.descriptions.label"
INTERNAL SAP and Parners Only sublabel="create.product.descriptions.sublabel"> 25

UI Configuration « Base (for Product)

DSC-H20 Red [1978440_red] - Electronics Product Catalog : Staged

& @ csc
Properties Attributes Category System Prices Multimedia Stock

Essential

Article Number* identifier © Catalog version*

1978440_red DSC-H20 Red Electronics Product Catalog : Staged

<context merge-by="type" parent="GenericItem" type="Product" Component="base">


<y:base>
<y: labels>
<y:label>( name ?: '' ) + ' ['+ ( code 23) '" ) +'] - | + @labelService.get0bjectLabel(catalogVersion)</y:
label>
<y:description>description != null ? description + @labelService.getObjectLabel (#this)</y:description>
</y: labels>
<y:preview urlQualifier="thumbnail?:picture"/>
</y:base>
</context>

INTERNAL SAP and Parners Only 26

30 C4H341 © SAP SE
UI Configuration ¢ Editor Area (for Product)

DSC-H20 Red [1978440_red] - Electronics Product Catalog : Staged a

G6 8 2 t 4 Refresh

Properties Attributes Category System Prices Multimedia di Stock

Essential a

Article Number* Identifier © Catalog version* Approval*

1978440_red DSC-H20 Red Electronics Product Catalog : Staged approved cd

<context merge-by="type" parent="GenericItem" type="Product" component="editor—area">


<ea:editorArea name=""">
<earessentials>
<eajessentialSection name="hmc.essential">
<ea:attribute qualifier="code"/>
<ea:attribute qualifier="name"/>
<eaiattribute qualifier="catalogversion"/>
<eaiattribute qualifier="approvalStatus"/>
</ea:essentialSection>
</eazessentials>

INTERNAL SAP and Partnors Only 27

Backoffice — Application configuration (widgets.xml)


= Application configuration contains information about every widget in your application:
2 how each widget nests in a slot of another widget
9 how widget communication sockets are interconnected
2 widget settings (e.g., visibility restrictions)
= Ways to view widget configuration:
— Backoffice Application Orchestrator — Menu item, "Show widgets.xml"
Configuration for all of Backoffice (merged contributions from all Backoffice extensions)
Stored/cached as a Media item via the media store
Not to be modified directly — updates automatically as you make changes via Application Orchestrator
— trainingbackoffice/resources/trainingbackoffice-backoffice-widgets.xmI:
Bit of configuration contributed by one extension, e.g. trainingbackoffice
= Resetting widgets.xml in the Application Orchestrator results in a reload of the default
configuration from all Backoffice module extensions, overwriting the dynamic configuration.

? Okay, then how do we persist the dynamic configuration we created in the Orchestrator?

OQ The recommended approach is to use the Orchestrator to design the widget mashup, then copy
the generated configuration (from “Show widgets.xml") to your custom extension to persist it.

INTERNAL SAP and Partnors Only 28

© SAP SE C4H341 31
Useful Reading

«= SAP Commerce Cloud Backoffice Framework Developer Training (formerly HY465)

« https://training.sap.com/course/c4h365

« Backoffice Administration Cockpit

« https://help.sap.com/docs/SAP_COMMERCE CLOUD PUBLIC CLOUD/9b5366ff6eb34df5be29


881ff55f97d2/8c16979286691014abe6f41434c7614a.html

« Backoffice Framework Module

« https://help.sap.com/docs/SAP_COMMERCE CLOUD PUBLIC CLOUD/9b5366ff6eb34df5be29


88 1ff55f97d2/6e195f56350442a2b68207e226f80c46.html

* Cockpit Framework Overview

» https://help.sap.com/docs/SAP_ COMMERCE CLOUD PUBLIC CLOUD/9b5366ff6eb34df5be29


881ff55f97d2/8b7e87648669101492c0c27eaf066dff.html

INTERNAL SAP and Partnors Only 29

Key Points

1. Backoffice is the major UI for SAP Commerce Cloud to manage any data.

2. Backoffice contains a Ready-to-Use library of Ul components, called widgets.

3. You can extend Backoffice by creating a custom Backoffice extension with the ybackoffice
template.

4. You can visually configure Backoffice UI widgets using the Application Orchestrator

5. Don’t forget to save your UI context configuration and widget configuration to your local
backoffice-config.xml and backoffice-widgets.xml, respectively, to persist your changes.

INTERNAL SAP and Partnors Only 30

32 C4H341 © SAP SE
Backoffice Exercise

SAP Customer Experience

Thank you.

© SAP SE C4H341 33
SAP Customer Experience

Validation Framework

INTERNAL — SAP and Partners Only

What we will cover in this topic

ee REE ere
nin
f— General Services. § ———

Ea a [ow |

ERNAL SAP ard Partners Only

34 C4H341 © SAP SE
We will learn about:

> Data Validation Framework

> Validation Service

> Validation in the Backoffice

>» Feedback Integration

INTERNAL SAP and Partnors Only 3

The Context

© The SAP Commerce data validation framework offers an


easy and extensible way to ensure that only clean, correct,
and useful data is passed on to the persistence layer.
The validation framework is based on the Java validation
specification JSR 303.

INTERNAL SAP and Partnors Only 4

© SAP SE C4H341 35
Overview

= SAP Commerce provides a Data Validation Framework based on the JSR 303 Java validation
specification

= It offers an easy and extensible way to validate data

= You can provide user-friendly and meaningful notifications when allowing users to provide or re-
enter valid input

= Only validated data is passed on to the persistence layer

= In contrast to the JSR 303 specification, constraints can be


created and modified at runtime

sans
4

INTERNAL SAP and Partnors Only 5

Data Validation Framework

36 C4H341 © SAP SE
Overview (continued)

= Constraints can be defined in Java code, XML, the Backoffice, or imported with ImpEx

= All constraint instances are eventually persisted in the database as items

= You may define your own constraint types

= The Data Validation consists of the three following areas:

— The Validation Service is a service in the ServiceLayer which defines constraints and
performs data validation
— The Backoffice allows you to create and manage constraints
— Feedback integration provides validation feedback to the user

INTERNAL SAP and Parners Only

Definition and Use


Constraint Management .
= ELEY Adniniaraton Coca =
Feedback Integration
a Constraints Stefan Reviewer [[email protected]]
D 21m + Fly Bo e es
Maatanen . o ter Ex. bY Mees Makoud Cans To Vict General Addresses Password Payments Orders Reviews Prices Personalization Segwenistion Administration

Pace compensa Vieng nee comic


= ConeamestmtiateCredetet nConeront a ae f bsTeammine 10" caorst bets
aman temeCidet ena be eee Covememetieat
POLO Orly Comsruents
catenatiane tree catemertndet Let a ©

ac io s staan Renew
EE 62037 1.728.460
82s coedbAsICHA
ae a cl pinot YO im 4
easeprermumeengncembors or ete easeprereneae Neenresewerzo.@
hier com /
Deumasenayeumussicorss oA, en ve ee Cae eee NCO #
cornea | ro eo propniies /
tecinsoanen ot mes Atay i
revcenamcernare | rele reper ume . ?
Saved guecnn v Eevconscorreconeruréartvwretbartgeentcn forte EveceCertgnatecoradel I fesmomergoun]
nego econo mecatactn ow eke seecuhopenytuingenenne 4
f ‘Ste Preteences© \
1I + Creat Ste Preferences - \\
| . . }
\ Validation Framework /
AN NY =
Validation Engine
4 “
7
_— Peat
~ ~ a “—
se ValidationService ae

INTERNAL SAP and Parinors Oniy 8

© SAP SE C4H341 37
Validation Service

Key Features

= The Validation Service loads the validation engine with constraints

= Data is validated based on a set of validation constraints

= All direct or indirect modelService. save calls are intercepted, aborting save operations where
necessary, in e.g.:

— ImpEx Import operations


— Synchronization jobs

= Validation methods may be called explicitly

Load
Database
(Constraints) — ValidationService
onstraints

INTERNAL SAP and Partnors Only 10

38 C4H341 © SAP SE
Architecture

Validatic vice Validati roups

ModeliPOJO | > implements loads


loads 5 dati :
calls
DefaultValidationService <——
uses
ValidationEngine < ValidationConstraint
Definitions
| Validationinterceptor < Set<HybrisConstraintV
yl floaas
iolation> Sos .
Intercepted by’ ValdationConsiraint

= Validation is performed by the DefaultValidationService

= This service uses a JSR 303-compliant validation engine

= The Validation Service contains two groups of methods:

— Validation methods to validate items, properties or values

— Control methods to alter the behavior of the validation engine

INTERNAL SAP and Partnors Only 11

Example
Validati roups

ModeliPOJO | > implements loads


calls 7 . . uses . , 7 loads ValidationConstraint
Pata
DefaultValidationService <—— ValidationEngine Definitions
| Validationinterceptor < Set<HybrisConstraintV
yl floaas
iolation> Sos .
Intercepted by’ ValdationConsiraint

interface ValidationService {

void reloadValidationEngined);
<T> Set<HybrisConstraintViolation> validate(T object, Collection<ConstraintGroupModel> g);

<I> Set<HybrisConstraintViolation> validateProperty(T object, String propertyName,


Collection<ConstraintGroupModel> g);

<I> Set<HybrisConstraintViolation> validateValue(Class<I> beanType, String propertyName, Object o,


Collection<ConstraintGroupModel> g);

void setActiveConstraintGroups(Collection<ConstraintGroupModel> groups);

}
Example Client (for explicit validation) usage:

ProductModel model = ...3

INTERNAL SAPand Parireso@t<HybrisConstraintViolation> constraintViolations = validationService. validate(model); 12

© SAP SE C4H341 39
Validation Engine

Validatic vice Validati roups

ModevPOJO | > implements loads


calls — oy uses Ea 5 loads \ValidationConstraint
a __=_ DefaultValidationService ValidationEngine Definitions
| Validationinterceptor < Set<HybrisConstraintV loads
iolation> os 5
intercepted by ValdationConsiraint

= The Validation Engine is loaded with JSR 303-compliant constraint instances at


run-time

= Itcan be reloaded with new or modified constraint instances

= All JSR 303 constraint types are supported

= New constraint types may be created via new type definitions (in *-items.xml),
recompilation and a system update.

INTERNAL SAP and Parners Only

Constraints

Validatic vice Validati roups

ModeliPOJO | > implements fa


J SS . uses SS : loads idati T
calls DefaultValidationService <—— ValidationEngine <—_ NenGanOnCOnsIiary
Definitions
| Validationinterceptor < Set<HybrisConstraintV fioads
iolation> oe =
Intercepted by’ ValdationConsiraint

All JSR 303-compliant validation constraints can be used:

Java annotation:
NotNullConstraint
public class User {
@NotNull
OQ JSR-303 was intended for in-code annotations, i.e. . . .
not suitable for annotating model classes, since they private String firstname;
are automatically generated. }

Instead, we create constraints in Backoffice that


target a particular model and its properties.

INTERNAL SAP and Parners Only

40 C4H341 © SAP SE
OOTB Constraints
The Data Validation framework provides implementations of all constraint types defined in the JSR 303
specification, and a few additional ones:

AttributeConstraint
* PatternConstraint, RegExpConstraint
* PastConstraint, FutureConstraint Customizing new constraint type
is covered in “SAP Commerce
* DecimalMinConstraint, DecimalMaxConstraint
Cloud - Additional Technical
*MinConstraint, MaxConstraint Essentials”
* SizeConstraint (for String, Collection, Map, and Array) |
* DigitsConstraint (for integers)
* AssertTrueConstraint, AssertFalseConstraint
*NullConstraint, NotNullConstraint
* NotBlankConstraint, NotEmptyConstraint

TypeConstraint (i.e. to validate whole items of composed types)


* XorNotNullConstraint (i.e. only one of two selected attributes has value at a time)
* DynamicConstraint (based on dynamic script expression)

INTERNAL SAP and Parners Only

Tt + Refresh sve
Constraint types
You have 3 Validation Messages X
= Severity
_ . . . aA ow SNES MI GaRRREBE
Each constraint can be assigned an Error / Warning / Info “hp
severity level blank.
— Error constraints cause a save operation to be aborted re
— Users may choose to ignore Warning constraints and save iS gl la al
anyway 1
A Site
The site of the customer is no
t supposed to be null
= Groups isi

— Constraints can be assigned to zero or more groups (Zero = Close


default group)

~The engine can be told which constraint group(s) to use for Is used in the following constraint groups
validation
Constraint groups @

= There are attribute, type and dynamic constraints hemCoresttiputesCoveragecroup

INTERNAL SAP and Parners Only

© SAP SE C4H341 4
Validation in the Backoffice

Backoffice constraints page overview


= ED Administration cockpit ~

Gruen Constraints

SB saem .
Vatication v Sev... IT En. It Needs Reload... Class
To Validate
Chesaih gitias Waming tmue — false CategoryModel
hy Error tue ConsumadCertificataCredentialModel
I Constraints ] v
Error tue false CustomThemeModet
PO.p Only Constraints
Error tue false ‘CustomerModet
Error tue false CustomerModet
tue false CustomerModet
tue —talse CxSegmentModet
false ConsumedDestinationModel
false ProductModel
EmployeeModet

Saved queries Vv ntConfigurationModet

No queries ‘onfigurationModet

. . v . . . .
List constraints
INTERNAL SAP and Parners Only
Create new constraints Reload the validation engine

42 C4H341 © SAP SE
Features

» With backoffice admin cockpit you can:


List constraint declarations
Filter constraints
— Create and manage constraints and constraint groups
Reload the validation engine

INTERNAL SAP and Partnors Only 19

Feedback Integration

© SAP SE C4H341 43
Feedback Integration
Steve Reviewer [keenreviewer4 @hybris.com]

oA Tt + Refresh [save ]
Sed
General Addresses Password Payments Orders Reviews Prices You have 3 Validation Messages

Aa oo
Essential The attribute "ID" cannot be
blank.
Name ae B customerio Origin,
A Name
7'382d96a-1057-4903-95 12-feedObaaci02 keen! beTies blank
aioe Fuse” canetct

LR a a ‘im
‘The site of the customer is no
[email protected] t supposed to be null

Close
Properties a

Standard Language Standard Currency Groups Description


[eustomergroup]

= Data validation is integrated into the editing area of Backoffice


= Users are notified of all validation issues
INTERNAL SAP and Parners Only 24

Key Points

1. SAP Commerce Cloud provides a Data Validation Framework based on the JSR 303 Jav: a
validation specification

2. The data validation framework includes the ValidationService, Backoffice integration, and
Feedback integration.

3. Validation engine can be re-loaded at runtime

4. There are two ways to invoke ValidationService


* explicitly
* Implicitly, via the ValidationInterceptor

INTERNAL SAP and Parners Only 22

44 C4H341 © SAP SE
References

= Data Validation Framework:

= https://help.sap.com/docs/SAP_ COMMERCE CLOUD PUBLIC CLOUD/aa417173fe4a4ba5a473


c93eb730a417/8ba7f5a9866910148b749e721 7fa45fa.html

= JSR-000303 Bean Validation:

= https://icp.org/aboutJava/communityprocess/final/jsr303/index.html

= “SAP Commerce Cloud - Additional Technical Essentials” Live Sessions in SAP Learning Hub

= https://blogs.sap.com/2021/07/22/introduction-to-the-live-session-series-sap-commerce-cloud-
additional-technical-essentials/

INTERNAL SAP and Partnors Only 23

Validation Exercise

© SAP SE C4H341 45
SAP Customer Experience

Thank you.

©2023 SAP SE or an SAP affiliate company. All rights reserved. Soe Legal Notice on wa". sap comilegal-notice for use terms, disclaimers, disclosures, of restrictions relate’ to SAP Materials for genoral audiences

SAP Customer Experience

Personalization

INTERNAL — SAP and Partners Only

46 C4H341 © SAP SE
What we will cover in this topic

qt Methodology

Data Product Coupons and Order P. lizati Search and


Modeling
Pricing Payment ersonalization Navigation
Modeling Promotions Management

Development General Services r Maintenance

-{ Web Layer = Service Layer L -t Background Task = impex Flexible Building

Pr Search Framework
WCMS Facade Cronjobs

en P Installation
Validation Security Confi ti
occ Service Riles
Engine

Event Cache Update and
. System Initialization
Backoffice occ Workflows

Scripting

INTERNAL SAP and Partners Only 2

We will learn about:

> Personalization Overview

> Essential Data Models

> Customer Experience Calculation

> User and Segments

> Personalization of Content

> Exercise How-to

INTERNAL SAP and Partners Only 3

© SAP SE C4H341 47
The Context

6) Personalization provides an integrated, user-friendly


way to build experiences that are relevant to your
customers.

INTERNAL SAP and Partnors Only 4

Preparation
-!
O5EOO O

Complete Preparation P1 of the Personalization


exercise
OF O

(The setup ant target will compile your system during the
lecture)

INTERNAL SAP and Partnors Only 5

48 C4H341 © SAP SE
Personalization Overview

Problem: Unfocused mass communication strategy

© SAP SE C4H341 49
Solution: Personalization
Personalization
Ce |
ee Ls Ne hs Es
|

!
|
araran Content I
UQUGUQUE

Restrictions

= Date/time
>|
!
| + a
PP
oY
pers
6. "
= »

»
= Usergroup
| |
Received Promotions
Segments As our VIP customer you receive a 10% discount
Ex: Personalized Promotions
=~ = VIPGoldStatus
= CameraLensEnthusiast Customization (Ex: Spring Sale) Shop by Brand

~ Target Groups: , Quiksilver (46)


= Spring Sale for VIPs
Vans (60)
Custom = Spring Sale for Camera Lovers
Personalized Search Profile 9
* Geolocation
* Referral Link :
Custom Actions
INTERNAL SAP and Parners Only

Personalization Module Overview

» Integrated, user-friendly way of building experiences relevant to customers

» Use SmartEdit to configure and see the customer’s personalized experience in real-time

Ea” smarteait

English v

INTERNAL SAP and Parners Only

50 C4H341 © SAP SE
Available Personalization Options

Your website's content can be tailored to users in multiple ways:


1. Restrictions
= Defined at the page or component level
= Restrictions include date/time, category, product, and usergroup
=" Example: During the holidays, show a festive products carousel on the home page
2. Segmentation
= Serve members of a segment custom content, personalized search profiles, and promotions
= Customers may be associated with one or more segments
=" Example: Customers in the SonyCameraLovers segment will see Sony products first in the
search results

3. Custom
= Create custom strategies for providing personalization to customers
= Example: Customers who achieve Silver reward status will see a special homepage banner
INTERNAL SAP and Partnors Only 10

SmartEdit Personalization Features QD

» Create and manage the targeting of content ?


« Dynamic decision-making on how to display and layer personalized content on the storefront

: Dedicated preview to observe changes in the appropriate context (different users, date range,
)

« Integrated with the composable storefront and accelerator storefronts

* Built-in capability to work with user segments

« Consent checks for registered and anonymous users to collect and process personalized data

« Supports annotation and retention of personal data for report generation or anonymization

« Trigger custom search profiles and promotions with Commerce Customizations

INTERNAL SAP and Partnors Only 11

© SAP SE C4H341 51
Other Complementary Tools/Systems
Emarsys

= With Emarsys Personalization Service, you can create tokens that are reusable across different channel campaigns.

= Emarsys Scripting Language (ESL) lets you personalize your content based on external factors, as opposed to the standard
personalization options.

= The Visual Content Editor (VCE) provide conditional text, link tracking, block targeting and other features to create a
personalized block-based email campaign.

Backoffice/ImpEx
= Manually create and manage:
— Segments
— User-segment relationships
— Instances of custom triggers
— Customizations and variations (SmartEdit more recommended though)
= Link custom personalization actions to variations and customizations

SAP Commerce Cloud, Intelligent Selling Services


= Continually enriches customer's profile based on storefront interactions

= Provides personalized experience in various product recommendation with machine/deep learning mechanism
INTERNAL SAP and Parners Only

Essential Data Models

52 C4H341 © SAP SE
Personalization Module Terminology

«= Segment
— Group of customers who share common characteristics (e.g. women, teen13-18, BurtonLover)
— Each customer has an affinity associated to a segment (a number between 0 and 1 indicating the
weight given to the relationship)
— Can be created automatically based on data from external systems like SAP Marketing Cloud or SAP
Commerce Cloud Context-Driven Services

« Variation (also called Target Group)


— Group of one or more segments with associated storefront actions that are activated by a trigger
— Represents one possible set of customers and actions within a single customization
— Example: A customer in the teenBurtonLover variation will see different content on the storefront than
a customer in the adultBurtonLover variation during the same Winter Sale event

«= Customization
— Contains one or more variations and represents a storefront event (e.g. Winter Sale)
— Example: The WinterSale customization has three variations, childWinterSaleLover,
teenWinterSaleLover, and adultWinterSaleLover. Each of these variations shows different but relevant
content for the same Winter Sale.
INTERNAL SAP and Parners Only 14

Personalization Module Terminology — continued

« Action
— Represents something changed from the typical display on the storefront
— Shows a different CMS component, activates a promotion, or activates a custom search profile
— Associated with a variation. Action takes place when a trigger activates its associated variation
— Example: Customers with Gold reward status will see a banner for Free Express Shipping during the
Winter Sale

« Trigger
— Represents the conditions for the activation of one variation
— Types of triggers include default, segment, and expression-based
— Example: An expression trigger is configured to activate its variation when the customer is in both of
the segments ShortsLover and Age30-39, but not in the segment VIPGold

INTERNAL SAP and Partnors Only 15

© SAP SE C4H341 53
Personalization Terms and their Relationships

Customization

m 6Variation Trigger AND


Segment C
eee ction 1_|
aemene Action 2 |

ym Variation Trigger OR
Segment B
numene ction 3_|
smmene Action 4 |

INTERNAL SAP and Partnors Only 16

Customer Experience Calculation

54 C4H341 © SAP SE
User Experience Calculation Flow When a Customer Logs In

j j ASYNCHRONOUS
= Login = Evaluation

SYNCHRONOUS

Update Segments
Evaluate Triggers

! !
Evaluate Triggers
Store results in session

s Store results in
database

INTERNAL SAP and Parners Only

Configuration of the Customer Experience Calculation Process

Configurable in Backoffice/ImpEx
= Configuration stored in CxConfig item

= What can be configured?

— BaseSites (e.g. for the composable storefront)


electronics
— Consent templates

— Calculation process (under Calculation tab, covered later)


— Webservices-related properties (under Commerce Web
Services, important for composable storefront)

— Integration-related properties (under Integration)


= Aproperty-based default configuration exists for all Attributes
BaseSites that don’t have a specific configuration
(project.properties of pesonalizationservices)

INTERNAL SAP and Parners Only 20

© SAP SE C4H341 55
Calculation Tab
Calculation process name* @ Minimum affinity* @

defaultPersonalizationCalculationProcess 0.50000000
= General:
= Calculation process name
Initial actions
= Minimum affinity
User login actions @ New session actions @ Actions when user gives consent ®
» Initial actions ASYNC_PROCESS RECALCULATE

= 3 out-of-the-box actions: RECALCULATE

— UserChangedActions
(User Login actions)
set of actions to be executed after a userChangedEvent (i.e. a user logs in)
— AnonymousUserDefaultActions (New session actions)
set of actions to be executed when anonymous user is detected
— ConsentGivenActions (Actions when user gives consent)
Set of actions to executed when consents were given
= Available Actions: UPDATE, RECALCULATE, LOAD, ASYNC_PROCESS, IGNORE (covered later)

INTERNAL SAP and Parners Only 24

User Experience Calculation Action Flow


7 , SYNCHRONOUS ———————
CxRecalculationService.calculate SYNCHRONOUS

SYNCHRONOUS —I

ASYNC_PROCESS
RECALCULATE UPDATE
CxSerice.
Fi CxSegmentService.
startPersonalizationCalculationProcesses() CxService.
calculateAndLoadPersonalizationInSession() [1] updateUserSegments()

CxProcessService. 1
startPersonalizationCalculationProcess() v UpdateUserSegmentStrategy.
5 ---& CxVariationService.getActiveVariations() ——_§_|—]2] updateUserSegments()
- Gets process definition name from CxConfig
calculationProcess attribute
CxTriggerService.getVariationsForUser()
BusinessProcessService. » Get all registered trigger strategies

a
createProcess()
startProcess() - For each trigger strategy: call getVariations{) LOAD

' (6)
Le
+—#- CxVariationService. calculatectionsResults()«—| | 3 ] CxService.
loadPersonalizationInSession()
CxActionService.getActionsF orVariations()
a CxSegmentService.
174 updateUserSegments(user) For each action: call executeAction()

i I
ActionResultService.
loadActionResultsInSession()
i
¥1 || CxService. | ActionResultService.setActionResultsinSession() | 4
ol

calculateAndStorePersonalization(user) 71
\Le ActionResultService.storeActionResults(}

SE PTT ON 22

56 C4H341 © SAP SE
Voters

» Classes that determine when and how the recalculation of user experience results is triggered
« Help maintain faster performance of customer experience calculation

* Called on each request

«Each voter
— Extends AbstractVoter (which implements Voter)
— Overrides the getVote(...) method
— Has access to the HttpServietRequest and HttpServietResponse
— Can set the following properties on the returned Vote object:
* recalculateActions — set of actions to be executed (values from RecalculateAction enumeration)
* conclusive — if true, the vote is final and no other vote is considered
— Gets automatically registered with CxPersonalizationFilter
» Logic of handling voters and votes is in CxPersonalizationFilter
1. Evaluates voters according to their order (member variable of AbstractVoter)
2. For each voter, checks if the returned Vote is conclusive
¢ If conclusive, only this specific vote is considered
¢ If not conclusive, the actions returned by each voter are merged into one set of actions to execute
INTERNAL SAP and Parners Only 23

Types of Voters
* PreviewVoter
— Triggers recalculation if a preview ticket exists
— Experience can be calculated for a user other than the logged in user
— Conclusive by default

» AnonymousVoter
— Defines the recalculation behavior for the anonymous user
— Uses the configuration from the Anonymous User tab of the CxConfigModel in Backoffice

* Periodic Voter
— Triggers periodic recalculations
— Configuration stored in CxPeriodicVoterConfigModel

= ConfigurableUrlVoter
— Triggers recalculation if the request URL contains one of the configured patterns
— Configuration for each ConfigurableUrlVoter is stored in the CxConfigModel using a CxUrlVoterConfigModel object
— If arequested URL matches more than one ConfigurableUrlVoter configuration, the actions will be merged

= Create your own custom voter


— Create a class that implements de.hybris.platform.personalizationservices.
voters. Voter
— Define the class as a bean in Spring context — it will automatically be found and used by CxPersonalizationFilter
INTERNAL SAP and Parners Only 24

© SAP SE C4H341 57
User Experience Calculation Flow - On Each Page Request

CxPersonalizationFilter CxRecalculationService.
recalculate{, )
Hiultateaiee!

Get Votes Create


Registered Voters Action List

oo,
PreviewVoter RECALCULATE ! Execute each action
15t ‘conclusive’ i in order
Action Hl
|
PeriodicVoter \
OR \
ii
ConfigurableUnVoter Merged |
Actions |
List
NewSessionVoter RECALCULATE F—— |__ 4

order variable (int)


CxRecalculationService.orderedActionList f-— Sets ordering ---—~
INTERNAL SAP and Partners Only 25

Triggers and Trigger Strategies


Automatically registered cxAbstractTrigger
j | Type System
| CxTriggerStrategy |
|| || xampleTrigger
+ variationTriggered Vanisition
ee) on | exampleStrategy |---| exampleDAO JOO
i i
J ¥ findApplicableVariations (example,
getVariations(user,catalogversion) osarSarniea catalogVersion)

= Each trigger Item (instance) represents the conditions for the activation of one variation

= Each type of trigger is represented in *-items.xml as a Type that extends CxAbstractTrigger


— CxDefaultTrigger, CxSegmentTrigger, CxExpressionTrigger

« Trigger strategies return the potential variations for a customer


— They use trigger DAOs to find the variations associated to the
customer with trigger conditions that evaluate to true
3 out-of-the-box trigger strategies
* CxVariationService further filters out any variations that are marked as inactive
+ CxTriggerStrategy
— Each trigger strategy implementing the CxTriggerStrategy interface is
+ DefaultSegmentTriggerStrategy
automatically registered with CxTriggerService by having a bean in
the Spring context + ExpressionTriggerStrategy

INTERNAL SAP and Partnors Only 26

58 C4H341 © SAP SE
Cleanup of Personalization Calculation Results

« Personalization-related data stored in database


— Lots of old personalization calculation results stored in database for each user (especially for
anonymous user)
— Each asynchronous personalization calculation creates a new business process that is
stored in the database

« Problem
— Database table could easily grow to an unmanageable size and reduce performance

« Solution
— Clean old personalization calculation results (particularly for anonymous users)
+ Use a ‘session close’ listener or the CxResultsCleaningCronJob
— Clean old business processes from asynchronous personalization calculations
« Use the CxPersonalizationProcessCleanupCronJob
INTERNAL SAP and Parners Only a7

User and Segments

© SAP SE C4H341 59
Manage Segments in Backoffice

i] come oven “aon boven aes


a re sg , om
© veovaioniin mm
A Maney > wn

was , toss
&
| 1 enmoriaaas pcccae n mio a etad on
i leowlcen LD CATEGORY 57? Us who browse Weeticaria predate otter |

on ,
inten
A &

Rule Enagiew >

Pea Ls CATEGORY brand_10 z


*

ae | fe + + [om]
ore eon 2 Properties Adhrenistration
ser Attributes &
esr con onion = ia ts
hacia CATEGORY brand 16 Vier who berms Caman prods ater WeaerO8 (caromLover) | Sunged

cameron samt rte Onne


eimai =r
_ a sonatas
CAreconY
er crerowsrt_| Sct hors tae (e) Faun)
wes ++ ven Ur Sere aon
INTERNAL SAP and Partnors Only 29

Manage User to Segments in Backoffice

— Users in segments Tien w search a [a| 2

Bow aa) a ile . A We recommend you retrieve


od ie ae Sein penne ota segment data from external
B tetere Ses ert eres emesis : systems, such as SAP Emarsys
SS ‘Man vip pout meringue pte cord CATEGORY 588 Emenee S$ 1.800800 . .

baa se rem caconrerr een ence Segments, their assigned users,


a wus Cannan YW" 20m) [vegan Mes com) wrens coin S$. Leoneenne . wt
—— Saran Sunmene ee ————. and corresponding affinity can also
Le ae Curae neste osoesremcn| neste Ect. Ltoseo0 be created using ImpEx
SR wene aes a .
SE eennten Affinity is used to select the most
CATEGORY brand_10 to [email protected] (electronics, null) 2 .
vom % (=e appropriate among several
—- fe ia matching variations in a
ae re
Attributes
:
customization for a specific
ees in eeyrer

‘eretore uD Save te O are ® customer

aca

INTERNAL SAP and Partnors Only 30

60 C4H341 © SAP SE
Demo

Personalization of Content

© SAP SE C4H341 61
Personalization — SmartEdit Interface

SAP” santa + © 8 1. Enable the Personalization mode in


Pages Stobart st SmartEdit by selecting
af Personalization from the dropdown
menu
5 mer product name or SKU Q
2. Use the . Customize
.
tabtoa to select a
customization and variation, and then
BRANDS + DIGITAL CAMERAS ~ FILMCAMERAS CAMCORDERS WEBCAMS ACCESSORIES ~ customize one or more components

on this page
5 my —_— - 3. Use the Library tab to create and
y, manage your customizations
SAVE 4. Use Combined View to visualize the
effect of personalization when
multiple variations are applicable

INTERNAL SAP and Partnors Only 33

Personalization — Customization Library

| Manage Customization Library ! x


——— a

SPA Electronics Content Catalog - Staged | Customizations (3) Search Customizatic Q All Statuses ~ Create New Customization

Customization Target Groups Components Status Start End

> SummerSale 2 Enabled

I
|. CategoryLovers 2 Enabled
I
I
I
; canonLover 1 Enabled

cameraLensesLover 1 Enabled

> ViPCust 1 Enabled =

INTERNAL SAP and Parners Only

62 C4H341 © SAP SE
Create A New Customization

Customization x

Basic Information

Name*

Enter a name for this customization

Description

Enter a description for this customization

Status Configuration

a
Configure Date For Activation
Date settings only apply if the customization is enabled. If the customization is disabled the date
configuration will have no effect.

| Next | Cancel

INTERNAL SAP and Partners Only 35

Edit Target Groups (Variations)

Customization x

Basic Information Target Group

SpringSale Enabled

Add Target Groups


to Customization
| __ §-§ -- -- = —— : t
~ | [coset cr :

| Save Cancel

INTERNAL SAP and Partners Only 36

© SAP SE C4H341 63
Commerce Customizations

Y CategoryLovers:

canonLover st Enabied

cameraLensesLover

> VIPCust 2 Enabled

= Commerce Customizations are non-CMS — ite"


actions performed when a user belongs to a Commerce Customization

target group
CategoryLovers (Enabled) > canonLover (Enabled)
= SAP Commerce Cloud supports two types of
commerce customizations Commerce Customization Action

1. Personalized Promotions: assign [ search

promotions to selected target groups. Search

Personalized Search Profiles: Assign search Promotion


t
profiles (defined in the Adaptive Search cockpit
in Backoffice Administration Cockpit) to Selected Commerce Customizations

selected target groups


INTERNAL SAP and Parners Only 7

Personalization — Combined View

Navigation Pages == Storefront SPA Electronics Content Catalog - Staged | English | Electronics Prod, " Visualize personalization effects for
Personalization Y 4 Customize [[) Combined View | Ubray multiple customizations and their
target groups (variations)
Combined View @

Edit | Clear All " You can even select a specific target
group from the list to see its effect on
SummerSale
SummerSaleDetault personalization
BRANDS ~ DIGITAL CAMERAS y FILM
CategoryLovers
canonLover

ViPCust
ViPDefault

SHOOT BIG
TRAVEL LIGHT

INTERNAL SAP and Parners Only 338

64 C4H341 © SAP SE
Demo

eam [ase | Sn! S 7

Exercise How-to

© SAP SE C4H341 65
Business Requirement

Show the following banner to customers who have placed multiple orders:

Hi, Alistair
SAP Enter product name or SKU Q
My Account v

BRANDS ~ DIGITAL CAMERAS y FILM CAMERAS CAMCORDERS WEBCAMS ACCESSORIES v

INTERNAL SAP and Parners Only 42

Exercise preparation

The preparation script for this exercise has created most of the elements in the framework needed:

1. AMedia item assigned to the variationFor3Orders

2. Atrainingpersonalization extension (based on the yempty template)

3. A OrderCountTrigger type (in *-items.xml) with a single property, orderCountThreshold (we will set it to 3
when we create the Trigger instance)
= The new trigger strategy has to have a type that corresponds to it. Using Java Generics, we pass this
trigger type to the strategy interface we are implementing

4. The Backoffice configuration was updated to make it possible for you to create this trigger there (you can
also use ImpEx)

5. The logic for our trigger is placed in the DefaultOrderCountTriggerDao class, within our FlexibleSearch
Query, which implements the OrderCountTriggerDao interface. It has a single method:
Collection<CxVariationModel> findApplicableVariations(int orderCount,
CatalogVersionModel
catalogVersion)
{ //use FlexibleSearchQuery to find variations }

INTERNAL SAP and Parners Only 43

66 C4H341 © SAP SE
Exercise Object Structure

SAP Commerce Personalization calls all


Spring bean instances of type OrderCountTrigger
CxTriggerStrategy when looking for
+ variationTriggered
related variations
« orderCountThreshold

Interface
CxTriggerStrategy
rN
|
; i
| DefaultOrderCountStrategy po -—-m! DefaultOrderCountTriggerDAO
T
| findApplicableVariations(orderCount,
catalogVersion)

userService
getVariations (user, catalogVersion)

Use Flexible Search to locate


Find variations associated
variations associated with a
with current user's order
trigger tagged with given
count
OrderCountThreshold

INTERNAL SAP and Parners Only

Exercise — Create a Customization

Backoffice Customization Group

electronicsCustomizationGroup

Customization Customer X

( MVCCustomization >» OrderCount: 5

_ Trigger
Marston : Customer Y
orderCountTrigger
variationFor3Orders OrderCount: 3

SmartEdit Replace Component Action Gustamer Z

homeSpeedMVCBannerComponent OrderCount: 1

XY y,

INTERNAL SAP ane Partners Only

© SAP SE C4H341
Key Points

1. Personalization allows you to apply personalized actions to Target Groups (Variations)


* for example, when user belong to specific segment (belonging to related target group), corresponding
personalization will be applied

2. Personalization calculation process is configurable in Backoffice/ImpEx

3. Personalization Customizations are defined using SmartEdit

4. By default, a Personalized Action can be used with:

¢ WCMS Components — e.g. replace a Banner with another one

* Personalized Promotions — e.g. 10% off cart for the VIP Customer group (to be covered in Promotions &
Coupons)

¢ Personalized Search Results — e.g. show Canon cameras at the top of search results for Canon lovers (to
be covered in Search & Navigation)

5. To customize personalization, you can customize Triggers and Actions

INTERNAL SAP and Parners Only 46

Personalization Exercise

68 C4H341 © SAP SE
SAP Customer Experience

Thank you.

©2023 SAP SE or an SAP affiliate company. All rights reserved. Soe Legal Notice on wa". sap comilegal-notice for use terms, disclaimers, disclosures, of restrictions relate’ to SAP Materials for genoral audiences

SAP Customer Experience

Search and Navigation

INTERNAL — SAP and Partners Only

© SAP SE C4H341 69
What we will cover in this topic

qt Methodology

Data Product Coupons and Order Search and


Pricing Payment Personalization
Modeling Modeling Promotions Management Navigation

Development General Services r Maintenance

ft Web Layer = h -t Background Task =


Service Layer impex Flexible Building
Pr Search Framework
WCMS Facade Cronjobs

eae . Installation
Validation Security Confi ti
occ Service Riles
Engine

Event Cache Update and
. System Initialization
Backoffice Occ Workflows

Scripting

INTERNAL SAP and Partnors Only 2

We will learn about:

> Search and Navigation Overview

>» Indexing Process

> Searching

> Adaptive Search - Overview

> Adaptive Search - Configuration

>» Enhanced Search Experience with Personalization

INTERNAL SAP and Partnors Only 3

70 C4H341 © SAP SE
The Context

6) The Search and Navigation module functionality helps your


customers browsing your web store intuitively, receiving
fast search results based on the Adaptive Search settings.

INTERNAL SAP and Partnors Only 4

Search and Navigation Overview

© SAP SE C4H341 71
SAP Commerce Search Mechanisms

Model Objects Text Result


FlexibleSearch-based
Search
see IB—
Solr Server/Cloud

FlexibleSearch
Solr Facet Search

¢
coococogcsococcsssgcccossssoad)

ee} Lucene
1\\ | Index
Ee Mi 4
> Advanced-

s
SearchQuery Backoffice

Sa
(ae
Lucene-based Search

> ViewType search Lucene Search

“1, Lucene
*> GenericSearch ‘Index

INTERNAL SAP and Partnors Only 6

= facet represents a Bae mall


distinct feature Eee

" facet isI a way 1in which


1
_|/»ple#fiter plied filt er
Applied
seiaiiiaal
lied filter:
Applied fer
a resource can be $505199.99 * = $50-8199.99 x = $50.5199.99 x = $505199.99 x
classified 10-10.9mp x 10-109mp % Canon x 10-109mp % Canon X
Stores +

= Independent from
Price - Stores Stores +

A Stores -
catalog structure $0-$49.99 (7) Price + Price +

$50-$199.99 (29) numberOfReviews + numberdfReviews + Chiba 2)


$200-$499.99 (26) Choshi (2)
Megapixels - Megapixels +
$500-$999.99 (19) Fukuoka Gest Western
12-12.9mpQ) Brand - Fukuoka Nakasu Inn (1)
$1,000-S1 00,000 (16) Fukuoka Hotel Monterey
RZ 10-10.9 15;
numberOfReviews + 8 moe Sony (6) La Soeur Fukuoka (2)
; n 8-8.9 mp (1) Canon (4) Fukuoka Hotel Nikko
Mounting 7-7.9 mp (1) Samsung (3) Fukuoka (1)

Megapixels + 5 -5.9 mp (3) Fujfiim (1) Ichikawra (2)

Lens type + Brand + Kodak (1)


Price +
Brand +
numberOfReviews +
Category +
Megapixels: +
INTERNAL SAP and Partnors Only 7

72 C4H341 © SAP SE
Search & Navigation Module Asibis GB Version 8.11.2 is used in
SAP Commerce Cloud 2211
Solr —
Extension name Content

Configured Solr server: includes a standalone Solr server which may be configured
to automatically start and stop alongside the platform.
solrserver
This extension is not required by default, but is very convenient in developer
environments.
Solr core functionality: Provides faceted search and navigation functionality based
solrfacetsearch on the Apache Solr server. It enables you to do a faceted search over SAP Commerce
Cloud items such as products and WCMS content.

Backoffice module: Provides the interface to create and manage search


solrfacetsearchbackoffice
configurations using the Backoffice Administration Cockpit.

Adds the Apache Solr Search to Backoffice. With Apache Solr Search, Backoffice
backofficesolrsearch enables faster, more efficient, and more optimized search functionality with faceted
navigation and near-real-time indexing.

INTERNAL SAP and Parners Only

Key Features

= Natural Language Search


= Configurable Faceting
= Promote and Exclude items

= Boost Rules

= Sorting and Ranking


= Synonyms and Stop Words
= Autocomplete Suggestions and Spell Checking
= Extensible API

INTERNAL SAP and Parners Only

© SAP SE C4H341 73
Indexing Process

Indexing Process

* For each item model,


generates SolrlnputDocument
+ Generates attr and values
SAP Commerce type
system Solr Index
A
extract transform

« Uses Flexible Search Service to get


ProductModel instances from DB
* Full indexing = Invoke Solr Service to feed
transformed document data
+ Update indexing
into Solr
* Paritial_update indexing
* Delete indexing

INTERNAL SAP and Partnors Only 11

74 C4H341 © SAP SE
Indexing: Extraction Stage

= Atthe extract stage, data items can be loaded with flexible search in different modes:

= FULL: Recreates the index, all items are indexed based on a FULL index query

= UPDATE: Updates specific items in the index. Items to be indexed/updated are typically selected by an
UPDATE query

=» PARTIAL_UPDATE: Like UPDATE operation, but allows to select the fields to be updated (for faster
updates)

= DELETE: Deletes documents from the index. Items to be deleted are typically selected by a DELETE
query

E> transform load

e.g.: SELECT {p:PK}


FROM {Product AS p} WHERE
{p:modifiedtime} >= ?lastIndexTime

INTERNAL SAP and Parners Only

Indexing: Transform Stage


= At the transform stage, each product item need to be converted to a SolrinputDocument

= Only configured properties and classification attributes are indexed using SolrlndexedProperty

= Property and classification attribute can be configured to support localization and multi-values

= ValueResolvers are used to add field values to Solr index out of each product item

“ D nsom } _

INTERNAL SAP and Parners Only

© SAP SE C4H341 75
Indexing: extract load

Solr indexed properties


INDEXED TYPE

woentifer Composed Type


Product [Product]

index name Config set name

Indexed Properties

Properties@

Name IT Type it Facet it MultiValue 41 Use For Spell Checking f Use For Auto-Complete 11 include
In Response IT

+ itemtype string false false false false true 6

* description text false false false false tue

* summary text false false false false tue

* manufacturerAID string faise false false false ue

“= priceVaiue double false false false @ false true

+ Create Property

= Only configured properties are written to the index


INTERNAL SAP and Partnors Only 14

Indexing: Solr indexed properties Example (solr.impex)

INSERT_UPDATE SolrIndexedProperty; solrIndexedType (identifier ) ; name ; type(code);multivalue; priority;

[ Lr |
facet; facetType(code); facetSort (code) ;useForAutocomplete; fieldValueProvider 5 valueProviderParameter

false; 5 jtrue 5 springELValueProvider jcode


true ;MultiSelectAnd ;Alpha jfalse 5 productPriceValueProvider;

= Valid values for faceting:

-— facetSort(code)
= Alpha
= Custom

— facetType(code)
=" Refine
= MultiSelector
= MultiSelectAnd

INTERNAL SAP and Parners Only

76 C4H341 © SAP SE
Indexing: Classification Attributes (solr.impex)
$classSystemVersion=systemVersion(catalog(id[default=‘ElectronicsClassification' ]},version[default='1.0'])}
$classCatalogVersion=catalogVersion(catalog(id[default=‘ ElectronicsClassification' ]},version[default='1.0'])}
$classAttribute=classificationAttribute(code, $classSystemVersion)
$classClass=classificationClass(code,$classCatalogVersion)
$classAttributeAssignment=classAttributeAssignment($classClass ,$classAttribute, $classSystemVersion)

INSERT_UPDATE SolrIndexedProperty;solrIndexedType(identifier) ;name jtype(code) ;multivalue;

fieldValueProvider 3 $classAttributeAssignment

commerceClassificationPropertyValueProvider; digitalclassification: ::deliveryFormat::::


al

—_—~
$classAttributeAssignment is classAttributeAssignment(classificationClass({code, catalogversion(catalog(id),version))),
classificationAttribute(code,systemVersion(catalog(id),version))),
systemVersion(catalog(id), version)
(The classificationClass is the classification category, and the classificationAttribute is the feature descriptor)
Using defaults, simplifies to: <classificationCategory>:::<featureDescriptor>::::

INTERNAL SAP and Partnors Only 17

Indexing: Data Transformation with Value Resolvers

extract load

= In order to add field values to the Solr index, we need to fetch them out of the model during our indexer
operations. For the transformation, ValueResolvers should be used.
= The recommended way for creating a custom ValueResolver is to extend AbstractValueResolver class.

public class ModelAttributesValueResolver<T extends ItemModel>


extends AbstractValueResolver<T, Object, Object> { Details
in the live session
void addFieldValuesCInputDocument document, about Value Resolvers:
IndexerBatchContext batchContext, “SAP Commerce
Cloud —
IndexedProperty indexedProperty, T model, Adaltional Techical
ssentials”
AbstractValueResolver.ValueResolverContext<Object,
Object> resolverContext)
throws FieldValueProviderException;
f
INTERNAL SAP and Partnors Only 18

© SAP SE C4H341 77
Indexing: Localization and Multi-Values

ous E> ws

<arr name="brandName_text_en_mv"™>

data type | multi-valued?

language

INTERNAL SAP and Partnors Only 19

Indexing: Load Stage

extract transform y= J

» Atthe load stage, Solr service is invoked to feed each transformed SolrlnputDocument into Solr

=» Meanwhile, solr server will use schema.xml and other configurations to setup
index/synonym/stopwords, verify data type, etc.

INTERNAL SAP and Partnors Only 20

78 C4H341 © SAP SE
Searching

Fulltext Search

As people search something using


any keywords in search box S
component, the results are coming BRANDS ¥ DIGITAL CAMERAS © FILM CAMERAS CAMCORDERS WEBCAMS ACCESSORIES¥
from Solr.

stores Sort by Relevance ~ =

Chiba (51)

Choshi (43)
Fukuoka Best Western
Fukuoka Nakasu Inn (48)
Fukuoka Canal City
Fukuoks Washington
Hotel (47)
Fukuoka Milton Fukuoka
Sea Havek (45)
Fukuoka Hotel Monterey
La Soeur Fukuoka (42)

— ; - cyberfshoelss cyberfsnoe eo, Pink


$0549.99 (8) wean went
$50-$199.99 (31) $202.00 $260.87 $322.94

tania
INTERNAL SAP ane Partners Only 24

© SAP SE C4H341 79
Configurable Search Box Component

Website SmartEdit

SearchBox Component Edror

Content Basic nto Visibility


Free text
cameras Naree*
search box
camera
Cisplay Product Images

~~
camcorders
BRANDS DIGITAL CAMERAS ~ FAM CAMERAS CAMCORDERS WEBCAMS ACCESSORIES ©
i
camileo btapiy Produc
@
camcordertape
Display Suggestions
| Mini T-Cam @
$34.53 ‘Max Products

DC Car Battery Adapter


$179.53 Max Suggestions
ACC-TCHS
4 3102.63
ACC-BBVS
P—$—~_| Min Characters Before Request

1! $165.97
As-you-type lait Time Before Request
ACK-EZ results
7 sort

INTERNAL SAP and Partners Only

Search API

» FacetSearchService is the service by which we interact with the underlying Solr, it provides the
following functionalities:
— Creating Search Queries
— Populating Search Queries
— Executing SearchQuery
— Using Search Result

» Search result will be encapsulated into SearchResultValueData

» Use FacetSearchListener interface to intercept and notify user about search process

INTERNAL SAP and Parners Only

80 C4H341 © SAP SE
Search APIs for Customization - FacetSearchListener

You will need to go through the following 3 steps to implement a new FacetSearchListener:

1. Implement the interface


import de.hybris.platform.solrfacetsearch.search.context.FacetSearchListener;
public class DemoSearchListenerClass implements FacetSearchListener {
@Override
public void beforeSearch(FacetSearchContext facetSearchContext) {
facetSearchContext. getSearchQuery().addFilterRawQuery (”DemoQuery") ;

//further method implementations


}

2. Declare the custom implementation as a new listener bean in <yourExtension>- spring. xml

<bean id=”DemoSearchListener" class="DemoSearchListenerClass" />

3. Register the new listener bean to the Search Engine in <yourExtension>-spring.


xml
<bean id=”DemoSearchListenerDefinition” parent="solrListenerDefinition">
<property name="listener" ref="DemoSearchListener” />
</bean>
INTERNAL SAP-and Partners Only a7

Customizing the Search Result Populator

» Implement interface to customize search result populator:

import de.hybris.platform.commerceservices.search.resultdata.SearchResultValueData;
import de.hybris.platform.commercefacades.product.data.ProductData;

public class CustomSearchResultPopulator implements Populator<SearchResultValueData,


ProductData> {

@Override
public void populate(SearchResultValueData source, ProductData target)
{

// Get property values using getValues()


. = source.getValues().get("propertyName" )

// Get classification attributes using getFeatureValues()


. = source.getFeatureValues().get("attributeName" )

INTERNAL SAP and Partnors Only 28

© SAP SE C4H341 81
Adaptive Search - Overview

Adaptive Search: Features


SARA Adaptive Search ~

Navigation Context z Search profile context:

Index Configuration in
. . : z Search in category: Global
A dedicated Backoffice view. cacti ec
Q
Index Type
Change the order in which search items electronicsProductType y
or facets are displayed. Catalog Version Alia: > “Sistem eine
Electronics
Product Catalog:On ~

= Boost/promote or exclude products. Search Profile Cyber-shot W890, Pink

= Promote, reorder, or remove facet $322.94


values. < wees) OSC-T20 Cyber-shot Silver
Categories a 1.00 mated OSC-T20S 8.1Mpix LCD USB

« Personalization Support: Search S clabat sents


configuration can
.
be tailored to a target secon 1.00
4 Connecting
cable VMC-MD1
group for specific users. > Brands -iaseee
> Color HDR-XR105E
HDR-XRLOSE
- 120 x, 10 x, 2.36MP
“ rom $610.88

INTERNAL SAP and Parners Only 30

82 C4H341 © SAP SE
Where Do We Start? - Search Profiles

= A Search Profile contains Search Configurations.


= Itis catalog aware, which supports testing before being synchronized to production.
= Each Search Configuration can combine multiple Item Configurations:
- Facet Configuration, Facet Value Configuration
- Boost Item Configuration, Boost Rule Configuration
- Sort Configuration
- Grouping Configuration

= Two Search Profiles types OOTB:


- Simple Search Profile
For defining configurations that are category-independent.
No matter which category you select, the facet/boost configuration takes effect.
- Category-Aware Search Profile
For defining configurations within the context of selected categories.
E.g. you can set different facet/boost settings for different categories.

INTERNAL SAP and Parners Only 3

Creating Search Profiles — 2 Options


1. Adaptive Search Cockpit (preferred) 2. Administration Cockpit
= Ey Administration Cockpit ~

— ISAR4 Adaptive Search ~


Piter tee (Alt+Down for options) Search Profiles

Navigation Context a Search profile context: Search and Navigation


Search Provider
Index Configuration Configurations
Search in category: Global index Contiqueations
Electronics Solr index .
Index Type
index Types Catepory Aare Search Profile
electronicsProductType ~ Language Currency Synonym Dictionaries
English fen} ¥ — Japanese Yen [JPY] -
Catalog Version
Electronics Product Catalog: Staged =~

Search Profile 1 s9 > 179 result(s) found


Page size Sort by
20 ~ Relevance
|
I
|
I
|
I DSC-H20 Red
I DSC-H20, Red, 10.1 Megapixels, 10x Optical Zoom, 3.0°" LCD
| Search Provite ¥47,570
|
| Category Aware Search Profile EOS450D + 18-55 IS Kit
I
| EOS450D + 18-55 IS Kit - 12.2 MP, 4272 = 2848, 3:2 CMOS, 3°* TFT,
| Simple Search Profile USB20
| ¥48,970
i}

INTERNAL SAP and Parners Only 32

© SAP SE C4H341 83
Adaptive Search - Configuration

Managing Search Profiles (in the Adaptive Search Cockpit)

The Adaptive Search Cockpit allows you to manage simple and category-aware Search Profiles:

" Manage facets and facet values " Manage sorting related criteria
= Promote or exclude individual items « Group products according to selected property
" Define attribute-related boost rules to adjust values
the boost score of multiple items

= Eoy Adaptive Search : & 9 8

Navigation Context a Search profile context: Bcost_in Stock- Simple Global @ cof o Retresh

Categories Search
in category: Giobal ! Open Catalogue
/ Binoculars a ee em aw
Language Currency —
© Globe ®1 a English fen ~ JapaneseYen ey)
Boost Rules z
y Open Cotsiogue a
Page sew Sortby
VRE £052 2resutfs toon a Ss panes s
Data stomwen
Flash Memory
> Camara |(==200 Listed
sass a ee oe
Binoculars \-} ¥29,600
cca Binocular 1S 10X30
>: Color es Pv Thank otek uve corpas ond eho Geigy. tee re the mont path noc to beret here _ basa Kens 2
¥35,730

INTERNAL SAP and Partners Only 36

84
Facets Boosts Sorts Group

Facet Management —_
Facets a

In the Facets tab you can: Add tacets?


After inherited 4
« Create new facets
. 1 Fromated@ ~
» Promote facets, so they appear first >
[ ™He Grete new tem
« Exclude facets La.
H Defaue G
——— — }
a . . + . ! *,
= Extend or exclude configurations inherited from parent categories | > ares aca
> "DD Price 2000 ae
>) Resolution ODD ee
Create New Facet x 37> Nountng 4000 s==

ooitin si | 2°) meget sou |


270) Lens type ito |
ae
Index Proparty:* >) cater 1000 see
umber OrReviews = >) Brand 10) oe
manigan >) [eategseypathy 10D ase

[antsetect on =] 90) Customer coupon im


{ >") category 100! sae |

l > was
wt co | ed
r _ i}
Excluded © \
1 Create newer
INTERNAL SAP and Partnors Only 7

Promoting or Excluding Products osc-150 8 =


* fregapbalsand 720p HOand mene
IRENLCD touchscreen Optcalecardeg ike 2.0
Staa/Shot c= Facets) Boosts Sorts Group
¥46,120

Boosts tab allows promoting or excluding Boost Rules a


Flagship tripod with remote control and
products from search results kK pan handle :
200 Fiagship vipod with remote contr and pan handle “ Add boost rules’
— Gesigned
tor prot
¥49,440 Liar dane =
. toe . EasyShare ZD710 Boost rules
This can also be done by clicking in the three 200 We EasyShare
20730, 7.1 MP, 10x optical zoom acca os! Gi
dots to the right of a specific product — ——
Alpha 200
fachex
(© SL)LR) carrera.
cara, Standard
Standard Zaom Lens Ktke (0 (OT
a) SS wa ;
Any products can be promoted or excluded Siwense cmap As boost herns*
R.ES: g After inherited -

GR-8OTP Extension Battery Grip/Tripod DD 1


. : 200 K GR-BOTP Extension Battery Grip/Tripod oe | Promoted @ 1
Order of promoted products is configurable “ne sper psc-7H0|:952683]-Fleci. ave |
using Drag-and-Drop DSLR-A350
+ 18-70mm | See |
24.2 megane Dighal singe LeneReoer tote) 1 4
Zoom
ere ti (BT 38-Fomre y !
jKisation from wide angle to medium telephota in eae nae I
. . . . 2 compact. easy-to-carry Kil Back camera body i |
Extend or exclude configurations inherited from ¥55,020 i |
parent categories DSLR-A350 + 18-70mm +55-200mm
14.2 megapuel Dighal Single Lens Reflex (DSLR)

a) 138
singunded on Gtiotinmrassgmd
Telophote Zoom SS 200mm F458). Superb optical
|=| |!
quality from wide angie to telephoto covers wide ! Promote |!
range of shooting situations, Black camera body I !
¥158,980 | eciude | |
INTERNAL SAPandPariersOny = TT DT a 38

© SAP SE C4H341 85
oS 1
| Create New Boost Rule | x
1

Managing Boost Rules : seni

fi Refresh — a Index Property:*

| you can create/edit/remove pecavetue


re Hie ! Boost Rules
| Operator:*

Boost Rules a
iee oe
1 = -
|
sas boos ee” | You can extend or sue"
mea Pp i ¥
| exclude boost rule
4 . . .
| =
| configurations inherited |
Boost rules from parent categories | dissecans
InStockFlag= te 520. ser poms =
1
f Multiplicative
| new item
++ Create
! ——— =| Boost"@

Boost Items a =
Adda boost items”
Back
After inherited Pa

Sa I oO a en aL : Saat a 4
Domed D | Each Boost Rule can increase the boosting value (aka. sorting weight) of multiple items |
+ Create
new iter | |
| Boost value is either Additive or Multiplicative }
Exciuded @ |
|
oy ere | Item order affected by each boost rule depends on the value of the selected Index Property. !

INTERNAL SAP and Partners Only 39

Managing Sort Configuration

In the Sorts tab, you can:


. . Sorts a
« Create, Promote or Exclude Sort configuration us

» Extend or exclude the sort configuration from parent categories Add sorts*
After inherited ¥

I promed® |
Sort configuration defines Create New Sor x LA Create new item
: hone : te - J
sorting criteria that will be Essential 2 Promoted nems a =
available for customers in =, , Default © !
" }
Category and Search Result pti Relevance 100 + |
pages Wanufacturerhiame ©) Top Rated 100 e+e
1

Name: © \deent “() Name (ascending) 100 «+


1 .
Manwtacturer Name “(© Name (descending) 100 «+
1

lor Price (lowest first) 100 + |


1
ba “© Price (highest first) 100 eee

Sort Expressions: f + Create new item

> Create
Sort Expression I TTT Ta —s
Excluded @ f

f~] so _-! ||
1

Nest Cancel Create new item


INTERNAL SAP and Parners Only io

86 C4H341 © SAP SE
Grouping Products

In the Group tab, you can:


& Refresh
« Group products according to a selected property to make them appear in
Facets Boosts Sorts Group
search results as one product group
» E.g. variant products.
Group

»
« Group even unrelated products, as long as the selected attribute value
matches Group*

Inherit ¥.
« Keep or replace inherited group configurations
Group Expression

Group Expression defines the selected property (not a TEXT property):


Items that share the same value for that property will be grouped. Group Limit

Group Limit specifies the maximum number of the products in a group.

INTERNAL SAP and Parners Only 41

Activating a Search Profile (in the Administration Cockpit)


System > Search and Navigation > Search Profile Activation Sets
» Search Profiles need to be activated via:
= SARA Administration Cockpit +
a Search Profile Activation Set
Search Profile Activation Sets pet sewer
(except for Personalization, see next chapter)
+l Bg ®
note Type o Catron Version
Product Catalog | Online
« Activation Sets and Search Profiles are
Catalog aware items:
They need to be synchronized
Muntirweaded Syncworizaticn
Retention Rule foe

Electronics Product Catalog

Search Protie Acthaton Sets

INTERNAL SAP and Parners Only 42

© SAP SE C4H341 87
Search Configuration - Additional Topic - Context Merging
Search Profile Activation Sets

electronicsProductType - Electronics Product Catalog : Online


More than one search profile (simple or category
~
aware) may be relevant in a given context, defined 1 vy

by: Configuration Administration

1. an activation set
2. one or more active target groups (used for Essential
personalization)
Index Type* Catalog Version

Electronics Product Catalog : Online


If more than one search profile is relevant, they
must be merged to determine the effect they will
have on search results Details

" Merge mode: decide how to inherit parent Search Profiles


configurations
CameraLensesSearchProfile - Category Aw.
" Merge order: decide which search profile will have CamerasSearchProfile - Category Aware S.
higher priority CanonSearchProfile - Category Aware Sear.

INTERNAL SAP and Parners Only 43.

Search Configuration Merging Modes — Facets and Boosts

Facets
Before inherited facets promoted in the current configuration appear above facets promoted by parent configurations
After inherited the promoted facets appear below inherited prioritized facets
Remove inherited the facet prioritization of parent configurations is ignored

Boost items
Before inherited items prioritized in the current configuration appear above items boosted by parent configurations
After inherited the prioritized items appear after inherited boosted items
Remove inherited only the items identified by the current configuration are boosted

Boost rules
Keep inherited current rules are added to the rules inherited by parent configurations
Remove inherited only the boost rules in the current configuration are used to promote returned search items

INTERNAL SAP and Parners Only

88 C4H341 © SAP SE
Search Configuration Merging Modes — Sorts and Groups

Sorts
Before inherited items prioritized in the current configuration appear above items boosted by parent configurations
After inherited the prioritized items appear after inherited boosted items
Remove inherited only the items identified by the current configuration are boosted

Groups
Inherit item groups defined in parent configurations will be inherited
Replace item groups defined in parent configurations will be replaced

INTERNAL SAP and Parners Only 45

Merging Categories within a Search Profile

= For category-aware profiles, the first stage is the internal merging of the profiles following the PCM
hierarchy. Each profile may include facet prioritization, item boosting, and boost rules
« For each category, the profile specifies the merge mode used to combine it with the configurations it is inheriting
« Boosted items appear only if present in the category being searched (or in one of its sub-categories)

Merging Direction
Categories

Global
configuration
Merged
configuration
Open Catalogue Merged Result:
pa bea soreee configuration configuration * Facet prioritization}
Cameras Boosted Items
Film cameras configuration Boost Rules
; Digital Cameras Sorts
e configuration Groups

INTERNAL SAPané Pastors On 46

© SAP SE C4H341 89
Merge Logic - Activation Set
electronicsProductType - Electronics Product Catalog : Staged
category-aware search profile
.

Facet prioritization CONFIGURATION ADMINISTRATION


SS merge —
Boosted Items ~ hierarchically aa
Boost Rules
Sorts index Type

Groups

category-aware search profile

5
merge i]
hierarchically 1 Holiduys€iectronics
- Category Aware Seacch Profile i]
!
|, Generaletectronics -Catepory Aware Search Priile 1
Simpletlectrorics - Simple Search Prafte |
a i]

simple search profile

L--- 1. If any category aware profiles are present, their


category configurations are first merged internally
* merge happens according to each category's
Ma merge mode
Facet prioritization |r . .
“Boosteditems | 0 2. Search profiles are then merged following the
Boost Rules activation list order
Sorts * merge happens according to the merge mode
Groups defined for the Global category.
INTERNAL SAP and Parners Only 47

Demo

tmencee

90 C4H341 © SAP SE
Enhanced Search Experience with
Personalization

Search Profile — Activation Revisit — .

In addition to activating a search profile in an wee eee aa 7


activation set (cf. 1), this can also be done with an a
active variation/target group in commerce weenie ; os =]
customization (cf. 2). vere ° sooes =

(2) variation

customization

BlackFriday2023 variation

(for example: search configuration commerce customization


ElectronicsProductType)
Facet & Boost
index Type Configuration

promotion
Activation Set | ;
search configuration
Facet & Boost
Configuration

Note: Avoid activation of a Search Profiles both ways at the same time (Activation Set and Variation)

© SAP SE C4H341 91
Activate Search Profile for a specific Target Group
Manage Customization Library

SPA Electronics Content Catalog - Staged | Customizations (1) Search Customizatian Q All Statuses V Create New Customization

Customization Target Components Status Start End


Groups

vy BlackFriday2023 Enabled

LI GG)
Joung_Men 0 Enabled

Mature_Men 0 Enabled

Edit
|
| After creating and configuring a Search Profile:
Disable
1) In SmartEdit, select a Target Group, and [———__,
Commerce Customization
I
click on Commerce Customization i
i]

Remove

INTERNAL SAP af SARS ONY 52

Activate Search Profile for a specific Target Group

Commerce Customization x

BlackFriday2023 (Enabled) > Mature_Men (Enabled)

]
(9)
] Pick “Search” as Commerce Commerce Customization Action

| Customization Action —_—_> Search Vv

]
] (rather than “Promotion”) |
Search profile
Select search profile

Manage and Prioritize Search Profiles®

electronicsSimpleSearchProfile

Selected Commerce Customizations


| 3) Select the Search Profile !
configured in the Adaptive Search - electronicsSimpleSearchProfile *

| Search perspective
| save | Cancel

INTERNAL SAP and Parners Only 53

92 C4H341 © SAP SE
Activate Search Profile for a specific Target Group

Manage Customization Library x

SPA Electronics Content Catalog - Staged | Customizations (1) Search Customizatio Q All Statuses Vv Create New Customization

Customization Target | Components Status Start End


Groups

vy BlackFriday2023 2 Enabled

Joung_Men i0) Enabled

Ome ie) Enabled

Sa e iconshows that a Commerce Customizationwas created _|


INTERNAL SAP and Partnors Only 54

Demo

© SAP SE C4H341 93
Key Points

1. Search and Navigation Module is based on Solr, providing faster searching capability.

2. The process of populating Solr with data is called indexing.

3. The indexing process includes three steps: Extract from DB, Transform, and Load into Solr.

4. To customize search results, various Search APIs are provided (SearchService, listeners, populators, etc.) .

5. Adaptive Search module enables direct and intuitive configuration of search functionalities.

6. You can configure facets, promote items, define boost rules, manage sort configurations and group products in a
search profile.

7. Search Profiles can be activated either via an search profile activation set or for a specific Target Group (via commerce
customization).

8. Multiple search profiles can be active at the same time according to the context merging logic.

Custom value resolver for indexing is covered in the Live Session ‘Search and Navigation - Value Resolver’. Details cf. “SAP
Commerce Cloud — Additional Technical Essentials”

INTERNAL SAP and Partnors Only 57

Search and Navigation Exercise

94 C4H341 © SAP SE
SAP Customer Experience

Thank you.

©2023 SAP SE or an SAP affiliate company. All rights reserved. Soe Legal Notice on wa". sap comilegal-notice for use terms, disclaimers, disclosures, of restrictions relate’ to SAP Materials for genoral audiences

SAP Customer Experience

Promotions & Coupons

INTERNAL — SAP and Partners Only

© SAP SE C4H341 95
What we will cover in this topic

qt Methodology

Beit Firolutes Pricin: ae Payment Oieeer Personalization Sechen elie


Modeling Modeling 9 Promotions y! Management Navigation

-{ Web Layer = rt Service Layer L -t Background Task = impex Flexible Building

Pr Search Framework
WCMS Facade Cronjobs

en P Installation
Validation Security Confi ti
occ Service Riles
Engine

Event Cache Update and
. System Initialization
Backoffice occ Workflows

Scripting

INTERNAL SAP and Partners Only 2

We will learn about:

>» Promotions & Rule Engine

>» Promotions —A Business Users’ View

>» Promotions —A Technical Users’ View

> Coupons

> Special OOTB Features

INTERNAL SAP and Partners Only 3

96 C4H341 © SAP SE
The Context

oO The Promotion Engine supports a wide range of storefront


promotions. Create and update these promotions by
combining conditions and actions in a drag-and-drop user
interface. Publish promotions individually or combine them
into campaigns.

INTERNAL SAP and Parners Only

Preparation

Complete step P1 of the Promotion and


2550

coupons exercise
oo
Or

(The setup ant target will compile your system during


the lecture)

INTERNAL SAP and Parners Only

© SAP SE C4H341 97
Promotions & Rule Engine

The New Promotions Module

Promotions <0} Rule Engine af


The rule-driven promotion engine that A powerful business rule engine that can
facilitates marketers’ efforts to create and simplify complex decision-making logic into
manage layers of dynamic promotion rules, user-defined rules with ready-to-use
as well as effectively controlling their commerce business objects such as
behavior products, carts, customers, etc.

INTERNAL SAP and Partnors Only 8

98 C4H341 © SAP SE
Feature Highlights

Out-of-the-box Extensibility

Large set of OOTB promotion Build highly customized


rules and templates covering promotion rules by
B2C and B2B promotions a introducing new Conditions &
Actions to the Rule Builder
Full control over layers of
promotions and their Integrate with external
combinations using Priority, systems and use their data
Rule Groups options in rule-based promotions
Generic Rule engine with the Use standard or implement
Rule builder Backoffice tool custom discount strategies
providing a standard set of for cart items
Conditons & Actions
Build custom rule engine
modules for your business
needs
INTERNAL SAP and Parners Only 9

Why use a Rule Engine?

DECLARATIVE )
Rule engines allow you to say "What to do,” rather than "How to do it"
PROGRAMMING

TOOLING AND ) Rules are human-readable and can be translated into data objects, which
READABILITY facilitates building business tooling on top of rules

UNDERSTANDABLE BY ) Rules are understandable to nontechnical domain experts, since


BUSINESS USERS they are expressed in their language

SEPARATION OF CODE ) The logic is much easier to maintain as it is expressed in readable rules
AND BUSINESS LOGIC vs. machine code

SPEED AND Rule engine builds a knowledge base of facts in memory which is
SCALABILITY processed much more efficiently when compared to database access

INTERNAL SAP and Partnors Only 10

© SAP SE C4H341 99
Promotions — A Business Users’ View

Interaction diagram - Bird’s View

Promotion Engine Promotion Rules ‘ i Strategies


Promotion rules

+ BuyX get Y Free ! > ey <_ ala


+ Free shipping above $x

Rule Engine f Rule Builder ‘ vo Rule Processor

Rulesfemplates nn oy

Gt), comple. —> Fs

Y Vv
_— a
Commerce (JSON) (Drools)

INTERNAL SAP and Partners Only 12

100 C4H341 © SAP SE


Rule Aware Object (RAO) — Rule Builder

~ Has Total >= $X

— L Contains product(s) in category C

PRODUCT CATEGORY Contains product(s) with quantity N

— Qe
@ ae SHIPPING CUSTOMER CART

Add discount on cart total

| | Change shipping method

TT —— Sk Give Product X for free

WEBSITE CUSTOM Add discount on line item

INTERNAL SAP and Partnors Only 13

Promotion Rule

If Cart total exceeds $100 and


customer is part of VIP Group,
then give 10% discount

CONDITION Cart total >= $100

& no .
==> ACTION vant ot
Apply 10% discount on

CONDITION Customer is in VIP Group

INTERNAL SAP and Parners Only 14

© SAP SE C4H341 101


Some Out-of-the-box promotion templates

SS Product bundle fixed price Order threshold fixed discount on cart

« Buy X, get Y free « Order threshold fixed price on product(s)

« Product fixed discount « Order threshold free gift


« Product multi-buy fixed price « Order threshold percentage discount on cart

« Product perfect partner percentage discount « Order threshold percentage discount on products

= Coupon code fixed discount = Customer-specific fixed price discount with order
threshold
«= Coupon code free gift with order threshold

«= Coupon order threshold percentage discount * Customer-specific percentage discount

INTERNAL SAP and Partnors Only 15

Creating a Promotion

Backoffice offers two ways of creating promotions:

1. Create a promotion out of a promotion template

2. Create a promotion from scratch 1 Marketing ¥ [+i~] =| a | Ht |


Onder Statistics > Code
coupon_code_fixed_discount
Product References
coupen_code_free_gift_order_thresheld_main
Product reviews
coupen_code_free_gift_order_thresheld_potential_O01

Promotion Website Groups: coupon_code_percentage_discount_on_products_main

coupon_code_percentage_discount_on_products_potential_0...

€38_percentage_discount_on_products

dragonboatcouponbasedpramotion
Promotion Modules
midautumncouporbasedpromotion

Promotion Rule Groups muulti_¢odle_coupon_fixed_diseount

Coupen Management > order_threshold_fixed_discount_main

order_threshold_fixed_discount_potential_001
Promotion Planning
INTERNAL SAP and Partnors Only 16

102 C4H341 © SAP SE


Editing a Promotion’s conditions (actions) in Backoffice

Drag and Drop; then Edit

Rule Properties Conditions & Actions Administration

Target CONTAINS ANY customer groups [] or customers [] AND Coupon code from {] coupon applied

Available Conditions
> Target customers

~ Cart

x 2 eaten
» Coupon code

wa Qualifying products
7 "
Qualifying
KA fying categories
categ
Drag and Drop Conditions Here + ——
Cart total *“~-"----4 Product price threshold

Coupon code

Qualifying Group Types

Order Threshold Perfect Partner

~ Customer

INTERNAL SAP and Partnors Only 17

Promotion Messages

You can define a rule fired message for each Promotion Template or Promotion Rule.

» The message can be plain text or can contain UUIDs.

Sete eee sunt Buy over <$forderThreshold}> and get Buy over $100 and get 10%
a cart g <${percentageCartDiscount}%> discount on cart discount on cart

Rule Template Properties Conditions & Actions Administration

Info Message

Message ©
Buy over {fd76d28e-66ad-4daa-aaGe-Oe0f07a6d5e6} get {f2de1179-37b3-4646-8c2a-d4f77d5e64b5}% off on cart

INTERNAL SAP and Partnors Only 18

© SAP SE C4H341 103


Publish/Deploy Promotions

« You must publish/deploy a promotion to make it effective

» Rule Publication Queue


= Allows multiple publications at one time; uses CronJobs to publish/deploy

« Multiple Promotion Modules can exist in the same promotion engine


= Separates the preview/staging (for testing purposes) and production modules
= Sync support (e.g. from preview to production)
= Should be mapped to product catalog versions accordingly, e.g.

$catalogVersion=catalogVersion(catalog(id),
version) [unique=true]
$productCatalog=...
INSERT_UPDATE
CatalogVersionToRuleEngineContextMapping; context (name) [unique=true] ;$catalogVersion
3;promotions-context ;$productCatalog:Online
3; promotions -preview- context; $productCatalog:
Staged

INTERNAL SAP and Parners Only

Edit published/deployed promotions

« To ensure that changes to active promotions do not affect existing carts/orders, published
promotions cannot be directly modified.

» You can edit them in Backoffice, but the save action instead creates a new promotion with the
same name, but with an incremented version number.
= The newly-created promotion automatically has a status of inactive

» When you publish this new promotion, making it active, the previous version becomes inactive.

INTERNAL SAP and Parners Only 20

104 C4H341 © SAP SE


More than one promotion? — Evaluation

Evaluation Criteria
= Promotion Website Group — promotions belong to a group that can be assigned to a CMS site, determining
when the promotion is applicable.

= Promotion rule priority — determines which promotion is applied first. A numeric field, where a high number
means higher priority.
" Product-level promotions should always be set with a higher priority than order-level promotions.
x

= Promotion rule group — groups promotions together to support applying multiple promotions. f) 5
" Exclusive rule group: only the applicable promotion with the highest priority is applied =
" Non-exclusive rule group: all promotions may be applied

= Halt Rule Execution - Halt rule execution action stops Promotion Engine from applying any lower-priority
promotions to the cart.

INTERNAL SAP and Parners Only 24

Priority and Rule Groups

et ProductX $100 per unit 5 $500

oo ProductY $50 per unit 4 $50

$550

Promotion Rule Group ae Priority a Tested Discount “a

Buys yuck Silas Pp ProductX 500 $100 $450 Of

10% category discount Pp ProductX 400 $450 xX

ee oe eo /
Order tireshold 6300. oe All 300 $40 $360 4

a ar ert eae ore All 100 $20 $340 JV

INTERNAL SAP and Parners Only 22

© SAP SE C4H341 105


Evaluation unclear?

=" Backoffice Administration Cockpit FIRED ORDER ENTRY LEVEL PROMOTIONS

shows Promotion Engine Results tab ‘Adjusted Base Adjusted Total


Quantity unit Product Base Price Total Price > orice
in editor area
- 35 Piece 1776948 100.0 500.00 80,000 400.0
= Marketing > Order Statistics > Carts Applied promotions

[edit/view specific cart] Order Code Name


Applied Discount
Value

1 hyEducationBuy3Get!Fr: Buy X get Y free Buy products Cam#eo 100.0


= Order > Orders $10 EU get products
[edit/view specific order] Camileo S10 EU free

FIRED ORDER LEVEL PROMOTIONS a

Order tion Code Name Applied Discount Value


hy

hyEducatianBundlePromot kensBundlePromotion yeu buy this and this 50.0


together, you pay only
100
hyEducation_order.threshi Order threshold Buy over $300.00 get 10% 40.0
percentage discount on discount on cart
cart
order threshold fixed disc Get total $20 off all Buy over $200.00 get 20.9
orders over $200 $20.00 discount on cart

INTERNAL SAP and Parners Only 23

Promotions — A Technical Users’ View

106 C4H341 © SAP SE


High-level Architecture

PromotionSource Rule/ Promotions Strategy Promotion .


P&B Custom promotions
PromotionSourceRuleT & implementation for Promotion Service Engine Promotion
emplate Templates Actions Backoffice Engine

PES Custom Commerce


Rule Aware Commerce Rule Builder Commerce Rule engine modules
SourceRule/ Rule
Ss Objects with RuleEngine
SourceRuleTemplate Compiler Backoffice Rule Engine
& Actions Actions Service

Pe & Custom drools rules-


Platform Rule Engine Drools Rule based modules
DroolsRule RuleEngine
Backoffice Engine
Service

@ Data (ImpEx)

Data Model
ral
far
=
SAP Commerce Cloud mi
SN

INTERNAL SAP and Parinors Oniy 25

Promotion Rule - Data Model

Promotion Rule
If the cart total is >= $150 then give 10% discount on the cart

( -

| - Cart total >= ; Cart discount |


' Condition $150 | lic = Action an
X ‘ : : ; )}

(,---
f \ {
1 ! ' [
H "definitionId": "cart_total", H i
H "parameters": { ! Underlying t "cart_discount",
' "value": 156, t data '
H "currency": "USD", H representation '
t “operator”: "GREATER_THAN_OR_EQUAL" H in H
! ! JSON i }
1} : 1]
ro] ! H

INTERNAL SAP and Parinors Oniy 26

© SAP SE C4H341 107


Promotion Rule - ImpEx

INSERT_UPDATE PromotionSourceRule |
Last but not least, let’s also check 3; code[unique=true] snane[ lang-en] ;Condit.ions; Actions; tee
3eduDemoPromotion ;”Buy over 150% and ge 4 discount";
how a promotion is backed up as
ImpEx (which can also be used for
importing/exporting):

C] PromotionSourceRule is the item


type for a promotion rule

CT cheeron “actions” is the attribute for the


“(ft
"definitionId":
"parameters": {
"value": 18
"“cart_discount”,

[ ] collection of actions in JSON t


hI".

INTERNAL SAP and Parners Only a7

Coupons

108 C4H341 © SAP SE


Coupons in SAP Commerce

= Coupons are redeemed by


customers on the storefront to
reduce the order total value, or the
value of a product, or to get a free
gift/coupon/shipping, etc.

=» Acoupon is used as a condition in Coupon-based


:
a promotion rule, i.e. a coupon- Promotion Rule
based promotion rule.

= Combining with other conditions,


coupons become redeemable,

eg Order/Cart
Only VIP customers can use a
coupon
» Buy anything from a promoted brand,
a discount coupon can be used.
INTERNAL SAP and Parners Only 29

Coupon Types

Single-Code coupon
— Contains a single, invariable code
— Redeemable multiple times (a limit can be set)

Multi-Code coupon
— Coupon codes are generated using a coupon code generation configuration that includes:
=" Configuration name
=" Code separator
=* Coupon Part Count
= Coupon Part Length
— Each code can be used once only

INTERNAL SAP and Parners Only 30

© SAP SE C4H341 109


Generating Coupons

Once you create a new coupon item, you can generate coupon codes.
Single-code coupon

Coupon Code*@ Name @

WINTER16 Coupon code for Winter Campaign

Multi-code coupon

‘Coupon vauidry

Generated Coupon Codes

INTERN) rl 3

Accessing Multi Code Coupons

Coupon Code
»

A Multi Code Coupon g a prefix and a selected code generation configuration. Each coupon code can only be redeemed once. The coupon can la ter be used in a promotion
tule as a conditio

Coupon Prefix”@ Name@ © Coupon Code Generation Configuration” @


GIVEAWAY16 Get $10 discount on the cart using the coupon default-contiguration

Coupon Validity
»

Start Date@ End Date @ Active’@


Tue (@ False

Generated Coupon Codes

Generated Coupon Codes @


' Click here to download
12 GIVEAWAY16 2023-04-28 i 7TT1
| the generated coupon codes |

INTERNAL SAP and Parners Only 32

110 C4H341 © SAP SE


Coupon-based Promotion Rule
To create a Coupon-based
Promotion Rule:
1. Create a new promotion rule Get a memory card free using a coupon code for orders over $200 [coupon_code_free_gift_order_threshold_main/UNPUBLISHED/VO] =

2. Select Coupon code from + 4 [rwon|


us Properties Condinrm Acorn Acranitrson
available conditions list
(Coupon cede hore CHESS TALL) coupes applied AND Cart tat me (USD<20}
3. Select a qualifying coupon from
your coupon list
4. Select the action from available ot Creams Camonign [CHRISTIAAS
ota
actions list catia cme
Gt 50 cnt one rg aspen
+ | coupe cae i onal compu PROMO
TEN esis
5. Modify the action according to 28 oxen on Carer ens on yout ne parce Quaityng Group Types
your needs soe co fo rt Carig mINTERSA PINT (Grae Testers Pvant: Parma
fy any amin a mata ata $5 an ca
6. Save your changes Meroe . Seen
7. Publish your new promotion rule PR ‘

INTERNAL SAP and Partnors Only 33

Coupon Redemption

ORDER SUMMARY
Subtotal after $1,046.18
discounts:
Cart #00001002 Estimated TaD
Buy over $200.00 get $20.00 discount on cart shipping:

The order total includes tax of $49.82.

DESCRIPTION ary TOTAL ACTIONS Total: $1,046.18

You saved; $20.00


EOS 500D + 18-200mm IS

[| ronocee [ary]=
iD 2054947 1 $1,066.18 Remove =|Maveacoupon? ___
$1,066.18

Enter a coupon code and click APPLY

siully!| mm Cart #0000102


You have received 10% discount on cart using the coupon code [WINTER16]

INTERNAL SAP and Parners Only

© SAP SE C4H341 111


Special OOTB Features

Potential Promotions
Z| Order_threshoid_fhud_discount_main Get total $20 off al orders over $200 sisctroncsPromocrp [301-1
. Increases the probability of product_percentage discount 10% off on EOS 4500 electronicsPromoGrp 75 '
customers purchasing product_perfect_pariner_percentage_discount_main Buy any Samsung PL6O camera and get memory card for 25% less electronicsPromoGrp 130 | q
products or taking PENNE
SSN HIN SAAN SON (PNR RAN PSA PLAD EAN NN: eNO H q
ae | Ofder_shreshotd_fixed_ciscount_potential_001 Potential promation - Get total $20 off ail orders over $200 slectronicsPromocrp
| 0 [=~ ft
advantage of existing '
promotions The actual Promotion Rule must have a higher priority |le
. | value than this potential Promotion Rule! |
« Customers receive a ae ae ae
message advising them of
an available promotion
when they perform certain Stuns sitar, eee MAY cass
actions |Cart #00001002 I ae
I Estimated Teo
Spend another $9641 toget $20dlscountoncart | shipping:

The order total includes tax of $4.93,

DESCRIPTION ary TOTAL ACTIONS Total: $103.59

Mini T-Cam Have a coupon?

$34.53

INTERNAL SAP and Partnors Only 36

112 C4H341 © SAP SE


Promotion Planning

The Promotion Engine allows for the planning of a list of promotions to be activated at a specific
time as part of a campaign:

(Backoffice Administration Cockpit: Marketing > Promotion Planning)

« Promotion rules can be grouped into promotion plans

» These promotions can be activated or deactivated at will

« The plan can also contain CMS Campaign Restrictions that will be activated with
promotions

« This allows Promotion Plans to coordinate the activation of promotions and the modification
of components and pages on a storefront.

INTERNAL SAP and Partnors Only 37

Customer Coupon

Customer Coupon allows specific coupon codes to be created and activated only for selected customers for
marketing campaigns, or assigned ad-hoc to satisfy a business need.

Customer coupons:
» are created and managed in Backoffice =P eedues anes $
= can be activated wane eee vices nese . Wer us
H BRANDS ~ DIGITAL CAMERAS ~ FILM CAMERAS CAMCORDERS WEBCAMS ACCESSORIES ~ Greer ton,

. Saved carts
* through manual assignment by customer support sty coupons Nien
* when actively claimed by customers Siuil aaa . _—
= can be applied on the storefront directly Peswoes
HAPPYDAY. 2 happy
day customer coupon EFFECTIVE
conser Maas
Emaar:

7 Effective: censiaueneen
Jan t, 1970, 1:00:00
AM - Dec 31, 9999, 12:59:59
AM My interests
Unbound Read more Notification Preference

eee Cicrente Aasignate in ASM Netieation Find Proaucs_| ie


©) me Fatse +> Create Output Document oe, ©) Tue Fatse NIA
ia

WAPPYDAY test test RestePsap com] Just for edu commerce Dec 31, 8999 1259.59 AM 8

Name @ © s tiowced tor processing Stan Date@


a happy day customer coupon ° dan 2, 1970 1:00:00 AN a
338

© SAP SE C4H341 113


Coupon Code Give Away
Confirmation of Order: 00001009

» Customer receives a free coupon code that can


be redeemed .in the next purchase Thank
ee fe
ee ‘der!
An invoice has been sent by email, You should receive it soon.

« Define a promotion rule granting a free coupon


code if the specified conditions are met Order Number Ship To Payment
00001009 Daal a

« A free coupon is rewarded when the order is ocedon a —


purchased —_ Billing address
status Shipping Method —

« Details of free coupon are shown in Order Ponies oe pee


Confirmation details and Order Confirmation me i
emails ot a
| send sion eet coupe at chackaut S00 Encaunto a aurwardr: |

DESCRIPTION ary TOTAL

Ss") Cyber-shot W890, Pink


816323 $322.94
$322.94

INTERNAL SAP and Partnors Only 39

2DN
& s% Customizing Promotions
KS
e@

The Promotion Engine lowers implementation costs for creating highly-customized promotions

To customize promotions, you can:


" Create new Conditions
" Create new Actions

CONDITION Cart total >= $100 Chango da


& ACTION ange delivery
mode to overnight
CONDITION Customer is happy

Customized

Facts, stored in the rule context, are:


Rule fact * RAO (Rule-Aware Objects) instances
Context
» assembled by an RAOFactsExtractor
» used by a RuleConditionTranslator to evaluate conditions

Customize Actions is covered in “SAP Commerce Cloud - Additional Technical Essentials”


Live Session
INTERNAL SAP and Parners Only a

114 C4H341 © SAP SE


Customizing Promotions: Conditions
Backoffice pease Connors:

+ Cort total
parameter
°
(optional)

|
1
Rule Context |
1
|
1
| RuleConditionDefinition/
1 RuleC onditionDefinitionP
1 arameter

if £
1
1
U
—_——_ ImpEx
converter al, itemRAO | RuleCondition
TERETE A
se
RuleConditionDefinition
eq .

- jopulator rae | !
pep vot a
fo}
i
y
‘ i
RAOFactExtractor | //
a
Se” Optional
Condition

RulesEngine

INTERNAL SAP and Parners Only 42

Create a new Condition

We would like to create a promotion that triggers only if the customer is happy.

« Weill leave difficult philosophical questions to the experts, and simply determine that a
customer is happy if they belong to the HappyUsers group.

« The isHappy property will be added to the userRAO provided to the Rules Engine context
by extending the OOTB structure of converters and populators.

oe
CoA Extend/Create RAO tial

1 #,‘ Implement Populator Penske


Pp

{erp ae 3 , «
Implement Condition Translator

-f wserRantappyPopuiator | of, Make Condition Available in Backoffice

*-beans .xm1

userRAO
© istappy Happiness is to continue to desire what one possesses
Saint-Augustine (354-430 AD)

INTERNAL SAP and Parners Only 43

© SAP SE C4H341 115


essential af Extend/Create RAO
steps
<yourExtension>-beans.xml

<!-- to check whether a user is happy or not ;) -->


<bean class="de.hybris.platform. ruleengineservices.rao.UserRAO">
<property name="isHappy” type="Boolean” />
</bean>

Extend existing RAOs to contain


| User | the fields you intend to use in the

{ecm drools rule


*-beans .xm1

userRAO
@ istappy

INTERNAL SAP and Partnors Only 44

essential ef Implement Populator


steps ° 2

Write a populator that computes whether a user belongs to the group happyUsers.

public class UserRaoHappyPopulator implements Populator<UserModel, UserRAO>


{
@Override
public void populate(final UserModel source, final UserRAO target) throws ConversionException {
if (source instanceof UserModel && memberOfGroup(source, “happyUsers"))
target.setIsHappy(true) ;
}
private boolean memberofGroup(UserModel user, String groupId) {
// some smart code here ;) either using existing service or your own implementation

INTERNAL SAP and Parners Only 45

116 C4H341 © SAP SE


essential «#
steps ° 2
<yourExtension>-spring.
xml defaultCartRAOProvider

<alias name="defaultUserHappyPopulator alias="userRaoHappyPopulator” /> rulesEngineCal culationService


cartRaoConverter
<bean id="defaultUserHappyPopulator” facExtractorList
class="yourExtension.populator .UserRaoHappyPopulator” />

defaultCartRaoConverter
<bean parent="modifyPopulatorList">
<property name="list" ref="userRaoConverter” /> populators: [cartRaoPopulator]
<property name="add" ref="userRaoHappyPopulator” />
</bean> defaultCartRaoPopulator

discountConverter: ...
entryConverter: ...
userRaoConverter userConverter: userRaoConverter-
paymentModeConverter: ...
| UserRaoPopulator
userRaoConverter
\_@ userRacHappyPopulator
populators: [userRaoPopulator,
Configure the populator userRaoHappyPopulator]
*-beans .xm1 in Spring, and add it to
the converter userRaoPopulator
userRAO
@) istappy userRaoHappyPopulator

Tests HappyUsers
INTERNAL SAP and Parners Only group membership 46

essential Ȣ Implement Condition Translator


steps ° 3

public class RuleUserHappyTranslator implements RuleConditionTranslator


{
@Override
public RuleIrCondition translate(final RuleCompilerContext context,
final RuleConditionData condition,
final RuleConditionDefinitionData conditionDefinition)
{
final String userRaoVariable = context.generateVariable(UserRAO.
class);

// to check if userRaoVariable.isHappy is Boolean.TRUE


final RuleIrAttributeCondition isUserHappyCondition = new RuleIrAttributeCondition();
isUserHappyCondition. setVariable(userRaoVariable) ;
isUserHappyCondition. setAttribute("isHappy");
isUserHappyCondition. setOperator (RuleIrAttributeOperator.IN);
isUserHappyCondition. setValue (Collections. singletonList (Boolean. TRUE));

return isUserHappyCondition;
}

INTERNAL SAP and Parners Only 47

© SAP SE C4H341 117


essential hd
steps ‘ 3

<yourExtension>-spring. xml

<bean id="ruleUserHappyTranslator” class="yourExtension.definitions. conditions. RuleUserHappyTranslator"™>

UserRAO ruleUserHappyTranslator

| UserRaoPopulator

\_@ userRacHappyPopulator

*-beans .xm1

userRAO
@) istappy

INTERNAL SAP and Parners Only 48.

essential s $ Translator - Combining multiple conditions --~._


steps ~ |
public class RuleUserHappyNotAnonTranslator implements RuleConditionTranslator \
checking that |
@Override “A. user is both I
public RuleIrCondition translate(final RuleCompilerContext context,
final RuleConditionData condition,
not anonymous |
final RuleConditionDefinitionData conditionDefinition) and |
final String userRaoVariable = context.generateVariable(UserRAO.class) ;
happy
i}
final RuleIrAttributeCondition irExcludedCustomersCondition = new RuleLrAttributeCondition();
irExcludedCustomersCondition.setvar iable(userRaoVariable) ;
irExcludedCustomersCondition.setAttribute("id");
irExcludedCustomersCondition.setOperator (RuleLrAttributeOperator .NOT_IN);
irExcludedCustomersCondition.setValue(Collections.singletonList{ANONYMOUS_USER));

// This is another way of building the condition ;)


final RuleIrAttributeCondition isUserHappyCondition =
RuleLrAttr ibuteConditionBuilder .newAttributeConditionFor(userRaoVariable)
-withAttribute("isHappy")
.withOperator(RulelrAttributeOperator .IN)
-withValue(Collections.singletonList (Boolean. TRUE) ).build{);

final List<RuleIrcondition> irConditions = new ArrayList<>();


irConditions.add(irExcludedCustomer sCondition) ;
irConditions.add{isUserHappyCondition) ;

final RuleIrGroupCondition irCombinedCondition = new RuleIrGroupCondition({);


irCombinedCondition. setOperator(RuleIrGroupOperator .AND) ;
irCombinedCondition. setChildren{irConditions) ;
return irCombinedCondition;

INTERNAL SAP and Partners Only 49

118 C4H341 © SAP SE


esse ntial of, Translator - Accessing Condition Parameters
steps
public class RuleUserHappyParamTranslator implements RuleConditionTranslator

@Override
public RuleIrCondition translate(final RuleCompilercontext context,
final RuleConditionData condition,
final RuleConditionDefinitionData conditionDefinition)

final String userRaoVariable = context.generateVariable(UserRAO.


class);

final Map conditionParameters = condition.getParameters();


final RuleParameterData valueParameter = (RuleParameterData) conditionParameters.get("customerIsHappyParameterID");

// Use rule author's radio button selection to check against; by default, check that happy property is true
final Boolean isHappy = (valueParameter != null &&
valueParameter.getValue() != null) ? (Boolean) valueParameter.getValue() : new
Boolean. TRUE;

final RuleIrAttributeCondition isUserHappyCondition =


RuleIrAttributeConditionBuilder. newAttributeConditionFor (userRaoVariable)
-withAttribute("isHappy")
.withOperator(RuleIrAttributeOperator.
IN)
.withValue(Collections.singletonList(isHappy)).build();

return isUserHappyCondition;

INTERNAL SAP and Parners Only 50

essential of Translator - Accessing Condition Parameters


steps
Backoffice ‘Restaton Comttioen
cnt
* Cart total ‘meme:
parameter ; ; , cnmpajnis
(optional) otra ctegees
Predict price threstodd
Qusttyne Grouse yore

RuleConditionDefinition
Parameter

| User | userRaoConverter UserRAO ruleUserHappy Translator

| UserRaoPopulator

L@ userRacHappyPopulator

<yourExtension>-spring. xml

| <bean id="ruleUserHappyParamTranslator" class="yourExtension.


definitions .conditions .RuleUserHappyParamTrans lator" >

INTERNAL SAP and Parners Only 1

© SAP SE C4H341 119


esse ntial of Make Condition Available in Backoffice
steps
Backoffice

= is Customer Happy? Available Condit.


parameter + Customer
{optional)
p----------} +— rue
@ Fas
Is Customer Happy?

RuleConditionDefinition
Parameter

I
Impex
Joe | RuleCondition

L4 UserRacPopulator

\@ userRacHappyPopulator

INTERNAL SAP and Partnors Only 52

ESse ntial of Make Condition Available in Backoffice


steps
$lang = en

INSERT_UPDATE RuleConditionDefinition; id[unique=true];name[lang=$lang]; priority; breadcrumb[ lang=$lang] ;


allowsChildren;translatorId;categories(id)
5;customer_isHappy;Customer is Happy;5000;Customer is deemed Happy;false;ruleUserHappyTranslator;
customer
3is_customer_Happy;Is Customer Happy?;5000;Customer Happiness is {customerIsHappyParameterID};
false; ruleUserHappyParamTranslator;
customer

INSERT_UPDATE RuleConditionDefinitionParameter ;definition(id) [unique=true] ;id[unique=true];


type
3is_customer_Happy; customerIsHappyParameter ID; java. lang.Boolean

INSERT_UPDATE RuleConditionDefinitionRuleTypeMapping
;definition(id) [unique=true]; ruleType(code)[unique=true ]
, scustomer_isHappy ;PromotionSourceRule
fa 5is_customer_Happy;PromotionSourceRule ---~~ s
\ \
N \
x — ustomer Happiness is false
Custe .. 1 Happy ~~ ~.
Available Condit...
Available Conditi. © Is Customer Happy? bad
Customer is Happy x cust
+ Customer
Customer )
— , true @ Fase Customers Happy
‘Customer is Happy [ |
Drag and Drop Conditions Here fetta | J I ls Customectsppyt |

INTERNAL SAP and Partners Only 53

120 C4H341 © SAP SE


That’s not all!

For more information on extending the promotion engine with your own custom RAOs, condition,
actions, and rules, try the Promotion Engine Trail:

https://help.sap.com/docs/SAP_COMMERCE_CLOUD_PUBLIC_CLOUD/e1391e5265574bfbb56
ca4c0573ba1dc/39b59b51¢c229400099d8ee0d0a7 9cdf5.html?q=Promotion%20Engine%20Trail

References

» Rule Engine

https://help.sap.com/docs/SAP_COMMERCE_CLOUD_PUBLIC_CLOUD/e1391e5265574bfbb56
ca4c0573ba1dc/e30ec2e429e84d22b9045b84c366ab76.html?q=rule%20engine

« Promotion Engine

https://help.sap.com/docs/SAP_COMMERCE_CLOUD_PUBLIC_CLOUD/e1391e5265574bfbb56
ca4c0573ba1dc/e7e7a2ef7d97405983ca0cb60e8f380a.html?q=promotion %20engine

INTERNAL SAP and Partnors Only 54

Key Points

1. The Promotion module is based on the rule engine, which provides separation between business logic
and code

2. Every promotion rule is composed of conditions and actions, using the rule builder, and compiled into
Drools rules by the rule compiler

3. You can create a promotion rule from a promotion rule template or from scratch

4, Use coupons as a condition for a promotion or receive a coupon as an outcome of it

5. Create a coupon-based promotion to make it redeemable in the composable storefront

6. If needed, you can also develop new conditions and actions

7. Creating a customized action is covered in live session “Customize Actions”

“SAP Commerce Cloud — Additional Technical Essentials”

INTERNAL SAP and Partnors Only 55

© SAP SE C4H341 121


Promotions and Coupons Exercise

SAP Customer Experience

Thank you.

122 C4H341 © SAP SE


SAP Customer Experience

Omni Commerce Connect

INTERNAL - SAP and Partners Only

What we will cover in this topic

© SAP SE C4H341 123


The Context

© The Omni Commerce Connect (OCC) module is a set of customizable


extensions providing commerce-driven RESTful web services.

INTERNAL SAP and Partnors Only 3

OCC Web Services

124 C4H341 © SAP SE


Omni Commerce Connect — RESTful Web Services
- Easy reuse of commerce processes and data across all touch points

SAP Commerce
Cloud
Composable Affiliates,
Storefront non-java,

Call RESTful Commerce API :


Emerging
Center . _ touchpoints

Commerce Business
INTERNAL. SAP ane PtsOn Services 5

Omni Commerce Connect - Key Facts

« Based on Spring MVC


= XML & JSON response representation format
» OAuth 2.0 authorization
« Conditional requests using Etags to leverage cached Commerce
Webservices
results
: Supports versioning
» The OCC API is implemented with several variants: V1
and Addon-based V2 are deprecated, and the default is
OCC v1
the OCC V2 extension, which provides stateless RESTful
implementation.

OCC v2 OCC v2
Addon Extension
Deprecation details here:
Addons-based OCC v2 on //help.sap.com
INTERNAL SAP and Partnors Only 6

© SAP SE C4H341 125


Omni Commerce Connect — Key Functionality

The OCC exposes the following key commerce functionality to API clients:
= Managing
— Product information and reviews
— Cart and Order details
— Promotions and Coupons
— Consents and consent templates
— User data
= Check available points of service and verify stock levels
= Ensure fast and optimized search
= Provide access to CMS content structures and data

API (Reference — V2)


Calls Reference on //help.sap.com

INTERNAL SAP and Parners Only

Omni Commerce Connect — Documentation and Testing


The OCC uses Swagger i

(OpenAPI Specification) to
document endpoints and enable inc EDED
: . 1 Commerce Webservices
testing functionality: pecttapiaos
https: /fi] ocalhost:9002 foce, AQ. sw “These services manage al of the common commerce tusctionallty and alec include <ustorsizations from installed AddOns. The implementing exiension is called conmervewsbsenices
. Use of this file is subject 10 the terms of your agreement with SAP SE or its affiliates respecting the use of the SAP product for which ths file relates.
aqger-ui.html AP Commerce Cou

a :
[ napactiocathost900aiocsh2
Generated soverui_~ | Autvorion

Address a
GS (rasesivera) /asera/{usert4} /addreases Get usar sitvome va
({easndsteta) /eners/ {userid} /addconsen Crus
snow cise va
(SI (to anesitora) /csers/jusertsy /nddrosses/{adaressté) Gee
htu snost assess ve

({basesiterd)/users /{usertd) /addresses/{addrenstd} Unde


tne accross ve

/{banetiters) /users/{usexTd) /addsennes/{eddeenaTd) Onetecunimers octmm ve


(ESE) ioasesicoray /esors/{userts)
/addrossen/ {adéronsta) Usdaies
ine ucase va
({baseSitold}/esers/{usertd}/addresses/verification Verifs miu ve

INTERNAL SAP and Partnors Only 8

126 C4H341 © SAP SE


Omni Commerce Connect — Architecture

filters

ey webservices
controller
URL to
REST API call OAuth2 method
resolver

validation

cache control exception SAP


COMMERCE
handling

DTO mapping

REST API XML/JSON


response conversion

INTERNAL SAP and Partnors Only 9

OAuth 2.0

Spring Configured OAuth2 token endpoint (Authorization Server)


— Exchanging authorization grant into an access token
— The oauth authorization server has been moved out of the
webservicescommons/oauthauthorizationserver extension into the platform oauth2 extension
— The authorization server exposes two endpoints:
/authorizationserver/oauth/authorize
/authorizationserver/oauth/token

OAuth 2.0 Client Configuration


— Inthe System/OAuth tab in Backoffice, you can manage OAuth 2.0 clients and access tokens.

Resource Server, Response encoding, & Client Credentials Flows

More details: OAuth 2.0 on //help.sap.com

INTERNAL SAP and Partnors Only 10

© SAP SE C4H341 127


Access Control

= Access on user resources depends on roles granted by OAuth2 using the @Secured annotation

Role Description Rights


Anon-authenticated principal is assigned a No access on users
ROLE_ANONYMOUS built-in ANONYMOUS role by default resources

Anonymous users who provided their own e- Access only its own
ROLE_GUEST ~
- mail address resources
User authenticated by using the OAuth2 token Can access only its own
ROLE_CUSTOMERGROUP :
- in the password flow resources
User authenticated by using the OAuth2 token Can access all users and
ROLE_CUSTOMERMANAGERGROUP_~.
- in the password flow their resources
Client application (e.g. mobile app): Can access only resource
ROLE_CLIENT Makes protected resource requests on behalf of owner resources
the resource owner and with its authorization
Can access all users and
ROLE_TRUSTED_CLIENT Trusted client application (e.g. Adobe CQ5)
their resources

INTERNAL SAP and Parners Only

Client Configuration and Implementation of Roles

= Create OAuth Clients using the Administration Cockpit: System | OAuth | OAuth Clients
= OAuth Client information is stored in the database using the OAuthClientDetails type, so it can
also be created via impex
= Implementation of Roles in Spring MVC Controllers

UsersController. java
@Secured(
{ "ROLE_CUSTOMERGROUP", "ROLE_TRUSTED_CLIENT", "ROLE_CUSTOMERMANAGERGROUP” })
@RequestMappingCvalue = “/{userId}", method = RequestMethod.GET)
@ResponseBody
public UserWsDTO getUser(@RequestParamCdefaultValue=DEFAULT_FIELD_SET) final String fields)
{
final CustomerData customerData = customerFacade.getCurrentCustomer();
return getDataMapper().mapCcustomerData, UserWsDTO.class, fields);
}
Security Roles allowed to access this method

INTERNAL SAP and Parners Only

128 C4H341 © SAP SE


Client-Side Caching

« Enables client-side caching for a method or a controller by annotating it with @CacheControl


Directive Description
Any cache MAY store the response, even if the response would normally be non-cacheable or
PUBLIC cacheable only within a private cache

PRIVATE The response message is intended for a single user and MUST NOT be stored by a shared cache

NO_CACHE The response MUST NOT be used to satisfy a subsequent request without successful validation
on the origin server.
NO_STORE Acache MUST NOT store any part of either the immediate request or response

MUST_ Once it has become stale, a cache MUST NOT use the response to satisfy subsequent requests
REVALIDATE — without successful validation on the origin server.

@Controller java
UsersController.
@RequestMapping(value = "/{baseSiteld}/users")
@CacheControlCdirective = CacheControlDirective. PRIVATE)
public class UsersController extends BaseCommerceController ' ;
{ Don't store method results in a
shared cache(eg. proxy servers)
}
INTERNAL SAP and Partnors Only 13

Customizing Commerce Web Services


~ yece
> BA JRE Systom Library [Jave SE 17.0.3.1 [17.0.3.1)]
> BA Referenced Libraries
v @sre
+ . > # ke stants.
= To customize Commerce Web Services, we need to extend the > AB sccpachdae corre
commercewebservices extension. —e
> (Bogensre
— Because that's where all the out-of-the-box OCC seal
. . . . . eclipsebin
functionality (e.g. OCC endpoints) is implemented. » Sresources
> @localization
~ Bocce
v v2
= Best practice: Create an OCC extension using the yocc template as
. . . . » web
— The yocc extension template is a predefined extension that - Bspring
serves as a starting point for creating a new OCC extension time ore
for Commerce Web Services. B peered
co. . . . oo 2 yocc.build.number
— This is essentially an empty extension with the minimum ®yoce-beans.xmi
+ + + % yoee-items.xm!
implementations needed to create an OCC extension. Bi iocnearingsen
®build.xmi
— How to? -> Example coming next mcr
1X extensioninto.xml
X) extensioninfo.xsd
x) external-dependencies.
xm!
) extgen.properties
© platformhome-properties
= project.properties
INTERNAL SAP and Parners Only 14

© SAP SE C4H341 129


Customizing OCC Example: yocc - trainingocc
v |ptrainingoce
How to create an OCC extension based on the yocc extension template? > @A JRE System Library [JRE [17.0.2]]
> qi Referenced Libraries
v @sre
Execute ”ant extgen” > fF de.hybris.trainingoce.constants

— choose the yocc template v fii de.hybris.trainingoce.controllers


> [J) TrainingoccController,java
— name you extension accordingly. Please note: The name of an OCC > GBtestsre
> @gensrc
Extension needs to end with “occ”, e.g. “trainingocc”, “eduocc”, etc. Blib
v sgresources
Add the extension into localextensions.xml file (as any other extension) > localization
v Boece
v @Sv2
Add any custom implementation (services, controllers, etc.) into the src v @trainingoce
folder (e.g. trainingocc/src) of the extension, instead of web/src. > Gmessages
~ @eweb
~ spring
— The binding to the occ web context will happen automatically. X) trainingoce-web-spring.xml
> Btrainingoce
Execute “ant all” to build the commerce server. > trainingoce.build.number
X) trainingoce-beans.xml
X) trainingoce-items.xml
More details cf. Creating an OCC Extension for OCC Web Services on % trainingoce-spring.xml
//nelp.sap.com © buildcallbacks.xml
x) extensioninfo.xml
x) external-dependencies.xml

INTERNAL SAP and Parners Only )| project.properties

WsDTO (Web services DTO)

=» Anew WsDTO model was introduced in OCC v2 to add stability to REST API calls by removing any
dependency to the commerce services data model

— Changes in the commerce data model no longer directly affect the REST API
— Improved flexibility by introducing a mechanism that allows control of returned fields

— Consumers can influence what the returned WsDTO will look like by requesting that specific fields be filled
in the object or by using a predefined set of fields

=" WsDTO objects are initially created to be closely similar to commerce services data objects, simplifying data
mapping, which is done automatically by the Orika bean mapper
— Created in the commercewebservices-beans.xml file as regular bean objects

— When adding a new WsDTO object, we recommend you also add a field-level mapping configuration in
Spring

INTERNAL SAP and Parners Only

130 C4H341 © SAP SE


Data Mapping

= The Data Mapping Mechanism facilitates mapping of data between the source and destination objects.
It can be used in Web Services for:

— Mapping of the data between the model objects and WsDTO objects
— Mapping of the data between the commerce layer data/DTO objects and WsDTO objects
= Core functionality is exposed by the DataMapper Java interface and its map methods
— Supports simple objects, lists, sets and generics

— Specify which fields you want to populate without a nesting limit


UsersController.
java

@Secured({ "ROLE_CUSTOMERGROUP", "ROLE_TRUSTED_CLIENT", "ROLE_CUSTOMERMANAGERGROUP” })


@RequestMappingCvalue = “/{userId}", method = RequestMethod. GET)
@ResponseBody
public UserWsDTO getUser(@RequestParamCdefaultValue=DEFAULT_FIELD_SET) final String fields)
{
final CustomerData customerData = customerFacade.getCurrentCustomer();
_return getDataMapper().mapCcustomerData, UserWsDTO.class, fields);

INTERNAL. SAPane Paras On) \ Using DataMapper#map() method

Declarative Field Mapping

= Declarative field mappings can map one field to another field with a different name.
= Use Spring XML configuration and specify simple mapping for those fields

dto-mappings-v2-spring.xml
<bean id="userFieldMapper" parent="fieldMapper">
<property name="sourceClass"
value="de.hybris.platform. commercefacades.user.data.CustomerData"/>
<property name="destClass"
value="de.hybris.platform. commercewebservicescommons.dto,.user,UserWsDTO" />
<property name="fieldMapping">
<map>
<entry /key="defaultShippingAddress" value="defaultAddress"/>
</map>
</property>
</bean>
Direct Field mappings between the Data object and WsData object

INTERNAL SAP and Partnors Only 19

© SAP SE C4H341 131


Customizing or Extending Data Mapping

= Customize or extend data mapping behavior by creating converters, mappers and filters in Java classes

— Annotate your custom converters, mappers and filters with WsDTOMapping annotation and register your
custom converters, mappers and filters in Spring XML files

= Sample Custom Mapper:


Note: Extending AbstractCustomMapper, which is already annotated and additionally has support for fields
selection mechanism.
SpecialCustomerAddressMapper . java

@WsDTOMapping
public class Special CustomerAddressMapper extends AbstractCustomMapper<CustomerData, UserWsDTO> {
@0verride
public void mapAtoBCfinal CustomerData a, final UserWsDTO b, final MappingContext context) {

ifCshouldMapCa, b, context)){
String formattedAddress = specialAddressFormatter. formatAddressCa.getAddress());
b. setAddress(formattedAddress);

}
INTERNAL SAP and Parners Only 20

Relevant OCC Extensions

Extension Description

webservicescommons Includes the web services common functionality, which can be helpful for
REST Web Services based on standard Spring MVC.

commercewebservicescommons Enables Commerce web services to be extended.

Exposes OCC. It focuses on providing Commerce as Service for various


commercewebservices ‘ ; ‘
clients, such as mobile and desktop clients.

commercewebservicestests Tests written in Groovy to test commercewebservices REST calls

Predefined extension template that serves as a starting point for creating


OCG : .
y a new extensions for Commerce Web Services.

INTERNAL SAP and Parners Only 24

132 C4H341 © SAP SE


Key Points

1. The Omni Commerce Connect (OCC) module is a set of customizable extensions providing
commerce-driven RESTful web services.

OCC leverages OAuth2 for authentication and authorization


N

It's recommended to use yocc extension template to extend existing OCC web services
YY

Data is transferred via WsDTOs (Web services DTO) to decouple from service layer models
FF

Mapping to WsDTOs is done by the Orika Bean Mapping Framework


a

INTERNAL SAP and Partnors Only 22

Omni Commerce Connect Exercise

© SAP SE C4H341 133


SAP Customer Experience

Thank you.

©2023 SAP SE or an SAP affiliate company. All rights reserved. Soe Legal Notice on wa". sap comilegal-notice for use terms, disclaimers, disclosures, of restrictions relate’ to SAP Materials for genoral audiences

SAP Customer Experience

CronJobs

INTERNAL — SAP and Partners Only

134 C4H341 © SAP SE


What we will cover in this topic

“rae EGET] oom [ain | tmene| SS


General Services}

cee SS
rs a
Cronjobs

we |
INTERNAL SAP and Parners Only

We will learn about:

> CronJobs Overview

> How to implement a CronJob

> How to start a CronJob

INTERNAL SAP and Parners Only

© SAP SE C4H341 135


CronJobs Overview

The Context

OO) The CronJob functionality allows you to schedule one-time


or recurring tasks, according to a timetable or in an ad-hoc
manner.

ERNAL SAP and Partnors Only 5

136 C4H341 © SAP SE


CronJobs - Definition

= Automated tasks

= Performed at a certain time (such as 16:05), or at fixed intervals (such as every five minutes)

= Can be used for:

— Backups

— Updating / synchronizing catalog contents

— Imports / Exports

Re-calculating prices

- etc...

INTERNAL SAP and Parners Only

CronJobs - Key Facts

Trigger
= ACronJob consists of a: date and time
— CronJob: Runtime information
4
CronJob
— Job: What to do
runtime information
— Trigger: When to run 4
ServiceLayerJob
= Allows re-using code and items
Commerce-aware wrapper
= CronJobs always run in a SessionContext
(i.e. they have a user assigned) program logic
JobPerformable<CronJobModel>
Spring bean

INTERNAL SAP and Parners Only

© SAP SE C4H341 137


How to Implement CronJob

Implement a CronJob - Job Logic

Class Constants
= Step 1 - Define the business logic
— Write a Java class implementing JobPerformable<CronJobModel> CronJobResult
or extending AbstractJobPerformable<CronJobModel > ERROR
FAILURE
SUCCESS
public class MyJob
extends AbstractJobPerformable<CronJobModel > ONS
{ CronJobStatus
public PerformResult perform(final CronJobModel cronJob) ABORTED

: // Do something... FINISHED
return new PerformResult(CronJobResult.SUCCESS, PAUISIED)
CronJobStatus.FINISHED) ; RUNNING
} RUNNINGRESTART
} UNKNOWN

INTERNAL SAP and Partnors Only 9

138 C4H341 © SAP SE


Implement a CronJob — ServiceLayerJob

= Step 2 - Register a Spring Bean

— Configure extensionName/resources/extens
tonName- spring. xml

<bean id="myJob"” class="my.commerce.MyJob" parent="abstractJobPerformable" />

= Step 3 - Create a ServiceLayerJob item

- Either run a system update (for essential data) to create a ServiceLayerJob item for each bean implementing
JobPerformable

* In our example, a ServiceLayerJob with code myJob will be created,


referencing the myJob bean

- Or you can create the ServiceLayerJob using ImpEx


ImpEx is normally preferred
INSERT_UPDATE ServicelayerJob; code[unique=true];springId because it it a lot faster!
smyJob;myJob

INTERNAL SAP and Partnors Only 10

Implement a CronJob — CronJob & Trigger

= Step 4 - Create a CronJob


— Use Backoffice, or ImpEx
INSERT_UPDATE CronJob; code[unique=true];
job(code) ;singleExecutable; sessionLanguage(isocode)
3;myCronJob;myJob; false;de

= Step 5 - Create a Trigger


— Again, using Backoffice, or ImpEx
* The cronExpression below indicated to run this job every night at midnight
(note: placing [unique=true] on both cronjob and cronExpression allows multiple triggers per
cronjob)
INSERT_UPDATE Trigger; cronjob(code) [unique=true] ;cronExpression[unique=true]
3 myCronJob; @ @ @ * * ?

* Basic format of a cron expression:


* An * in any field means trigger for every value, ? means any value (i.e., ignore). Year is optional.

sec min hour day month weekday year


@-59 @-59 @-23 ? 1-31 1-12 ? 1-7 19798-2899

INTERNAL SAP and Partnors Only 11

© SAP SE C4H341 139


Trigger - Key Facts

= If the current time fits the cron expression defined .


in a Trigger, the referenced CronJob or Job gets |
executed automatically | |
« Triggers can be related to CronJob or Job lob |
« Ifa Trigger is related to a Job directly, during | |
execution, a CronJob instance (with default related | Job |
configuration) based on that job is automatically
created and executed. Trigger directly related to Job Trigger related to CronJob

= In Addition:

* A built-in timer checks regularly if any trigger should be fired. It can be adjusted with:
cronjob.trigger.interval=30

* At startup, the system will determine whether it should fire overdue Triggers. Any Trigger overdue by
fewer seconds than the value of its maxAcceptab/eDelay attribute will be fired.

INTERNAL SAP and Partnors Only 12

How to start a CronJob

140 C4H341 © SAP SE


Start a CronJob Directly

« Override CronJob schedule with ImpEx (for example, to start it immediately)


#%beanshell% afterEach: impex.getLastImportedItem().setActivationTime(new Date());

« Or, use Backoffice (System -> Background Processes -> CronJobs)

|) b> &

Log Task Runas TimeSchedule System Recovery Administration

* Or use Ant
ant runcronjob -Dcronjob=myCronJob

« Or directly from the API


cronJobService.performCronJob( myCronJobModel ); //execute asynchrously
cronJobService.performCronJob( myCronJobModel, true ); //execute synchrously

INTERNAL SAP and Parners Only 14

Additional CronJob Features

= Email template
— notify certain user using given email template

« Enable code execution


— enable or disable script execution within ImpEx in an import CronJob.

« User, language and currency


— to empower permissions & restrictions
I

myCronJob.setSessionUser (mySessionUserMode1) ;
myCronJob.setSessionLanguage(mySessionLanguage) ;
myCronJob.setSessionCurrency(mySessionCurrency) ;
=" Node Group
— to specify server node group for job execution

* CompositeCronjob | More information cf. The Cronjob Service


— to run any number of CronJobs in sequence |

INTERNAL SAP and Partnors Only 15

© SAP SE C4H341 141


Key Points

» CronJobs can be used to schedule tasks in the background.


= ACronJob consists of:
* CronJob itself for runtime information
* ServiceLayerJob, pointing to the Spring bean instance
* Spring bean instance of a Java class implementing JobPerformable
* Trigger, optional

« A trigger is used to schedule a CronJob, but it can also be directly related to a Job.
« Furthermore, there are many ways to start a CronJob directly:
* ImpEx, Ant, CronjobService API, manually in the Backoffice

| ro) Furthermore, a CronJob can be created dynamically at runtime via scripting - covered |
' in Introduction to the Live Session Series "SAP Commerce Cloud - Additional '
! Technical Essentials” |
INTERNAL SAP and Parners Only

CronJobs Exercise

142 C4H341 © SAP SE


SAP Customer Experience

Thank you.

©2023 SAP SE or an SAP affiliate company. All rights reserved. Soe Legal Notice on wa". sap comilegal-notice for use terms, disclaimers, disclosures, of restrictions relate’ to SAP Materials for genoral audiences

SAP Customer Experience

Event System

INTERNAL — SAP and Partners Only

© SAP SE C4H341 143


What we will cover in this topic

qt Methodology Ecommerce Features

Data Product Coupons and Order Search and


Modeling Modeling [Pisin Promotions [Pear Management [Rensmelizatitsm Navigation

-{ Web Layer = rt Service Layer L -t Background Task = Flexible Building

lings Search Framework


WCMS Facade Cronjobs

en P Installation
Validation Securi "i 5
: Procaes iy Configuration
occ Service A
Engine
Event Update and
: Gartns Initialization
Backoffice occ Workflows

Scripting

INTERNAL SAP and Partnors Only 2

We will learn about:

Event System Overview


Vv

> Implementing Event Class

> Implementing Event Listeners

>» Asynchronous Events

> Transaction-Aware Events

INTERNAL SAP and Partnors Only 3

144 C4H341 © SAP SE


The Context

6, The ServiceLayer provides a framework to send and


receive events within SAP Commerce Cloud

INTERNAL SAP and Partnors Only 4

Event System Overview

© SAP SE C4H341 145


The Event System — Overview

= The SAP Commerce Cloud Event System is based on the Spring


event system

= Asoftware component acting as a source publishes an


event that is received by registered event listeners

= Upon receiving an event, listeners perform business logic


informed by the event object’s properties

= Allows sender and receiver to be decoupled


— Neither knows about the other

« Events can be published locally or across publish


cluster nodes

= Events can be configured to be transaction-aware


INTERNAL SAP and Parners Only

What is an Event?

" An Event is an instance of AbstractEvent or one of its subclasses, e.g.:

public class CustomerCreatedEvent extends AbstractEvent {


private String customerUID;
public CustomerCreatedEvent() { super(); }
public CustomerCreatedEvent(Serializable source) { super(source); }
public void setTypeCode(String customerUID) { this.customerUID = customerUID; }
public String getCustomerUID() { return customerUID; }
t

" Each event class contains:

— One or more properties expressing the event message(s) to be communicated. (e.g., the customerUID above)

— 2constructors:

* one without an argument for easy instantiation. (e.g., the CustomerCreatedEvent() constructor above)
* one with a Serializable source object, which can be passed at creation time (e.g., the
CustomerCreatedEvent(Serializable source) constructor above)
INTERNAL SAP and Parners Only

146 C4H341 © SAP SE


Implementing Event Class

Implementing A New Event Class

=» You can implement a new event class by directly extending AbstractEvent or a subclass (as shown on the
previous slide).
= More typically, you would do that using bean generation in *-beans. xml:
<bean
class="my.package.events.CustomerCreatedEvent" ty
pe="event">
* Fully qualified class Wainé is neteRSary4h tAESVeEnt bean declaration.
type="String"/>
* Add a typeszevent” attribute to the <bean> tag.
¢ Add any property/properties the event needs.
¢ An “ant all’ generates the event class. (e.g., the above bean declaration generates the following Event
Class, which is identical to the class shown in the previous slide)
public class CustomerCreatedEvent extends AbstractEvent {
private String customerUID;
public CustomerCreatedEvent() { super(); }
public CustomerCreatedEvent (Serializable source) { super(source); }
public void setTypeCode(String customerUID) { this.customerUID = customerUID; }
public String getCustomerUID() { return customerUID; }
INTERNAL SAP and Partnors Only } 9

© SAP SE C4H341 147


Extending An Existing Event Class

= Please note:

* OOTB/existing event classes in SAP Commerce Cloud are defined using the same automatic
generation mechanism using the definition in their respective extension’s <extensionName>-
beans.xml file.

e.g., in core-beans.xml
<bean class="de.hybris.platform.servicelayer.event.events.AfterSessionCreationEvent” type="event"/>

* Therefore, you can add properties to the OOTB event classes by adding new properties to the bean
definition in your custom extension’s <CustomExtensionName>-beans. xml file.

In CustomExtensionName-beans.xml

<bean class="de.hybris.platform.servicelayer.event.events.AfterSessionCreationEvent" type="event">


<property name="newProperty” type="String"></property>
</bean>

INTERNAL SAP and Parners Only

Implementing Event Listeners

148 C4H341 © SAP SE


Implementing Event Listeners

= Event listeners allow you to react to an event

= To implement an event listener:


— Extend the AbstractEventListener class
— Override the onEvent() method

public class AfterInitializationEndEventListener extends


AbstractEventListener<AfterInitializationEndEvent>
{
@Override
protected void onEvent(AfterInitializationEndEvent event)
{
getValidationService() .reloadValidationEngine();
LOG.info("Reloaded validation framework.");
t
t
INTERNAL SAP and Parners Only

Registering and using Event Listeners

= Register the event listener:


— Asa bean in the Spring application context (inherit injection configurations from “parent”
bean definition):
<bean id="myEventListener" class="my.package.MyEventListener"”
parent="abstractEventListener" />

— Or by dynamically adding listeners at runtime using eventService:


eventService.registerEventListener(new MyEventListener() );

= Publish events using the eventService:


eventService. publishEvent( myEvent )

=" To access eventService, add a Spring annotation to your class:


@Resource
EventService eventService;

INTERNAL SAP and Parners Only

© SAP SE C4H341 149


Asynchronous Events

Asynchronous events

= By default:
— Events are processed synchronously (the most data-safe option)
— Events are handled on the same node from where they're fired

= However, handling events synchronously can sometimes be undesirable for performance reasons, as the
main thread waits until events are processed

= There are two possible ways to force events to be processed asynchronously:


— by configuring the PlatformClusterEventSender Spring bean to send all non-cluster-aware events
asynchronously to the same/local server node.
— Non-cluster-aware events are events that haven't implemented ClusterAwareEvent interface.
— byimplementing the ClusterAwareEvent interface in a given event

Note: For each event implementing ClusterAwareEvent, network traffic occurs

6) ClusterAwareEvent event data must be Serializable.


For better use of bandwidth, avoid serializing complex object graphs.
INTERNAL SAP and Partnors Only 15

150 C4H341 © SAP SE


Asynchronous events - Implementing Cluster Aware Event

To make an event Cluster-Aware, have the event class implement the ClusterAwareEvent interface

— Implementing ClusterAwareEvent requires your event class to have a canPublish() method

The canPublish() callback method allows the platform to inquire whether the event should be published to nodes of
specific node groups in the running cluster or not, e.g.

@Override
public boolean canPublish(PublishEventContext publishEventContext)
{
return return publishEventContext.getTargetNodeGroups().contains("backoffice_node_group");
}
— If you want the event to be handled asynchronously (i.e., a cluster-aware event) but only on the node where the event
was fired (like a non-cluster-aware event), the following method implementation lets you have it both ways:

@Override
public boolean canPublish(PublishEventContext publishEventContext)
{
return (publishEventContext.getSourceNodeld(}
== publishEventContext. getTargetNodelId()});
weal sePane pavers

Transaction-Aware Events

Vy
les 7 ‘ |

© SAP SE C4H341 151


Transaction-Aware Events

« Events whose publishing is deferred until after the current transaction

— Publishing of an event can be made contingent on transaction success

— Multiple, "identical" events published inside a transaction can be treated as a single event

"Your event class must implement the TransactionAwareEvent interface

— Two required interface methods:

boolean publishOnCommitOnly(): If this method returns true, event will be published upon the successful
commit of the current transaction

Object getId(): Returns a programmer-determined event ID. Two event instances with the same id will be
published only once as a single event at the end of the transaction

« All persistence events (i.e. AfterltemCreationEvent and AfterltemRemovalEvent) implement both ClusterAwareEvent
and TransactionAwareEvent, because these persistence events
— are published only after the persistence operation is committed.
— should be handled asynchronously, so their handling doesn’t block the current thread.
INTERNAL SAP and Partnors Only 18

Key Points

The SAP Commerce event system is used to support event-based communication

= To use the event system, you can oO Loose coupling of event system
facilitates linking components
« Use one of the many predefined event classes, or extend one , :
from different extensions
* Define an event listener class and register it as Spring bean Easierto maintain than a direct
* Use the EventService to publish events call to a Spring-injected service

= The event system is synchronous by default; you can make it asynchronous in two ways:
* configuring the PlatformClusterEventSender
2 to send all non-cluster-aware events asynchronously to the same/local server node

* using ClusterAwareEvents interface


2 to send all implementing events asynchronously to nodes of any specified node groups

INTERNAL SAP and Partnors Only 19

152 C4H341 © SAP SE


Key Points

= Events can be published at the end of a transaction by implementing the TransactionAwareEvent interface

= Event Listeners can also be implemented using Scripting Support

* Covered in the live session “Scripting Support” of “SAP Commerce Cloud - Additional Technical
Essentials”

INTERNAL SAP and Partnors Only 20

SAP Customer Experience

Thank you.

©2023 SAP SE or an SAP affiliate company. All rights reserved. Soe Legal Notice on wa". sap comilegal-notice for use terms, disclaimers, disclosures, of restrictions relate’ to SAP Materials for genoral audiences

© SAP SE C4H341 153


SAP Customer Experience

Process Engine

INTERNAL — SAP and Partners Only

What we will cover in this topic

General
Services |

Process itn Sey

INTERNAL SAP and Parners Only

154 C4H341 © SAP SE


We will learn about:

> Architecture and Features

> Business Analysis

> Node Types

> Process Actions

> Working with a Process

INTERNAL SAP and Parners Only

The Context

6) The Process Engine enables you to define business


processes using XML process definitions, and run the
included actions accordingly. It guarantees that actions are
performed in the right order and in the right condition.

INTERNAL SAP and Parners Only

© SAP SE C4H341 155


Architecture of the Process and Task Engines

SAP Commerce Cloud

start w/ process name

d
Process Engine = Process Definition

queue tasks rterencs/- \

Action Action Action


Task Queue use awe
Service Service

INTERNAL SAP and Partnors Only 5

Process Engine Features

= The Process Engine extension allows you to model, support and monitor business processes

= The Process Engine interprets a process definition comprising Nodes and Transitions

= A Process is defined in a lightweight XML file (introduced later), which can be easily modified

= Actions are performed in a certain order and are only carried out if all predefined conditions are
met

= Conditional processing is based on the return results from each action

= You can wait for events, notify users or user groups and use Split Nodes for parallel processing
(details later)
INTERNAL SAP and Partnors Only 6

156 C4H341 © SAP SE


Business Analysis

Business analysis

= The first step in working with the process engine extension typically consists of conducting a
business analysis

= A flowchart defines a step-by-step solution to a given problem:

Not OK
Action1 > Actions —— Action4

OK

Action2

INTERNAL SAP and Partnors Only 8

© SAP SE C4H341 157


Process definition file

7 The workflow from the analysis is translated into a process definition XML file:
E.g. example-process.xml:

<process name="exampleProcessDef" start="action1">


<action id="action1" bean="action1Bean">
<transition name="0K" to="action2"/>
<transition name="NOK" to="action3"/>
</action>
<action id="action2" bean="action2Bean">
<transition name="0K" to="action4"/>
</action>
<action id="action3" bean="action3Bean">
<transition name="O0K" to="action4"/>
</action>
<action id="action4" bean="action4Bean">
<transition name="0K" to="success"/>
</action>
<end id="success" state="SUCCEEDED">Everything OK</end>
</process>

INTERNAL SAP and Partnors Only 9

Node Types

158 C4H341 © SAP SE


Node Types (1)

= Action nodes - carry out process logic and decide transitions to the next nodes

<action id="isProcessCompleted" bean="subprocessCompleted">


<transition name="0K" to="sendCompletedNotification"/>

<transition name="NOK" to="waitForSubprocessEnd"/>

</action>

= Wait nodes - used for communication, typically wait for another process result.

<wait id="waitForSubprocessEnd” then="isProcessCompleted">


<event>SubprocessEnd</event>
. Be aware that this event mechanism,
</wait> based on tasks, is different than the
one covered in the Events chapter.

INTERNAL SAP and Partnors Only 11

Node Types (2)

= Notify nodes - inform a user or user group of the state of a process


<notify id="notifyAdminGroup” then="splitNode">
<usergroup name="admingroup"” message="Do something!
"/>
</notify>

= Split nodes - split the process into parallel paths


<split id="splitNode">
<targetNode name=”nodeA"/>
<targetNode name=”nodeB"/>
</split>

= End nodes - end the process and store state in a process item

<end id="error” state="ERROR">Al11 went wrong.</end>


<end id="success" state="SUCCEEDED">Everything is fine</end>

INTERNAL SAP and Partnors Only 12

© SAP SE C4H341 159


Process Actions

Process Actions

= The next step consists in defining all actions specified in the bean attribute of individual action nodes

= Actions are the most important part of the process engine extension and implement logic or call
specialized services

= Anaction performs a single piece of work and produces an action result which is directed as input to the
next action

= All actions from the process definition XML file are implemented as actions classes

= If an action cannot perform or complete its work, it may signal that the current task should be put back into
the queue of due tasks to be processed again later by throwing a RetryLaterException exception or
returning Action. RETRY_RETURN_CODE
— Inability to complete task may be due to temporary Actions are “isolated”, self-contained components.
problems (e.g. unreachable web service) There is often no call stack to properly handle
exceptions higher up the hierarchy.
— Action may specify time to wait before task is tried
Action should handle its own exceptions, and if
again problem is deemed temporary, request a retry later

INTERNAL SAP and Parners Only 14

160 C4H341 © SAP SE


Abstract Simple Decision Action

public class Action1 extends AbstractSimpleDecisionAction

{
@Override
public Transition executeAction(BusinessProcessModel process)
{
if(...)
return Transition.NOK;
else
return Transition.OK;

}
}

INTERNAL SAP and Parners Only

Abstract Procedural Action

public class Action2 extends AbstractProceduralAction


{
@Override
public void executeAction(BusinessProcessModel process)
{
modelService.save(process);
}
}

INTERNAL SAP and Partnors Only 16

© SAP SE C4H341 161


Using a common context

=» Acommon context is used for all actions belonging to a particular process

= This is achieved with the class BusinessProcessModel or one of its subclasses


— e.g. ConsignmentProcessModel

= An instance of this class is passed as a parameter each time an action is called:

public void executeAction(final BusinessProcessModel process)

= The process fills this context with values

=» You may add your own attributes to BusinessProcessModel


— or better yet, subclass it and add attributes to the subclass

Use the common (shared) context to |


exchange data between uncoupled '
actions assigned to the same process |

INTERNAL SAP and Partnors Only 17

Integration with Spring

« Finally, we need to declare the action classes as Spring beans in <my-extension>-spring.xml :

<bean id="actioniBean" class="org.training.actions.impl.Action1"


parent="abstractAction"/>

<bean id="action2Bean" class="org.training.actions.impl.Action2"


parent="abstractAction"/>

<bean id="action3Bean" class="org.training.actions.impl.Action3"


parent="abstractAction"/>

<bean id="action4Bean" class="org.training.actions.impl.Action4"


parent="abstractAction"/>

» Alsoin <my-extension>-spring.xml , we must register each process-definition


. xm1 file
using a bean of type ProcessDefinitionResource:
<bean id="exampleProcessDefinitionResource"
class="de.hybris.platform.processengine.definition .ProcessDefinitionResource" >
<property name="resource" value="classpath:/processes/example-process.xml" />
</bean> 4
~ REMINDER: the resources folder of each extension
INTERNAL SAP and Parners Only .) is already on the Java classpath 18

162 C4H341 © SAP SE


Working with a Process

Creating and Starting a Process

= To create a new process instance, you need to call the BusinessProcessService method:

<T extends BusinessProcessModel> createProcess(String processCode, String processDefinitionName)

= To start this process, use:

void startProcess(BusinessProcessModel process)

— For Example:
BusinessProcessModel process = businessProcessService.createProcess("myProcID",
"exampleProcessDef" )
businessProcessService. startProcess(process)

= Do both at once:

BusinessProcessModel process = businessProcessService.startProcess("myProcID",


"exampleProcessDef" ) 1|
. myProclD: Name of process instance '
= To trigger an event:
exampleProcessDef: Name of process definition I
businessProcessService.triggerEvent("myEvent") inside *-process.xml |

INTERNAL SAP and Partnors Only 20

© SAP SE C4H341 163


References

The SAP Commerce Cloud Process Engine:

https://help.sap.com/docs/SAP_ COMMERCE CLOUD PUBLIC CLOUD/aa417173fe4a4ba5a473


c93eb730a417/8c30e9ae86691014a36ed5fd11e24a1e.html

Example Order Management Business Process:

https://help.sap.com/docs/SAP_ COMMERCE CLOUD PUBLIC CLOUD/aa417173fe4a4ba5a473


c93eb730a417/8c21906286691014a3d9914038869eca.html

Task Service:

https://help.sap.com/docs/SAP_ COMMERCE CLOUD PUBLIC CLOUD/aa417173fe4a4ba5a473


c93eb730a417/8c6d262b866910149bdadc86225a5657.html

INTERNAL SAP and Partnors Only 21

Key Points

1. Process engine allows you to model, support and monitor business processes

2. Toimplement a business process, you need to:


« Define a business process XML file (composed of a list of nodes and transitions)
* For every action node, you need to define a class, related Spring bean, and transitions

* You need to define a Spring bean to register the business process itself

3. You can create and start a business processes by using the BusinessProcessService

Dynamic Process with scripting is covered in the live session “Scripting” in the series of
“SAP Commerce Cloud - Additional Technical Essentials”

INTERNAL SAP and Partnors Only 22

164 C4H341 © SAP SE


SAP Customer Experience

Thank you.

©2023 SAP SE or an SAP affiliate company. All rights reserved. Soe Legal Notice on wa". sap comilegal-notice for use terms, disclaimers, disclosures, of restrictions relate’ to SAP Materials for genoral audiences

SAP Customer Experience

Orders

INTERNAL — SAP and Partners Only

© SAP SE C4H341 165


What we will cover in this topic

qt Methodology

Data Product Coupons and Order Search and


Pricing Payment Personalization Navigation
Modeling Modeling Promotions Management

Development General Services r Maintenance

-{ Web Layer = Service Layer L -t Background Task = impex Flexible Building

Pr Search Framework
WCMS Facade Cronjobs

en P Installation
Validation Security Confi ti
occ Service Riles
Engine

Event Cache Update and
. System Initialization
Backoffice occ Workflows

Scripting

INTERNAL SAP and Partners Only 2

We will learn about:

> Overview of OM Extensions

> Order Fulfilment Process

> Warehouse Integration Process

> Further OM Features

INTERNAL SAP and Partners Only 3

166 C4H341 © SAP SE


The Context

oO Order Management is built on top of the SAP Commerce


Platform. It allows you to view and manage customer
orders, review and edit shipping information, manage
returns and refunds, and to search for and view your
inventory information.

INTERNAL SAP and Parners Only

Preparation

Complete step P1 of the Orders exercise


2550
oo
Or

(The setup ant target will compile your system


during the lecture}

INTERNAL SAP and Parners Only

© SAP SE C4H341 167


Overview of OM Extensions

The Essential Extensions

= The order management related extensions include:


— basecommerce with basic data model definitions and service implementation for OM, e.g.
— API for custom services and strategies
Replenishment and order scheduling
Order splitting
— Payment integration
— Fraud detection
Order history & versioning

— yacceleratorfulfilmentprocess
— Template for custom code base with predefined order related processes

INTERNAL SAP and Partnors Only 7

168 C4H341 © SAP SE


What does yacceleratorfulfilmentprocess extension do?

= Extension with predefined order related processes Base Store


— It can be used as a template by both extgen
and modulegen shy & %
— is part of the accelerator module ws
[) electronics
= Contains several typical processes:
— order-process.xml
— consignment-process.xml Electronics Store
— return-process.xml a

= The fulfillment process name is a configurable Properties Locations Administration


attribute on the BaseStore item
Submit order process code

Submit Order Process Code

order-process

INTERNAL SAP and Partnors Only 8

Order Fulfilment Process

© SAP SE C4H341 169


Order Flow
ch ‘
it
i
Payment Service Provider Fraud
Prevention
+ standard payment Svc Provider
+ multi-tender (cash, non-cash,
gift cards...} fraud
check

¢os :: T_&

N ke °
authorize reserve Lis
payment amount
ote % ,
tO t internal ua
au fraud check ie
van '
i
Had
{ ‘4 \ i .
consignment rder lool
sock stat
id a iv
Order . reserve fraud queue warehouse notify
——> authorize ——>
amount checking order integration customer
Entry
xt xt xy? t |
. v
A a
cart items w wi
email email Notify send & ‘~ w
payment customer customer Customer order placed
notification
shipping ]
Payment Check
manual check
byCSA

xt
wy Cancel
Order

Fraud Detection
INTERNAL SAP and Parners Only

Payment Check

By placing an order, OrdersController triggers the fulfillment process (e.g. order-process.xml)


= CheckAuthorizeOrderPaymentAction in order process checks if the transaction was authorized
by a payment provider
ReserveOrderAmountAction should then reserve the payment amount

INTERNAL SAP and Parners Only

170 C4H341 © SAP SE


Fraud Detection

internalFraudServiceProvider

@ BlacklistSymptom WA

@ OrderThresholdSymptom >¢

=
50 points
120 points
commercialFraudServiceProvider

fraudService mSymptomA

@ Symptom B A

z.. 4
70 points

INTERNAL SAP and Partners Only 12

Fraud Service
item item
Product Order

products | * order
productOrderLimits | + fraudReports | +
us: item item
[ alatetataietetetatateietatetetetetsteletataneetetetetatal > ProductOrderLimit FraudReport
H

i
DefaultFraudService }+—)> FraudService 9

+ k providers
i
AbstractFraudServiceProvider }—? — FraudServiceProvider
T
Hi
\ produces.
1
1
v
DefaultHybrisFraudServiceProvider FraudServiceResponse

+ 4 symptoms + P symptoms
i
od crcrmmcenoeen] FraudSymptom

INTERNAL SAP and Parners Only

© SAP SE C4H341 171


Order Splitting

= Services for realizing consignments out of one order


= Multiple consignments examples
— More than one delivery address
— Products on back order
— More than one warehouse involved in the fulfillment — depending
on stock levels
— Different pick up locations

INTERNAL SAP and Parners Only 14

Splitting Strategies

= SplitByDeliveryMode:
— splitting an order according to different delivery modes in an order

= SplitByNamedDeliveryDate:
— splitting an order according to different delivery dates in an order

= SplitByEntryDeliveryAddress:
— splitting an order according to different delivery addresses in an order
= SplitByAvailableCount:
— splitting an order according to available count for all stock levels
= SplitByWarehouse:
— choses a warehouse that can process the order based on the stock level in the database (do
not split if not necessary).

In the Accelerator, an additional strategy is available:

= SplitByPOS
— Splitting an order according to stores selected for Pick Up

INTERNAL SAP and Partnors Only 15

172 C4H341 © SAP SE


Order Splitting Service

= Methods:
— splitOrderForConsignment
— splitOrderForConsignmentNotPersist

<bean id="defaultOrderSplittingService” ...>

<property name="strategiesList">
<list>

<ref bean="splitBy_XYZ_Strategy” />

</list>
</property>
</bean>

INTERNAL SAP and Partnors Only 16

Order History and Order Versioning


= Storing information about order related actions
= Persistent snapshots for keeping track of changes applied to orders

<<item>> <<item>>
AbstractOrder Employee

employee 0.1
order historyEntries
<<item>>
Order *
lversionID : String | previousVersion
Icode : String

0../\ 0..1
1
originalVersion '
1
1
1
create version snapshot
1
'
'
1
<<iInterface>>
OrderHistoryService
del). O1

IgetHistorySnapshots(OrderModel) : Collection<OrderModel>

INTERNAL SAP and Partnors Only 17

© SAP SE C4H341 173


Warehouse Integration Process

Consignment Fulfillment
tes backorder backorder
warehouse
not allowed | items to
' partial customer
H ¥ delivery?
ii .
backorder wait for
cancalled 1 "@) dativery x
1 v send wait for
' Y consignment — payment ship
receive { pick & items in update update
consignment H pack stock? | . a
H 1 >
Zz H H ves
n i ' H
t ' " 1 to store for
' ' H pick-up
warehouse send H receive calculate \
integration consignment t warehouse Ph ent 1
| to warehouse i status. Pay! i we

| 1! ;
|
iv
ro
H
split order i canes) | \ I send
by Ly cancel ! payment Mi delivery
consignment consignment » OK? {1 nouication
'
' x! !
' | Lop ew
t '
¥ ¥ send
in-store
~ capture pickup
send cancel payment send
message payment failed
9 message
Payment Service Provider
INTERNAL SAPand Partnole win 19

174 C4H341 © SAP SE


Consignment Fulfilment subprocess (extract)

<action id="sendConsignmentToWarehouse” bean="sendConsignmentToWarehouseAction">


<transition name="0K" to="waitForWarehouse"/>
<faction>

<wait id="waitForWarehouse” then="receiveConsignmentStatus”


prependProcessCode="false">
—» <event>${process.code} WaitForWarehouse< /event>
</wait>
I
I <action id="receiveConsignmentStatus” bean="receiveConsignmentStatusAction"”>
I <transition name="0K" to="allowShipment"/>
| <transition name="CANCEL"” to="cancelConsignment"/>
I <transition name="ERROR” to="error"/>
</action>
I
= I

| Take note: Business process events are different from the events introduced in the event system.
i)

1T
1
hey should be published with BusinessProcessService.triggerEvent(String event) instead of EventService

INTERNAL SAP and Parners Only 20

Warehouse Integration

= Communication between warehouses and SAP Commerce:


— display stock level
— display availability
identify a pre-sell-item
— email a notification, once an item is back in stock
— mark items as “always in stock”

INTERNAL SAP and Parners Only 24

© SAP SE C4H341 175


Warehouse Integration (2)

=» Enables you to communicate with a warehouse

= Interface Process2WarehouseAdapter Warehouse


SAP Integration
— prepareConsignment Commerce Interfaces
Cloud
— shipConsignment —
“EL
es
eee, prepare
eZ
= Interface Warehouse2ProcessAdapter
—receiveConsignmentStatus ii — ship —
Lg consignment }

vasecommercs
-
wat warehouse
extension
receive
consignment
status

INTERNAL SAP and Parners Only 22

Further OM Features

176 C4H341 © SAP SE


OM Related Customer Services

= Simple customer services implemented in basecommerce extension


= Includes e.g., order cancel, return and refund

= Is covered in a Live Session

Live Session “Customer Services in Basecommerce” in the series of “SAP Commerce Cloud - Additional
Technical Essentials”

INTERNAL SAP and Parners Only 24

Order Management features

= Real-time inventory management across all stock locations (ATP using either Backoffice or OCC)
= Automated order process or workflow
= Order splitting, Sourcing & Allocation
= Ability to pick, pack, label, and confirm shipments through Backoffice Order Fulfillment Cockpit
= Self-service Cancellation

= Ability to create and manage returns (also with restock ability) and refunds
= Further details in the live session:

Live Session “Order Management Services Module” in the series of “SAP Commerce Cloud - Additional
Technical Essentials”

INTERNAL SAP and Parners Only 25

© SAP SE C4H341 177


Key Points

1. Order management is defined as business processes, customizable case-by-case.

2. The basic steps in a typical OM process include (but are not limited to) payment check, fraud
detection, order splitting, warehouse integration, etc.

3. SAP Commerce provides many services, interfaces and mock implementations to support OM,
such as FraudService, OrderSplittingService, Warehouse adapters, etc.

4. Consignment fulfillment subprocess (of Order management) exists for warehouse integration
and is also customizable.

INTERNAL SAP and Partnors Only 26

Orders Exercise

178 C4H341 © SAP SE


SAP Customer Experience

Thank you.

©2023 SAP SE or an SAP affiliate company. All rights reserved. Soe Legal Notice on wa". sap comilegal-notice for use terms, disclaimers, disclosures, of restrictions relate’ to SAP Materials for genoral audiences

© SAP SE C4H341

You might also like