SAP for Retail Blogs
Gain insights and practical tips to captivate customers, optimize your supply chain, and drive growth with SAP for Retail software. Share your own insights!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

Problem statement

Many times, retailers will generate offers in Promotion Management for Retail (PMR) that are 6-8 weeks or longer before they are active in stores.  In this time period, there are changes that occur constantly with prices, what products will be on promotion, which locations are participating, and possibly new competitors that move into the market. These factors along with many others change your forecast.

To get an updated look on the impact of the promotion, or quantities expected to sell by product/location/day, it is a best practice to reforecast offers within 2 weeks of when they will be active in order to adjust your quantities based on these changes.

In this Customer Activity Repository (CAR) tip in a minute we will look at how you reforecast offers in an automated way in order to update your forecast to adjust to different factors.

Prerequisites

  • You have fully installed and implemented the following modules in SAP CAR:
    • Unified Demand Forecast modeling and forecasting (UDF)
    • Demand Data Foundation (DDF) required data layer
  • You must be on RTLDDF 100 SP6 or RTLDDF 200 SP2, otherwise apply SAP Note 210763.
  • You have the authorization to run transaction SPRO in your CAR system
  • You have authorization to run transaction SE38 in your CAR system.
  • You have fully installed and implemented SAP PMR.
  • You have PMR offers you wish to forecast.

Create the program

1. Logon to your SAP server using SAP logon

2. Go to transaction SE38 and enter a name for the program you are about to create

3. Select the create button

4. Copy and paste the code below into your own program (just below the line with the REPORT keyword)

Note: Only version offers can be entered. Leading offers are not supported. Also, this code only works for recommended offers. If it is anything else then the results will not be saved.


*&---------------------------------------------------------------------*
*& Takes external offer ids
*& Looks up the internal Offer ids
*& Loads the Offer
*& Calls the What-if forecast on the offer
*&---------------------------------------------------------------------*

TABLES: sscrfields,
/dmf/ext_offer_id_sty
.

SELECTION-SCREEN BEGIN OF BLOCK content WITH FRAME.

PARAMETERS sysid TYPE /dmf/log_sys_sty-log_sys_id.
SELECT-OPTIONS offer_id FOR /dmf/ext_offer_id_sty-ext_ofr_id NO INTERVALS.

SELECTION-SCREEN END OF BLOCK content.

*&---------------------------------------------------------------------*
*&   Event INITIALIZATION
*&---------------------------------------------------------------------*
INITIALIZATION.

DATA lt_offers TYPE /dmf/ext_offer_id_tty.
DATA ls_offers LIKE LINE OF lt_offers.
DATA ls_offer_id like line of offer_id.

DATA lt_offer_ext TYPE /dmf/ofr_ext_xr_tty.
DATA ls_offer_ext LIKE LINE OF lt_offer_ext.

DATA: lt_ofr TYPE /dmf/ofr_id_tty.
DATA: ls_ofr LIKE LINE OF lt_ofr.

*&---------------------------------------------------------------------*
*&   Event AT SELECTION-SCREEN ON BLOCK content
*&---------------------------------------------------------------------*
AT SELECTION-SCREEN ON BLOCK content.


*&---------------------------------------------------------------------*
*&   Event AT SELECTION-SCREEN OUTPUT
*&---------------------------------------------------------------------*
AT SELECTION-SCREEN OUTPUT.
* this is equivalent to the PBO of the selection screens

*&---------------------------------------------------------------------*
*&   Event AT SELECTION-SCREEN
*&---------------------------------------------------------------------*
AT SELECTION-SCREEN.
* this is equivalent to the PAI of the selection screens
* activated upon F8 or ENTER on the selection-screen.
* if F8, then it will go on to START-OF-SELECTION
* if ENTER then it will return to the selection screen (ok_code is blank first time through only).

*&---------------------------------------------------------------------*
*&   Event START-OF-SELECTION
*&---------------------------------------------------------------------*
START-OF-SELECTION.
* F8 has already occurred and mandatory fields verified, data is in parameters already.
* main processing

