CL_CRM_MKTPL_EAI_PLANNING - EAI: Processing of Planning Data

rdisp/max_wprun_time - Maximum work process run time   ABAP Short Reference  
This documentation is copyright by SAP AG.

>>> Development Documentation generated by DocuGenerator v2.0 (only available in English => NO TRANSLATION!!!) <<<

General Class Description

EAI: Processing of Planning Data

__________________________________________________________

Class Info

Name:CL_CRM_MKTPL_EAI_PLANNING
Instantiation:Public

Superclass

CL_CRM_MKTPL_EAI

Implemented Interfaces

None

Friend Classes

None

Subclasses

None

__________________________________________________________

Methods

CONSTRUCTOR

Public CONSTRUCTOR( )

This constructor initializes the table of key figures necessitating associated trade spends
It reads this information from the trade spends customizing in the IMG.

________________________________________________________________________

DETERMINE_CALENDAR_UNIT

Public static CRM_MKTPL_CALENDAR_UNIT_CODE DETERMINE_CALENDAR_UNIT(

IMPORTINGCRM_KPI_Y_IOBJNM IV_TIME_INFO_OBJECT

)

This method determines which calendar unit corresponds to the info object used as time dimension
in the planning profile

Returns

RV_CALENDAR_UNIT Time dimension of the planning data (for example by week, by month)

Parameters

- IV_TIME_INFO_OBJECTInfo Object for the time characteristic in the planning layout
 For example 0CALWEEK for Calendar Week, 0CALMONTH for Calendar Month...

________________________________________________________________________

DETERMINE_MOST_USED_KEYFIGURE

Private CRM_MKTGS_SPEND_VALUE DETERMINE_MOST_USED_KEYFIGURE(

IMPORTINGCRMT_MKTPL_EAI_PLAN_DATA IT_TSPEND_KEYFIGURE_DATA

)

This method iterates the table provided and finds the spend value that is most used in the table.

Returns

RV_SPEND_VALUE The most used spend value in the table.

Parameters

- IT_TSPEND_KEYFIGURE_DATAA table containing the Keyfigure values and product dimension information
 This table should be previously filtered to contain data for only one key figure

________________________________________________________________________

DETERMINE_TSPEND_EXCEPTIONS

Private DETERMINE_TSPEND_EXCEPTIONS(

IMPORTINGSYSUUID_X IV_TRADE_SPEND_GUID
CRM_MKTGS_SPEND_VALUE IV_TRADE_SPEND_VALUE
CHANGINGCRMT_MKTPL_SORTD_EAI_PLAN_DATA CT_TRADESPEND_EXCEPTIONS

)

This method determines if trade spend exceptions should be created for a variable trade spend.
Exceptionsshould be created when the key figure value is not the same as the trade spend's spend value.
Whenan exception is to be created for a product dimension, exceptions should be created for all BI periods
for the same product dimension

Parameters

- IV_TRADE_SPEND_GUIDGUID of the processed trade spend
- IV_TRADE_SPEND_VALUESpend value of the processed trade spend
- CT_TRADESPEND_EXCEPTIONSPlanning data that will be updated with flags to indicate exceptions

________________________________________________________________________

GET_CURRENT_MASTER_PLAN_DATA

Private GET_CURRENT_MASTER_PLAN_DATA(

IMPORTINGCRM_MKTPL_CALENDAR_UNIT_CODE IV_CALENDAR_UNIT
CGPL_SEM_PLGRP IV_PLANGROUP
CRM_MKTGS_GUID IV_TRADE_PROMOTION_GUID
EXPORTINGCRMT_MKTPL_KPI_TIMELINE ET_BI_PERIODS
GTY_SORTED_KEY_FIGURE_CATALOG ET_KEY_FIGURE_CATALOG
CRMT_MKTPL_KPI_PLAN_DATA ET_KPI_PLAN_DATA
CGPL_UPC_Y_PROFILE EV_PROFILE

)

This method retrieves the planning data from the master planning layout

Parameters

