End to End Extensibility of the Offer in SAP Promotion Management for Retail

End to End Extensibility of the Offer in SAP Promotion Management for Retail

Applies to:

SAP Promotion Management for Retail (SAP PMR) 7.1 SP2

Summary

Modification-free extensibility is a major asset of SAP software. SAP Promotion Management for Retail (SAP PMR) allows the extension of the standard by different technologies, such as CI_Include, Business Add-Ins (BAdIs), switches (for Trade Promotion Optimization (TPO)), and inherent Web Dynpro ABAP extensibility. This document describes the extensibility of the business object Offer using BAdIs.

Author:Christian Hissler

Company:SAP

Created on:15April2011

Author Bio

Christian Hissler, an SAP employee since 1998is a development architect for SAP Promotion Management for Retail

Table of Contents

Introduction

High Level View

Extended Components

Inbound Processing

Extensions

Offer Persistency

Business Logic

Usage

Methods

Financial Calculations

Override Price Determination

Override Disaggregation

Override Vendor Deal Distribution

Override User Projection Distribution

Override Calculations

Override Aggregation

Mass Override Any Financial Field

Offer Preview

User Interface

Export to Publishing

Event Preview

Promotion Analytics (BI)

Details

Persistency Layer

Open

Related Content

Appendix: Customizing Includes

Copyright

Introduction

Modification-free extensibility is a major asset of SAP software. SAP Promotion Management for Retail (SAP PMR) allows the extension of the standard by several different technologies:

  • CI_Includes
  • BAdIs
  • Switches (for TPO)
  • Inherent Web Dynpro ABAP extensibility

This document describes the extensibility of the business object Offerincluding its interfaces.Only the main BAdIs for the central functional components of Offerare described.

In addition to the BAdIs described in this document, the IMG for SAP PMR providesother BAdIs that can be used according to their documentation.

High Level View

The Offer requires extensibility features at various levels. This allows both customers and custom development at SAP to respond to specific requirements or build further features based on SAP PMR.

Figure 1: Extensible Components of the Business Object Offer (the remarks on availability refer to extensibility)

Extended Components

Inbound Processing

Inbound processing supports extensibility; that is, customers can use the standard EXTENSIONIN structure of the inbound Offer to map custom fields to every node of the Offer (staging). The process from staging into the backend follows the standard API also used by the user interface.

Extensions

  • Function module /DMF/OPIF_OFFER_INBOUND(_TPO) provides the EXTENSIONIN structure.
  • The eight BAdIs (such as /DMF/OFR_HDR_EXTEN_CUST ) of the enhancement spot /DMF/CUSTOMER_EXT_OFFER support the mapping from the inbound interface to staging tables.
  • With SAP PMR 7.1 SP2, customers can map the EXTENSIONIN fields to CI_ Includes on main staging tables of the Offer:
  • /DMF/OPIF_OFR
  • /DMF/OPIF_OFRTRM
  • The class /DMF/CL_OPIF_OFFER maps the staging tables to the Offer internal APIs that are identical to the APIs used by the user interface.

Offer Persistency

For the Offer, a customer can create their own database tables for which data is read and written to during Offer processing with the two specific methods of the BAdI/DMF/CREATE_OFFER_DATA.

The most important standard tables of the Offer can be extended by the following customizing (CI_ Includes):

  • /DMF/OFR_TRM_DTL
  • /DMF/OFR_EXT_XR
  • /DMF/OFR
  • /DMF/OFR_TRM_PRD
  • /DMF/OFR_TRM_INC
  • /DMF/OFR_INC
  • /DMF/OFR_CSTMR

Business Logic

BAdI/DMF/CREATE_OFFER_DATA is the central BAdI for the extensibility of the Offer. It is a single-use BAdI with the setting Reusing Instantiation. That means that the ABAP runtime ensures that within one internal mode on every call of the GET BAdI statement for this BAdI, the identical instance is returned to the runtime (BAdI singleton). This allows the use of attributes by the implementing class for the BAdI.

The consequences of this are:

  • At the different events of an Offer, such as LOAD and SAVE, the runtime can access one identical set of attributes.
  • Separate BAdIs or the UI can use the method GET_ZDATA of the BAdI to read this set of attributes. It means that an implementation of the financial calculation BAdI has access to this data. This is an extreme example. We do not expect that this access is required, but it allows the definition of more specific,fine-granular BAdIs that can be implemented more easily compared to a BAdI with many methods covering different functional areas.

Usage

TheBAdI /DMF/CREATE_OFFER_DATA is used to extend the business logic of the Offer. Its methods are called for different events of the Offer, for example, reading persistent data, validating data, calculating financials, and saving. During the processing of an Offer, the same instance of the implementing class is called for different events that allow the useof class attributes visible at the time of adifferent call. For example, at the read event of an existing Offer, custom tables can be read and added as an attribute to the class. The data is then visible in validations. In addtition,custom data created during Offer validations can be written into custom database tables on saving.