IF sysid IS INITIAL.
WRITE: 'Failure, logical system is required'.
EXIT.
ENDIF.


" copy input offers into lt_offers

IF offer_id is INITIAL.
WRITE: 'Offers are required'.
EXIT.
ENDIF.

LOOP AT offer_id INTO ls_offer_id.
ls_offers
-ext_ofr_id = ls_offer_id-low.
INSERT ls_offers INTO TABLE lt_offers.
ENDLOOP.

"look up the internal offer ids
TRY.
CALL METHOD /dmf/cl_offer_int=>find_by_ext_id
EXPORTING
iv_log_sys     
= sysid
it_ext_offer_id
= lt_offers
RECEIVING
rt_ext_int_id  
= lt_offer_ext.
CATCH /dmf/cx_offer .
WRITE: 'Cannot convert offer ids'.
ENDTRY.

"copy only the internal ids to input table
LOOP AT lt_offer_ext INTO ls_offer_ext.
ls_ofr
-ofr_id = ls_offer_ext-ofr_id.
INSERT ls_ofr INTO TABLE lt_ofr.
ENDLOOP.

IF lt_ofr is initial.
WRITE:'Cannot find any internal offer ids.  Cannot forecast'.
EXIT.
ENDIF.

TRY.
/dmf/cl_offer_int_svc
=>force_financial_refresh(
it_offer_id
= lt_ofr
iv_forecast
= 'X' ).
CATCH /dmf/cx_offer .
WRITE: 'Cannot forecast offer_ids'.
ENDTRY.

Write : 'Report completed'.
END-OF-SELECTION.


5. Save and activate the program



Run / Test the program

Since there is a possibility of error in the report creation or in the data that you enter, we advise to first run a test in foreground. This will return a small batch that clarifies that everything is working as it should and gives you a better understanding of the variant fields.

1. From transaction code SE38

2. Enter the program name that you made in previous steps

3. Use the execute button at the top.

4. Fill in the SYSID and the OFFER_ID boxes

5. Use the execute button to run the test in the foreground

Changing the number of offers

Running a large number of offers could tax the system resources.  To help with parallelizing, you can control the number of financial records, and therefore forecasts, that are included in each batch.  To edit this in the system:

1. Execute transaction SPRO

2. Click on SAP reference IMG

3. Navigate to Cross-Application Components -> Demand Data Foundation -> Data Maintenance -> Offer -> click execute on Specify Parameters for Offer Financials

4. Enter in the number of records, then save and exit

Run the program in the background

Now that you have successfully tested the report and changed your batch size, you can now run the program in the background across a large number of offers.

1. Execute transaction SE38 and find the report that you created in the steps above. 

2. Select the execute button

3. Fill in the SYSID and the OFFER_ID boxes

4. Select Program -> Execute in Background

5. Hit green check

6. Select immediate

7. Save

Review the log

Reviewing the log will show you the results of you running the report in the background. The log will either display the error that was encountered or the message ‘Report Complete’. Note that this may take time to show depending on the number of financial records that you entered in previous steps.

1. Go to the system drop down at the top

2. Select own jobs

3. Double click the spool of the job name (In this case our job name was ZWHATIF_FORECAST_BACKGROUND. Your JobName will reflect the report that you created earlier)

4. Select type

5. The results of the report are shown

Displaying the Results

As these offers were likely originally created in PMR, you can see the results best in this interface.

To review your results:

1. Open NWBC

2. Go to the Promotion Planning Tab

3. Go to Offer Schedule tab

4. Open up Show Quick Criteria Maintenence

5. Search for the offer you want to verify results for

6. Open the offer

7. See the forecast results for the total offer and for the lower level product locations

Total Offer

Lower Level product locations

Note: An empty or 0 value in the columns means that there was no forecast. Also the offer must be a recommended offer for this to have worked.