- IV_CALENDAR_UNITTime dimension of the planning data (for example by week, by month)
- IV_PLANGROUPPlanning profile group assigned to the trade promotion
- IV_TRADE_PROMOTION_GUIDGUID of the trade promotion
- ET_BI_PERIODSBI periods
- ET_KEY_FIGURE_CATALOGKey Figures (columns in the planning layout), sorted by key figure names
- ET_KPI_PLAN_DATACurrent planning data
- EV_PROFILEPlanning profile that was read

Exceptions

- CX_CRM_MKTPL_EAI_FAILEDIs raised when the planning data could not be retrieved or
 the calendar unit requested by the external application does
 not correspond to the time dimension used in the planning profile

________________________________________________________________________

GET_PRODDIM_GUID_FROM_PLANDATA

Private CRM_MKTGS_GUID GET_PRODDIM_GUID_FROM_PLANDATA(

IMPORTINGCRMS_MKTPL_EAI_PLAN_DATA IS_PLAN_DATA
CGPL_GUID16 IV_TRADE_PROMOTION_GUID

)

This methods looks up the product dimension assignment guid from the actual product dimension guid in the input structure.
This guid is required to create tradespend exceptions since the product dimension assignment guid is different from the
actual product guid that is used by master data. This method will return the trade promotion specific guid.

Returns

s RV_PROD_DIM_GUID The product assignment guid specific to the trade promotion.

Parameters

- IS_PLAN_DATAA structure containing the product dimension guids.
- IV_TRADE_PROMOTION_GUIDThe guid of the trade promotion.

________________________________________________________________________

GET_PRODDIM_POS_IN_PLANNING

Private CRMPL_Y_SEQNO GET_PRODDIM_POS_IN_PLANNING(

IMPORTINGCRMS_MKTPL_EAI_PLAN_DATA IS_KPI_DATA
GTY_CHARACTERISTIC_POS_TAB IT_CHARACTERISTIC_POSITIONS

)

This method retrieves the position of a product dimension in the current planning data.
The position is associated to a set a characteristics in the planning data. The characteristics
contains the fields for product GUID, category GUID and product group ID.
There may be a category GUID and a product GUID in the same set of characteristics. In this case
The position for the category is the one associated to the set of characteristics that is for
the category GUID and an empty product GUID.
The same applies for product group ID and product GUID.

Returns

RV_POS Position for the product dimension in the planning data

Parameters

- IS_KPI_DATAThis structure contains the product dimension
 (product GUID or category GUID or product group ID)
- IT_CHARACTERISTIC_POSITIONSPositions for characteristics

________________________________________________________________________

GET_TRADE_PROMOTION_DATA

Private GET_TRADE_PROMOTION_DATA(

IMPORTINGCRM_MKTGS_GUID IV_TRADE_PROMOTION_GUID
EXPORTINGCRMT_MKTPL_EAI_TS ET_TRADE_SPENDS
CRM_MKTPL_MKTELEMENT ES_HEADER_ATTRIBUTES

)

This method gets needed data of a trade promotion.

Parameters

- IV_TRADE_PROMOTION_GUIDGUID of the trade promotion
- ET_TRADE_SPENDSTrade promotion's Trade Spends
- ES_HEADER_ATTRIBUTESTrade promotion's header attributes

Exceptions

- CX_CRM_MKTPL_EAI_FAILEDIs raised when the trade promotion data could not be read

________________________________________________________________________

INSERT_KEY_FIGURE_DATA

Private INSERT_KEY_FIGURE_DATA(

IMPORTINGCRMS_MKTPL_EAI_PLAN_DATA IS_PROD_DIM_PLAN_DATA
CRMT_MKTPL_EAI_PLANNING IT_EAI_PROD_DIM_PLANNING
CHANGINGCRMT_MKTPL_SORTD_EAI_PLAN_DATA CT_SORTED_PLAN_DATA

)

This method loops through the EAI input planning data for a specific product dimension
and insert content to a sorted table.

Parameters

- IS_PROD_DIM_PLAN_DATAThis structure contains the product dimension data (ID and key)
 The product dimension key is either a product GUID,
 a category GUID or a product group ID
- IT_EAI_PROD_DIM_PLANNINGKey figures associated to BI periods for the product dimension
- CT_SORTED_PLAN_DATAResult table, sorted by key figure name, product dimension key, and BI period