These attributes can also be accessed and modified by other BAdI implementations of the same Offer. By using the GET BAdI statement for the /DMF/CREATE_OFFER_DATA, you get an instance of the implementing class of the BAdI and can retrieve or modify the attributes of the implementing class. It is ensured that in one internal mode you get the identical instance of the BAdI implementing class (singleton).

Some features of the BAdI include the ability to:

  • Add custom data to the business logic of offer
  • Store data in custom tables
  • Assign default values on the update or creation of an offer
  • Modify financial data or use custom calculations
  • Modify offer data

Methods

  • CREATE– This method is called when an Offer is saved. It has only IMPORT parameters. The complete Offer data is available, including update indicators. For example, if a term is added to an existing Offer, the update indicator for that term (parameter IT_TERM) is I while it is U for the Offer header (parameter IS_OFFER). This method can be used to save custom data.
  • READ– This method is called when an existing offer is read from the database. This method can be used to read custom data from the database. If you add the custom data as an attribute to the implementing class of the BAdI, this data becomes available for the subsequent methods of the BAdI within the same transaction.
  • GET_DEFAULT_DATA– This method is used to set default values for offer properties. The structure /DMF/OFFER_BADI_DEFAULT_STY defines the full list of possible attributes to be defaulted.
  • CALCULATE_OFFER– This method is used to overwrite calculations in the offer. It also allows the implementation of different algorithms to calculate financials.
  • PROCESS_OFFER– This method is used to set custom data and to modify existing data. The method provides access to the methods of the interface /DMF/IF_OFFER. The method SET_DATA can be used to overwrite data. The offer validation is triggered again after this method is called.
  • SET_ZDATA– This method allows setting custom data (attributes) of the implementing class. The method can be accessed by the different components of the Offer (UI, financials, and so on). It is ensured that in one internal mode (between open and save of the Offer) the GET BADI statement will deliver the same instance of the implementing class (singleton).
  • GET_ZDATA– This method allows reading of custom attributes by the different components of the Offer. A Use case is the read of a Z database table in method READ and provisioning of this data to implementations of other BAdIs within the Offer.

Financial Calculations

For the financial calculation many extensions are possible. The logic consists of many smaller parts (other than the Offer core with a few main building blocks). For this reason there are several smaller BAdIs that allow:

  • Recalculation of standard fields
  • Implementation of a special logic, such as vendor fund calculation
  • Calculation of custom field in CI_Include

The points can be modified.

Override Price Determination

Price determination specifies the logic that derives, among other things, the cost and regular price of each product location.

The BAdI/DMF/OFFER_FINANCIALS=>OVERRIDE_PRICE_DETERMINATION () needs to be implemented to override this logic.

Override Disaggregation

Disaggregation means determining which discount applies to each product location records of this Offer.

The BAdI/DMF/OFFER_FINANCIALS=>OVERRIDE_DISAGGREGATION () needs to be implemented to override this logic.

Override Vendor Deal Distribution

The BAdI /DMF/OFFER_VENDOR_FUND is provided for the financial calculations of the vendor deal impact.

Override User Projection Distribution

User projections are user-entered values projecting number of units sold. They can be entered by auser in lieu of forecasted values, or they can be entered to override one or more forecasted values. They can be entered at any product/location dimension, and they are then distributed down to all child product/location dimensions via a preset algorithm. The BAdI /DMF/USER_PROJECTIONallows these values and/or the distribution algorithm to be overridden to fit customer needs.

Override Calculations

Calculations refer to the computation of the financials fields. Almost all calculated fields in the financial detail structure can be modified. For example, the total potential sales would be the projected unit sales X potential sales price of each unit.

The BAdI/DMF/OFFER_FINANCIALS=>OVERRIDE_CALCULATIONS () needs to be implemented to override this logic.

Override Aggregation

Aggregation refers to summing up totals, calculating averages, and finding minimums and maximums at the product group and location group levels of the financial records. The aggregated records can be modified here.

The BAdI/DMF/OFFER_FINANCIALS=>OVERRIDE_AGGREGATION () needs to be implemented to override this logic.

Mass Override Any Financial Field

The BAdI/DMF/CREATE_OFFER_DATA provides the method CALCULATE_OFFER that is called as a last step in the financials and allows the redefinition of the complete logic. This BAdI is suitable for major custom changes on the SAP PMR default logic; due to its coarse granular nature it may not be suitable for smaller adjustments.

Offer Preview

If any product/product group attributes need to be displayed in the preview as attributes, a customer needs to do the following:

  1. In Customizing, a customer has to add the product attribute to the table in Maintain Promotion Specific Attributes under Cross-Application Components→Demand Management Foundation→ Promotions.
  2. For the Flex modification, no extensibility features are available. A customer is required to change the SWF file that renders the Flex window.[1]

Some development effort is required. Both steps are required

User Interface

Web Dynpro ABAP applications can be enhanced without modification. UI elements can be added, methods can be modified using pre- and post-exits, and context nodes can be enhanced. Retrieving data from the database, binding it to the context, and saving the additional data to the database needs to be handled through the BAdIs and customer includes/new database tables as explained in section Offer Persistencyand in the description of BAdI /DMF/CREATE_OFFER_DATA. More details are provided in Modification Free Enhancements.

