Development and Extension Guide for Omnichannel Promotion Pricing
Total Page:16
File Type:pdf, Size:1020Kb
SAP Customer Activity Repository 3.0 FP3 CUSTOMER Document Version: 1.0– 2018-04-20 Development and Extension Guide for Omnichannel Promotion Pricing Document History Version Date Change 1.0 2018-04-20 Initial version Development and Extension Guide for SAP CARAB 2.0 FP02 Overview of Omnichannel Promotion Pricing Promotion Pricing Service Open Source Dependencies of the PPS PPS Module Concept Defining and Overriding Beans PPS Context PPS Module api Overview Beans Required Beans Configuration Properties Dependencies PPS Module client-interface Overview Extensibility via any Elements Beans Configuration Properties Dependencies PPS Module core Overview PPS Application Context PPS Context Beans Configuration Properties Dependencies PPS Module dataaccess-interface Overview Beans Configuration Properties Dependencies PPS Module jackson Overview Configuring Jackson (Client Side) Request Logging Beans Configuration Properties Dependencies PPS Module restapi Overview Known Issues Beans Configuration Properties Dependencies PPS Module client-impl Overview Request Validation Single vs Bulk Access for Regular Prices Handling of Business Unit Type Beans Required Beans Configuration Properties Dependencies PPS Module calcengine-gk Overview Beans Default Settings and Properties Required Beans Configuration Properties Dependencies PPS Module dataaccess-common Overview Regular Price Promotional Information Object-Related Mapping Using Spring Multi-Step JPA Resource Mapping Multi-Step JPA Property Definition Support of JPA Entity Extensions equals() and hashCode() for JPA Entities Caching Caching Regular Prices Caching Promotional Information Cache Keys Prefetch of Price Derivation Rule Eligibility References Support of Weaving Support for Read-Only Transactions Code Conversion Handling of Currencies and Amounts Handling Product IDs Handling of Language-Specific Information SAP Client and Logical System Beans Required Beans Configuration Properties Dependencies PPS Module dataaccess-ddf Overview Attribute Converters Boolean Values Time Stamps Beans Configuration Properties Dependencies PPS Module dataaccess-localdb Overview Indexes Beans Required Beans Configuration Properties Dependencies PPS Module idocinbound Overview Spring Integration Process Definition Processing the IDoc Data Conversion of the IDoc Payload to the Expected Java Types Mapping Regular Prices Mapping OPP Promotions Posting to the Database Regular Prices OPP Promotions Beans Required Beans Configuration Properties Dependencies PPS Performance Hints Creating of the Offers Distributing of the Data Client Side (Price Calculation) Client Side (Data Replication) Server Side Common Rules Local-PPS-Specific XSA-Based-PPS-Specific Database Side PPS Logging and Tracing PPS Authentication Enabling XSA Authentication Price and Promotion Repository Overview Modeling of OPP Promotions Keys and Foreign Keys Validity Period for the OPP Promotion Database Tables Handling of Amounts Transformation from DDF offers into OPP Promotion Technical Information How We Transform DDF Offers into OPP Promotions Transformation of Simple Discount Offers Examples Transformation of Mix-and-Match Offers Examples Transformation of Packaged Offers Transformation of Offers with Incentives Default Values ItemPriceDerivationRule Fields Only Relevant for Coupons Fields Only Relevant for Loyalty Points CouponPriceDerivationRule Eligibility PromotionPriceDerivationRule Replication of the Price and Promotion Repository Outbound Processing of IDocs via DRF DRF Configuration OPP Promotions Outbound Implementation for Promotion-Centric Outbound Processing Outbound Implementation for Location-Specific Outbound Procesing Filtering the OPP Promotions Controlling the Target Locations Generic Mapping of Customer Enhancement Segments Transfer OPP Promotions Using the Global Object List Location-Specific Outbound Processing Using the Global Object List Cleanup of the Global Object List Regular Prices Outbound Implementation Data Filtering Handling of the Expected Data Volume OPP Extensibility Extensibility of Demand Data Foundation (DDF) Extensibility of DDF Offer Inbound API Extensibility of DDF Regular Price Inbound API Extensibility of the OPP Data Model (ABAP) Extending SAP delivered ABAP domains Extensibility of the OPP Business Logic (ABAP) Extensibility of the Transformation from DDF Offer into OPP Promotion Extensibility of the IDoc Outbound Processing (ABAP) Extensibility of the OPP Data Model (Java) Adding a Field to an Entity Adding a Separate Entry Adding an Attribute Converter to an Existing Attribute Adding a Subentity to an Existing Entity Adding a Specialization to an Existing Entity Using Own Logic for Equals() and HashCode() of a JPA Entity Extensibility of Client API (Java) Extensibility of Enumerations Extensibility of Content with User-Defined Attributes / Elements Restrictions Example: Enrich SaleForDelivery Entity with Address Information Extending the PPS Business Logic (Java) Plugin Concept Calling the Plugins Implementing a Plugin Guaranteed Stability Documented Stability Your Choices for Extending the PPS Java Side SAP Delivered Plugin Implementations Structure of Your Extension Project Installing your Extensions Extensibility of the Promotion Calculation Engine (Java) Extensibility of the sapppspricing PPS Integration (Java) Extensibility Examples Integrating Custom Extensions into the XSA-Based-PPS Setting Up the Development Environment Creating Your Extension Projects Adding Your Extension to the PPS Extending the PPS-Based Price Calculation in SAP ERP and SAP S/4HANA Sales Documents Extending via BAdIs Enriching with Further Article Hierarchy Nodes Extending the SAP ERP/ SAP S/4HANA PPS Client Support for Mocking of the SAP ERP/ SAP S/4HANA PPS Client Overview of Omnichannel Promotion Pricing The following two main features are provided with omnichannel promotion pricing (OPP): Regular prices and price rules (promotions) are maintained and stored in a central repository called the price and promotion repository (PPR). The promotion pricing service (PPS) calculates effective sales prices for shopping carts and applies promotions to the shopping carts. The PPR is part of SAP Customer Activity Repository (SAP CAR) based on SAP HANA. This repository contains regular prices as well as price rules (so-called "offers"). Technically, this data is located in the Demand Data Foundation (DDF) software component. This data is also used by SAP Promotion Management for Retail (SAP PMR), which is an optional add-on to SAP CAR. Therefore, OPP reuses the existing tools to maintain price rules: SAP PMR, SAP Fiori UI-based maintenance, as well as the RFC-based import of offers to SAP Customer Activity Repository. In the case of regular prices, the existing import is reused as well. In an SAP environment, the regular prices are typically imported from SAP ERP. However, SAP ERP is not a mandatory component for OPP. The PPS uses a Java-based engine to calculate prices and promotions. This ensures high system performance and a flexible deployment. The deployment of the PPS embedded into SAP Hybris Commerce (local deployment) is offered. In this case, the PPS uses the same database as SAP Hybris Commerce. The price and promotion calculation is exposed using a stateless service, which is based on the ARTS Price Service Interface 1.0. This interface is consumed by SAP Hybris Commerce using an additional extension (sapppspricing) that can be used by any other client. Internally, the PPS is based on a different data model for price rules than the DDF offer. It is based on the ARTS promotion data model. In the following documentation, this runtime model is called OPP promotion. This model offers similar, but not identical, features to define price rules relating to the DDF offer. You have to distinguish clearly between the repository view of a price rule (the DDF offer) and the runtime view (the OPP promotion). To use the PPS to calculate promotions, the DDF offer must be transformed into the OPP promotion that is stored in separate database tables. This is done automatically when a DDF offer is written. If the offer can be translated into an OPP promotion, an automatic compatibility check is performed before the offer is saved. The status of the offer determines whether the compatibility check and the transformation can be performed. Offers that have the status In Process are not considered. This transformation with data replication is not performed for regular prices. The prices are consumed by the PPS using the database view. To support the distributed deployment of the PPS, the prices and promotions can be replicated to external systems including SAP Hybris Commerce. Since the basic concepts behind the calculation of promotions for GK POS solutions are the same as those behind the promotion calculation engine used with OPP, it is possible to offer consistent pricing across all sales channels. The prices and promotions are replicated using IDocs. The replication is done using the data replication framework (DRF), which is a central reuse component in SAP Business Suite. Delta transfer is also supported. The following figure illustrates the OPP architecture: Promotion Pricing Service This chapter describes the promotion pricing service (PPS), in particular its concepts and its structure. The figure below shows the inner structure of the PPS in more detail and the data flow of a price calculation request: The PPS is an application that exposes an API based on the ARTS Pricing Service Interface 1.0. The structure of