Exceptions

- CX_CRM_MKTPL_EAI_FAILEDIs raised when there is a duplicate key

________________________________________________________________________

IS_KEY_FIGURE_MAPPED_TO_TSPEND

Private ABAP_BOOL IS_KEY_FIGURE_MAPPED_TO_TSPEND(

IMPORTINGCRM_KPI_Y_IOBJNM IV_KEY_FIGURE_NAME

)

This method determines if the key figure should be handled by a trade spend.
A key figure should be handled by a trade spend when it is associated to a trade spend combination
in the IMG customizing. All key figures that should be handled by trade spends were stored in a
sorted table by the constructor method.

Returns

s RV_IS_MAPPED_TO_TSPEND Is true when the key figure should be handled by a trade spend

Parameters

- IV_KEY_FIGURE_NAMEKey figure name, to check if it should be handled by a trade spend

________________________________________________________________________

PREPARE_FOR_KPI_UPDATE

Private CRMPL_T_RAWDATA_SET PREPARE_FOR_KPI_UPDATE(

IMPORTINGCRMT_MKTPL_KPI_TIMELINE IT_BI_PERIODS
CRMT_MKTPL_KPI_PLAN_DATA IT_CURRENT_KPI_DATA
GTY_SORTED_KEY_FIGURE_CATALOG IT_KEY_FIGURE_CATALOG
CRMT_MKTPL_EAI_PLAN_DATA IT_KPI_DATA
CGPL_UPC_Y_PROFILE IV_PLANNING_PROFILE

)

This method converts the planning data from working table to the format expected by the KPI_UPDATE API.
The KPI_UPDATE API does not expect a product or category GUID, or a product group ID, to know which
row is to be updated. An entry of its input table contains a position, a BI period, a key figure name
and key figure value. For each of our product, product category or product group for which planning
data is to be updated, we have to find in the existing planning data which position is associated to
their product GUID, category GUID or product group ID.

Returns

RT_KPI_UPDATE Planning data in the format for KPI_UPDATE

Parameters

- IT_BI_PERIODSBI periods
- IT_CURRENT_KPI_DATAPlanning data before the update
- IT_KEY_FIGURE_CATALOGKey Figures (columns in the planning layout), sorted by key figure names
- IT_KPI_DATAPlanning data to update
- IV_PLANNING_PROFILEPlanning profile to update

Exceptions

- CX_CRM_MKTPL_EAI_FAILEDIs raised when the planning data is not valid

________________________________________________________________________

PROCESS_KPI_DATA

Private PROCESS_KPI_DATA(

IMPORTINGCRM_MKTGS_GUID IV_TRADE_PROMOTION_GUID
CGPL_UPC_Y_PROFILE IV_PLANNING_PROFILE
CRMT_MKTPL_EAI_PLAN_DATA IT_KPI_DATA
GTY_SORTED_KEY_FIGURE_CATALOG IT_KEY_FIGURE_CATALOG
CRMT_MKTPL_KPI_PLAN_DATA IT_CURRENT_KPI_DATA
CRMT_MKTPL_KPI_TIMELINE IT_BI_PERIODS

)

This method updates the planning data by calling the KPI_UPDATE API.

Parameters

- IV_TRADE_PROMOTION_GUIDGUID of the trade promotion to update
- IV_PLANNING_PROFILEPlanning profile to update
- IT_KPI_DATAPlanning data to update
- IT_KEY_FIGURE_CATALOGKey Figures (columns in the planning layout), sorted by key figure names
- IT_CURRENT_KPI_DATAPlanning data before the update
- IT_BI_PERIODSBI periods

Exceptions

- CX_CRM_MKTPL_EAI_FAILEDIs raised when the planning data could not be updated

________________________________________________________________________

PROCESS_POTENTIAL_EXCEPTIONS