Export to Publishing

Enterprise services can be extended by customers using data-type enhancements. These extensions are free of modification and come after the regeneration of the back-end proxy in this case. To populate customer extension fields, the customer is required to create a new implementation of the BAdI/PRM/EVENT_EXPORT and populate the fields accordingly. Some development effort is required.

Event Preview

This uses the XML generated by Export to Publishing service. It is required only to enhance Event Preview, provided Offer Preview has been enhanced by the customer. As with Offer Preview, the customer is required to change the SWF file that renders the Flex window. Some development effort is required.

Promotion Analytics (BI)

The effort to leverage custom fields in SAP NetWeaver BI is minimal. The class /DMF/CL_BI_EXPORT_OFFER uses MOVE- CORRESPONDING, which ensures that custom fields in CI_Includes are transferred automatically to BI(provided the following is true):

  • Communication structure is extended
  • Field names are identical

Details

  • The BI structure must be enhanced with the added fields.
  • Function Module that fills the BI structure will be modified to fill the new field values.
  • Data Source will be reactivated in the test system after transport. Note that this is done only if structures are changed.
  • Data Source will be replicated again in the BI system.
  • Enhancement will be done accordingly in the BI system from the Data Store Objectto Query where new details are required (including classes).

Persistency Layer

A customer can use CI_Includes and Z tables to persist custom data using the method CREATE of the BAdI/DMF/CREATE_OFFER_DATA. The method is called by the instance factory upon saving of Offer(s). The CI_Includes with SAP PMR 7.1 SP2 are generally available for the database tables of the Offer objects nodes (Terms, Tactics, and so on).

  • CI_Includes are persisted without any further implementation efforts (persistency “out of the box”).
  • For the Z tables,a customer needs to implement its their own update function modules to store data. There are various ways to provide the custom data to the SAVE method: it can be either derived from standard or CI_ fields or by using the attribute of the BAdI singleton.

Appendix: Customizing Includes

A Customizing Include is a structure that satisfies a special naming convention. The name of a Customizing Include begins with CI_ and is in the customer namespace.

If enhancements are already planned in the standard using customer-specific fields, such Customizing Includes are included in the corresponding standard table or standard structure. The Customizing Include (that is, the definition of the structure itself) is usually created first in the customer system and filled with fields by special Customizing transactions.

Customers can thus enhance tables and structures of the standard system without having to modify the table and structure definitionsthemselves. This means that these enhancements will not be lost when upgrading. If a table or structure of the standard system is enhanced with customer fields using a Customizing Include, these customer fields are inserted automatically in the new delivered table or structure definition during an upgrade.

If you create a Customizing include for a table or structure, only those enhancements are allowed that are consistent with the enhancement category of the enhanced table or structure

Customers can but need not create a Customizing include and fill it with fields. If there is no Customizing include, there is no error message when the table or structure including it is activated.

A Customizing include can be contained in several tables or structures, so that they remain consistent when it is modified.

Copyright

© Copyright 2011 SAP AG. All rights reserved.

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice.

Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors.

Microsoft, Windows, Excel, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation.

IBM, DB2, DB2 Universal Database, System i, System i5, System p, System p5, System x, System z, System z10, System z9, z10, z9, iSeries, pSeries, xSeries, zSeries, eServer, z/VM, z/OS, i5/OS, S/390, OS/390, OS/400, AS/400, S/390 Parallel Enterprise Server, PowerVM, Power Architecture, POWER6+, POWER6, POWER5+, POWER5, POWER, OpenPower, PowerPC, BatchPipes, BladeCenter, System Storage, GPFS, HACMP, RETAIN, DB2 Connect, RACF, Redbooks, OS/2, Parallel Sysplex, MVS/ESA, AIX, Intelligent Miner, WebSphere, Netfinity, Tivoli and Informix are trademarks or registered trademarks of IBM Corporation.

Linux is the registered trademark of Linus Torvalds in the U.S. and other countries.

Adobe, the Adobe logo, Acrobat, PostScript, and Reader are either trademarks or registered trademarks of Adobe Systems Incorporated in the United States and/or other countries.

Oracle is a registered trademark of Oracle Corporation.

UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group.

Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of Citrix Systems, Inc.

HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C®, World Wide Web Consortium, Massachusetts Institute of Technology.

Java is a registered trademark of Sun Microsystems, Inc.

JavaScript is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by Netscape.

SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP Business ByDesign, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and other countries.

Business Objects and the Business Objects logo, BusinessObjects, Crystal Reports, Crystal Decisions, Web Intelligence, Xcelsius, and other Business Objects products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of Business Objects S.A. in the United States and in other countries. Business Objects is an SAP company.

All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary.

These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.

SAP COMMUNITY NETWORKSDN - sdn.sap.com | BPX - bpx.sap.com | BOC- boc.sap.com | UAC- uac.sap.com

© 2011 SAP AG1

[1]