Private PROCESS_POTENTIAL_EXCEPTIONS(

IMPORTINGCRMT_MKTPL_KPI_TIMELINE IT_BI_PERIODS
CRMT_MKTPL_SORTD_EAI_PLAN_DATA IT_TRADESPEND_EXCEPTIONS
CRMT_MKTPL_EAI_TS IT_TRADE_SPENDS
ABAP_BOOL IV_IS_PROMOTION_CHANGE
CGPL_GUID16 IV_TRADE_PROMOTION_GUID

)

This method updates, deletes, or creates tradespends / exceptions based on the input table provided.

Parameters

- IT_BI_PERIODSThis is the table containing all the BI periods
- IT_TRADESPEND_EXCEPTIONSThis is the table containing planning data
- IT_TRADE_SPENDS This is the table containing the trade spends
- IV_IS_PROMOTION_CHANGEIf true, we are changing an existing trade promotion
 If false, we are creating a new trade promotion
- IV_TRADE_PROMOTION_GUIDGUID of the trade promotion to update

Exceptions

- CX_CRM_MKTPL_EAI_FAILEDIs raised when a keyfigure does not correspond to
 an existing tradespend or a valid BI period, or
 a trade spend or trade spend exception could not be updated

________________________________________________________________________

REORGANIZE_PCAT_PLANNING_DATA

Private REORGANIZE_PCAT_PLANNING_DATA(

IMPORTINGCRMT_MKTPL_EAI_TPM_PCAT IT_PRODUCT_CATEGORIES
CHANGINGCRMT_MKTPL_SORTD_EAI_PLAN_DATA CT_EAI_KEY_FIGURES

)

This method re-organize the planning data from product categories EAI input to a sorted table.

Parameters

- IT_PRODUCT_CATEGORIESProduct categories with their planning data to update
- CT_EAI_KEY_FIGURESPlanning data sorted by key figure name,
 product dimension and BI period

Exceptions

- CX_CRM_MKTPL_EAI_FAILEDIs raised when the planning data could not be re-organized

________________________________________________________________________

REORGANIZE_PGRP_PLANNING_DATA

Private REORGANIZE_PGRP_PLANNING_DATA(

IMPORTINGCRMT_MKTPL_EAI_TPM_PGRP IT_PRODUCT_GROUPS
CHANGINGCRMT_MKTPL_SORTD_EAI_PLAN_DATA CT_EAI_KEY_FIGURES

)

This method re-organize the planning data from product groups EAI input to a sorted table.

Parameters

- IT_PRODUCT_GROUPSProduct groups with their planning data to update
- CT_EAI_KEY_FIGURESPlanning data sorted by key figure name,
 product dimension and BI period

Exceptions

- CX_CRM_MKTPL_EAI_FAILEDIs raised when the planning data could not be re-organized

________________________________________________________________________

REORGANIZE_PLANNING_DATA

Private CRMT_MKTPL_SORTD_EAI_PLAN_DATA REORGANIZE_PLANNING_DATA(

IMPORTINGCRMT_MKTPL_EAI_TPM_PRODUCTS IT_PRODUCTS
CRMT_MKTPL_EAI_TPM_PCAT IT_PRODUCT_CATEGORIES
CRMT_MKTPL_EAI_TPM_PGRP IT_PRODUCT_GROUPS

)

This method re-organize the planning data from EAI input to a sorted table.

Returns

RT_EAI_KEY_FIGURES Planning data sorted by key figure name,
product dimension and BI period

Parameters

- IT_PRODUCTSProducts with their planning data to update
- IT_PRODUCT_CATEGORIESProduct categories with their planning data to update
- IT_PRODUCT_GROUPSProduct groups with their planning data to update

Exceptions

- CX_CRM_MKTPL_EAI_FAILEDIs raised when the planning data could not be re-organized

________________________________________________________________________

REORGANIZE_PROD_PLANNING_DATA

Private REORGANIZE_PROD_PLANNING_DATA(

IMPORTINGCRMT_MKTPL_EAI_TPM_PRODUCTS IT_PRODUCTS
CHANGINGCRMT_MKTPL_SORTD_EAI_PLAN_DATA CT_EAI_KEY_FIGURES

)

This method re-organize the planning data from products EAI input to a sorted table.

Parameters

- IT_PRODUCTSProducts with their planning data to update
- CT_EAI_KEY_FIGURESPlanning data sorted by key figure name,
 product dimension and BI period

Exceptions

- CX_CRM_MKTPL_EAI_FAILEDIs raised when the planning data could not be re-organized

________________________________________________________________________

SPLIT_EAI_PLANNING_DATA

Private SPLIT_EAI_PLANNING_DATA(

IMPORTINGCRMT_MKTPL_SORTD_EAI_PLAN_DATA IT_EAI_KEY_FIGURES
CRM_MKTGS_RATES_ORIGIN IV_RATES_ORIGIN
CRM_MKTGS_GUID IV_TRADE_PROMOTION_GUID
CRM_MKTPL_VOLUME_MAINTENANCE IV_VOLUME_ORIGIN
EXPORTINGCRMT_MKTPL_EAI_PLAN_DATA ET_KPI_DATA
CRMT_MKTPL_SORTD_EAI_PLAN_DATA ET_POTENTIAL_EXCEPTIONS
CRMT_MKTPL_SORTD_EAI_PLAN_DATA ET_VOLUMES

)

This method splits the EAI planning data into three tables, as they will be processed differently

Parameters

- IT_EAI_KEY_FIGURESAll the planning data from the EAI input
- IV_RATES_ORIGINThis tells if trade spend exceptions are handled
 (only when the rates origin is CRM)
- IV_TRADE_PROMOTION_GUIDGUID of the trade promotion
- IV_VOLUME_ORIGINThis tells if the volume is from product dimensions
 (only when the volume origin is CRM)
- ET_KPI_DATAData to be updated by the planning services (this is a standard table)
- ET_POTENTIAL_EXCEPTIONSData to update/create trade spends and trade spend exceptions
 (this is a sorted table, by key figure name, product dimension and BI period)
- ET_VOLUMESVolume data to update in the prod/pcat/pgrp assignments (same kind of sorted table)

________________________________________________________________________

UPDATE_PLANNING_DATA

Public UPDATE_PLANNING_DATA(

IMPORTINGCRMT_MKTPL_EAI_TPM_PRODUCTS IT_PRODUCTS
CRMT_MKTPL_EAI_TPM_PCAT IT_PRODUCT_CATEGORIES
CRMT_MKTPL_EAI_TPM_PGRP IT_PRODUCT_GROUPS
CRM_MKTPL_CALENDAR_UNIT_CODE IV_CALENDAR_UNIT
ABAP_BOOL IV_IS_PROMOTION_CHANGE
CRM_MKTGS_GUID IV_TRADE_PROMOTION_GUID

)

This method updates the planning data of a trade promotion.

Parameters

- IT_PRODUCTSProducts with their planning data to update
- IT_PRODUCT_CATEGORIESProduct categories with their planning data to update
- IT_PRODUCT_GROUPSProduct groups with their planning data to update
- IV_CALENDAR_UNITTime dimension of the planning data (for example by week, by month)
- IV_IS_PROMOTION_CHANGEIf true, we are changing an existing trade promotion
 If false, we are creating a new trade promotion
- IV_TRADE_PROMOTION_GUIDGUID of the trade promotion to update

Exceptions

- CX_CRM_MKTPL_EAI_FAILEDIs raised when the planning data could not be updated

________________________________________________________________________

UPDATE_TRADE_SPENDS

Private UPDATE_TRADE_SPENDS(

IMPORTINGCRMT_MKTPL_EAI_TS IT_TRADE_SPENDS
ABAP_BOOL IV_IS_PROMOTION_CHANGE
CGPL_GUID16 IV_TRADE_PROMOTION_GUID
CHANGINGCRMT_MKTPL_SORTD_EAI_PLAN_DATA CT_TRADESPEND_EXCEPTIONS

)

This method updates tradespends in the trade promotion, or marks the entries the table CT_TRADESPEND_EXCEPTIONS as potential
exceptions. This method will decide wheter it is more optimal that a tradespend be updated with a new value or exceptions be
created.

Parameters

- IT_TRADE_SPENDS This is the table of tradespends
- IV_IS_PROMOTION_CHANGEThis flag indicated whether or not planning is being updated from the create or change service
- IV_TRADE_PROMOTION_GUIDThis is trade promotion guid
- CT_TRADESPEND_EXCEPTIONSThis is the table of planning data that will be updated with flags to indicate exceptions

Exceptions

- CX_CRM_MKTPL_EAI_FAILEDIs raised when a trade spend could not be updated

________________________________________________________________________

UPDATE_TRADE_SPEND_EXCEPTIONS

Private UPDATE_TRADE_SPEND_EXCEPTIONS(

IMPORTINGCRMT_MKTPL_SORTD_EAI_PLAN_DATA IT_TRADESPEND_EXCEPTIONS
CRMT_MKTPL_EAI_TS IT_TRADE_SPENDS
CGPL_GUID16 IV_TRADE_PROMOTION_GUID

)

This method updates, deletes, or creates tradespend exceptions based on the input table provided.

Parameters

- IT_TRADESPEND_EXCEPTIONSThis is the table of potential tradespend exceptions
- IT_TRADE_SPENDS This is the table of trade spends present in the promotion
- IV_TRADE_PROMOTION_GUIDThis is the marketing project guid.

Exceptions

- CX_CRM_MKTPL_EAI_FAILEDIs raised when a trade spend exception could not be updated

________________________________________________________________________

UPDATE_VOLUMES

Private UPDATE_VOLUMES(

IMPORTINGCRMT_MKTPL_SORTD_EAI_PLAN_DATA IT_VOLUMES
CRM_MKTGS_GUID IV_TRADE_PROMOTION_GUID

)

This method updates the volume field in the product dimensions.

Parameters

- IT_VOLUMESVolume per product dimensions and periods. This table is sorted by key figure name
 and product dimension. As only one key figure name is possible for volume, in this
 method we can consider the table is sorted by product dimension.
- IV_TRADE_PROMOTION_GUIDGUID of the trade promotion

________________________________________________________________________

VALIDATE_CALENDAR_UNIT

Private VALIDATE_CALENDAR_UNIT(

IMPORTINGCRM_MKTPL_CALENDAR_UNIT_CODE IV_CALENDAR_UNIT
CGPL_SEM_PLGRP IV_PLANGROUP
CRM_KPI_Y_IOBJNM IV_TIME_INFO_OBJECT

)

This method retrieves the planning data from the master planning layout

Parameters

- IV_CALENDAR_UNITTime dimension of the planning data (for example by week, by month)
- IV_PLANGROUPPlanning profile group assigned to the trade promotion
- IV_TIME_INFO_OBJECTInfo Object for the time characteristic in the planning layout
 For example 0CALWEEK for Calendar Week, 0CALMONTH for Calendar Month...

Exceptions

- CX_CRM_MKTPL_EAI_FAILEDIs raised when the calendar unit requested by the external application
 is invalid or does not correspond to the time dimension
 used in the planning profile

________________________________________________________________________

VALIDATE_KPI_DATA

Private VALIDATE_KPI_DATA(

IMPORTINGCRMPL_S_RAWDATA_SET IS_KPI_UPDATE
CRMT_MKTPL_KPI_TIMELINE IT_BI_PERIODS
GTY_SORTED_KEY_FIGURE_CATALOG IT_KEY_FIGURE_CATALOG
CGPL_UPC_Y_PROFILE IV_PLANNING_PROFILE
CRM_MKTGS_PROD_DIM_ID IV_PROD_DIM_ID

)

This method validates the position, BI period and key figure name of data to update using API KPI_UPDATE

Parameters

- IS_KPI_UPDATEEntry of KPI planning data
- IT_BI_PERIODSBI periods
- IT_KEY_FIGURE_CATALOGKey Figures (columns in the planning layout), sorted by key figure names
- IV_PLANNING_PROFILEPlanning profile to update
- IV_PROD_DIM_IDID of the product dimension that is processed

Exceptions

- CX_CRM_MKTPL_EAI_FAILEDIs raised when the data is invalid



PERFORM Short Reference   TXBHW - Original Tax Base Amount in Local Currency  
This documentation is copyright by SAP AG.


Length: 53132 Date: 20120526 Time: 113305     triton ( 308 ms )