Sei sulla pagina 1di 157

CONSUMING SAP HANA PREDICTIVE FUNCTIONS WITH SAP BUSINESS PLANNING AND CONSOLIDATION

EA161
Exercises / Solutions Derek Johnson Zane Connally Sheldon Edelstein

Getting started with your session


Login credentials and group numbers can be found in the My Reservation tab on the SAP TechEd Virtual Hands -On Workshops website (https://saptechedhandson.sap.com/). Important: Some of the sessions use place holders for users (e.g. CD300_XX) or objects (e.g. ZCD400_Exercise_##). The place holders XX or ## must be replaced with your assigned group number, which you find in the My Reservation tab on the above mentioned website.

DECEMBER 2013

BEFORE YOU START THIS WORSKSHOP FOCUSES ON DEMONSTRATING THE INTEGRATION CAPABILITIES OF BPC, BW, HANA, AND PREDICTIVE ANALYSIS. THERE ARE THREE EXERCISE GROUPS AVAILBLE IN THIS WORKSHOP:
Exercise Group
1. Prediction with the Predictive Analysis standalone toolkit using flat file export from BPC 2. Prediction with the Predictive Analysis standalone toolkit using the built in HANA reader/writer 3. Prediction with a Dashboard UI imbedded in a BPC workspace, using the integrated PAL library within HANA (fully integrated scenario for BPC-BWBI-HANA)

Estimated Duration
20 minutes

45 minutes

40 minutes

Exercise Group 1 is focused on exploring a simple but quick approach to use SAP Predictive Analysis with BPC data. The integration is limited to a flat file extract and import, but generates powerful forecast projections for use with BPC. Exercise Group 2 highlights the direct integration between BPC, Predictive Analysis and HANA. The exercises shows how BPC data is transformed by SAP Predictive Analysis and data directly accessed from within the HANA tables storing BPC information. Exercise Group 3 showcases the integration of BPC, BW, BI, HANA, and the HANA PAL (Predictive Analytics Library). If you only have limited time to invest in this workshop, be sure to run through this exercise group first to understand the potentials of the big integration story!

Technical Preparation: To increase the performance of the virtualized image, you can shut down the SAP NetWeaver system which is running in parallel to other servers on the same virtualized image: Explanation Screenshot

Choose Start All Programs SAP Tools [TDI].

Select Stop SAP NetWeaver 7.4 to execute it. This increases the amount of memory.

EXERCISE GROUP 1: THIS GROUP OF EXERCISES FOCUSES ON ACHIEVING PREDICTION RESULTS WITH THE SAP PREDICTIVE ANALYSIS STANDALONE TOOLKIT USING FLAT FILE EXPORT FROM BPC

Exercise
1.1 VERIFY SYSTEM ACCESS 1.2 CREATING A FLATFILE FOR SAP PREDICTIVE ANALYSIS USING SAP BUSINESS PLANNING AND CONSOLIDATIONS 1.3 USING SAP PREDICTIVE ANALYSIS TO PREDICT REVENUE FROM A FLAT FILE

Estimated Duration
5 minutes 10 minutes

15 minutes

EXERCISE 1.1 VERIFY SYSTEM ACCESS

Estimated time: 5 minutes Objective In this exercise, you will verify that you will have access to the various solutions that will be used within the exercises. It is important to note that each student will be given a user ID and password on the web page, which will be used for all the exercises. It is critical that each student use their assigned user ID when accessing systems so that they do not affect other students exercises. Exercise Description For the days exercise, the user will need to access the following systems:: SAP Predictive Analysis SAP Business Planning and Consolidation SAP HANA Studio

EXERCISE 1.1 SOLUTION

Explanation
1) Locate desktop icon for SAP Predictive Analysis and open this link. 2) Alternative Approach: Start All Programs SAP SAP Business Intelligence SAP Predictive Analysis

Screenshot

3) Once you have verified that you are running SAP Predictive Analysis, you will need to exit the program FileExit

4) Locate desktop icon for SAP HANA Studio 5) Alternative Approach: Start All Programs SAP HANA SAP HANA Studio

For the virtual Hands-on workshops the user and password is unique and was changed before you get access to the system. Therefore the password of the secure store needs to be recovered/unlocked.

You need to recover the password first. Choose Window->Preferences

Then open General -> Security -> Secure Storage

Click on Recover Password

Answer the questions Question 1: 1972 Question 2: Hoffenheim And click OK.

And click OK.

And click OK.

Unlock the Secure Store by clicking on Unlock. Now you can continue with the exercises.

6) Once you have verified that you are running SAP HANA Studio, you will need to leave this application open. 7) User can minimize the system while working with other solution components

8) Verify access to BPC by opening Internet Explorer using the link on your remote desktop

9) Follow the path: Favorites > EA161 > Web Logon BPC

10) You will now need to enter the user ID and password to access the SAP Business Planning and Consolidation System. 11) After entering the user ID and password, press the Logon button User ID should be EA161_XX where XX has been assigned to you at the web page. Password: Welcome!

12) Once you have verified that you are running SAP Business Planning and Consolidations, you will need to validate that you are looking at the right model and will then exit the program

10

Optional: Only if Environment is not correct from previous step 13) At the bottom right corner, make sure you are connected to the EA161 environment. 14) If you not connected to the correct environment, double click the environments name and set it to EA161. Click the Connect button to change the model. 15) If the environment was changed in this step, please re-validate Step 7

16) Verify that your user ID has Favorites Assigned to your user. 17) Workspace favorite will be called EA161_XX BPC Predictive Forecasting, where EA161_XX is your user id 18) Dashboard favorite will be called EA161_Sales_Revenue_Da shboard_EA161_XX, where EA161_XX is your user id

11

19) Select Workspace favorite EA161_XX BPC Predictive Forecasting

20) Verify that your UserID is set for your Workspace 21) Select the report Customer to Entity Assignment

22) Validate that the report brings back only one record data 23) User should keep the Workspace open as this will the starting point for our next exercise Please note that the totals for each user are different. This means that each user will be working with a slightly different set of data in the subsequent exercises Please check if you see multiple rows or no data at all. This verification step is most critical when we are writing data back to BPC via an input schedule

12

EXERCISE 1.2 CREATING A FLATFILE FOR SAP PREDICTIVE ANALYSIS USING SAP BUSINESS PLANNING AND CONSOLIDATIONS
Estimated time: 15 minutes Objective In this exercise, we will be playing the role of a customer relationship manager responsible for managing the sales revenue forecast at a particular customer. For convenience, each workshop participant will manage a customer with the same name as their logon ID. Please note that every customer will have their own unique set of actual/forecast data so the screenshots may not match the scenario for your customer. In this exercise, we will be preparing a file that will be uploaded into SAP Predictive Analysis that could be used to predict sales revenue forecast based on data contained within the SAP Business Planning and Consolidation solution. The approach that we will be using for this exercise is especially relevant to customers that have not yet deployed SAP HANA as their underlying database for their planning systems or customers wanting to quickly create a simple scenario to explore their data using a highly visual tool like SAP Predictive Analytics. Users completing this exercise will have a CSV file that will be generated from the SAP Business Planning and Consolidation web client. This file will be used in Exercise 2 to further explore Predictive Analysis using several time based forecasting methods. Exercise Description For this exercise, we will be performing the following activities Building a web report and input schedule in SAP Business Planning and Consolidations Manually downloading data into a CSV file that will be uploaded into SAP Predictive Analysis in a later exercise

13

EXERCISE 1.2 SOLUTION

Explanation
Optional: if BPC was closed in previous section, perform steps 1-4 1) Verify access to BPC by opening Internet Explorer using the link on your remote desktop 2) Follow the path: Favorites > EA161 > Web Logon BPC

Screenshot

Optional 3) You will now need to enter the user ID and password to access the SAP Business Planning and Consolidation System 4) After entering the user ID and password, press the Logon button Single sign-on was not setup for this system as would have been done by many of our customers Password: Welcome!

14

Optional 5) Select Workspace Favorite called EA161_XX BPC Predictive Forecasting

6) Select the report called 2. Sales Revenue Forecasting Accuracy In this first series of steps, we will be playing the role of a business analyst looking at how well we are forecasting our products for our customer in the current year The specific revenue numbers may vary for each customer so we are only looking at the general trend for the year

7) Review the report and notice that Spice Blends have the largest forecasting variance 8) We can expand the Spice Blends product line for this customer by selecting the button.

15

9) Review the report and notice individual products making up the Spice Blends have forecasting errors associated with them The specific revenue numbers may vary for each customer. We will be reviewing the Spice Blends product group in more detail as the exercise progresses

10) Select the Review Sales Revenue Forecast report

16

11) Reviewing the report, we see that forecast in yellow is fairly consistent over time. We also see that there is some seasonal trending with the sales revenue data, which is shown in green It looks like our forecasting efforts have ignored the seasonal trends shown for this product group

12) Select the Sales Revenue Actuals for SAP PA report

13) Review the report. 14) Select More and then Export to CSV Specific revenue numbers for the Spice Blends product group will vary by user We will use this report to manually download a .CSV file that we will use in SAP Predictive Analysis. This file will contain nearly three years of data for all products in the Spice Blends product group

17

15) Save the file on your Desktop and call it something like BPCXX Sales Revenue Actuals for BPC PA.csv, where BPCXX is your user ID 16) Press the Save button

17) Open the file from the desktop by double clicking the file name.

18

18) When the file is opened, it should look something like what is shown As each users data is slightly different, your values may differ from what is shown in the screenshot to the right .

19) Select the header record rows, which should be the first 12 rows, and then delete them by left clicking on the rows and selecting Delete In this step, we are formatting the flat file to make it easier to consume by SAP Predictive Analytics, which expects only one header record for a .CSV file.

19

20) This is what the file will look like after the header records are deleted

21) Save the document by selecting the Microsoft Icon and the Save As menu option

20

22) Save the document to your desktop and call the file BPC Sales Revenue.csv. Select CSV as the file format and then select the Save button

23) PressYes in popup box to acknowledge the limitations with the file formats selected and then continue to exit out of Microsoft Excel 24) Select the Microsoft symbol and then press the Exit Excel button 25) Since the file was saved in step 22, select the No button to re-save the file 26) Leave the BPC session open as we will need to update the sales revenue forecast after we have completed our activities in SAP Predictive Analysis

21

27) You have completed the exercise!

You are now able to: Create a web report and input schedule in SAP Business Planning and Consolidation Download a file in .CSV format and format it for importing into SAP Predictive Analysis

22

EXERCISE 1.3 USING SAP PREDICTIVE ANALYSIS TO PREDICT REVENUE FROM A FLAT FILE

Estimated time: 20 minutes Objective In this exercise, we will be using the flatfile prepared in the previous exercise to predict sales revenue based on historical data. Several predictive algorithms will be used to create simple models that could be used to forecast this information. After we have created several models, we will take the results from this effort and manually enter them into an SAP Business Planning and Consolidation web input template. Exercise Description For this exercise, we will be performing the following activities Importing a .CSV file into SAP Predictive Analysis Creating several models to predict sales revenue based on historical information Enter this prediction into an SAP Business Planning and Consolidation input schedule to update a forecast

23

EXERCISE 1.3 SOLUTION

Explanation
1) Locate desktop icon for SAP Predictive Analysis and open this link. 2) Alternative Approach: Start All Programs SAP Business Intelligence SAP Predictive Analysis 3) Select the New Document from the menu

Screenshot

4) Select CSV as a new data source

24

5) Select Desktop as the file location to search and then select the BPC Sales Revenue.CSV file 6) Then press the Select button

7) Select the date format as MMM.YYYY using the dropdown and then select the Acquire button

25

8) Review the acquired file to validate that the calendar symbol is connected with the time dimension. If this is not the case, you will need to re-import the file and remember to set the date format

9) Right click on the Time column and select Create a time hierarchy We will be using time series based forecasting methods in this exercise so it is helpful to create a time series for these prediction algorithms

26

10) Select the Predict button so that we can create some prediction models

11) In the main design area, we should see the symbol for the file we imported into the system. 12) Select the Data Preparation tab so we can continue to prepare the data within SAP Predictive Analysis

27

13) Review the elements under the Data Preparation tab Using these items, we can further enrich the data or filter on specific data regions, which we will be doing in the following steps

14) Drag and drop the Filter object from the Data Preparation tab into the main work area. The time series algorithms we will be using in our model will need to be filtered at the level we will be doing our forecast.

28

15) Select the Configure Properties after hovering over the filter object

16) Select Product as a row filter

29

17) Enter Steak Blend Hot as shown and then the OK button Another spice blend could have been chosen here as well. The filter is case sensitive

18) Press the Save and Close button to save the filter value and go back to the modeling area We could have used this filter to restrict columns or place more restrictions on other dimensions

30

19) To test the filter value, we will hover over the filter object and then select the Run button. 20) Select Yes to review the results

31

21) The results should look something similar to what is shown

22) After viewing the filtered information, select the Predict button to go back to the main modeling area

32

23) In the next series of steps, we will be adding a predictive algorithm to the model. As a first step, we need to select the Algorithms tab to see what algorithms are available to use in our models

24) From the Algorithms tab, select the R-Single Exponential Smoothing object and drag and drop it into the design area. This object will connect to the filter object once it has been released

33

25) Hover over the R-Single Exponential Smoothing Algorithm and select the Configure Properties item

26) Enter the values as shown in this screen 27) Select the Advanced Properties Tab In this step, we are telling the algorithm to look at the data since January 2011 as monthly values. We are also asking that the algorithm to extend the prediction by 3 months, which would be Q4.2013 where there is no current actual

34

28) Adjust the Alpha factor between 0-1 29) Press the Save and Close button after the Alpha factor has been set

30) Press the the model

button to run

35

31) Review the results and notice that we forecasted out three periods as we had defined in step 26 32) After the data is reviewed, we can see the results graphically by selecting the Charts button

33) Here you can graphically see the results of our Single Exponential Smoothing Algorithm 34) To view the model again, select the Predict button

36

35) Students are highly encouraged to adjust the alpha value in the mode to see how the output can affect the results. The adjustments to the Alpha factor are shown in step 2526 Single Exponential Smoothing (SES) Algorithm is a good model choice for forecasting data with minimal trend or seasonal patterns. Alpha is the data smoothing factor, 0 < alpha < 1, the larger alpha the greater the smoothing applied to the forecasted data.removes more the localized variations.

36) Hover over the R-Single Exponential Smoothing algorithm and then select the button to delete this algorithm from the model

37

37) Model once the R-Single Exponential Smoothing algorithm has been removed

38) This is what the model should look like after the RSingle Exponential Smoothing algorithm has been removed

39) Select the R-Triple Exponential Smoothing algorithm and drag and drop it into the modeling area

38

40) Hover over the R-Triple Exponential Smoothing algorithm and select the Configure Properties button

41) Enter the values as shown and then select the tab titled Enter Names for Newly Added Columns 42) Review the settings and then select the Advanced Properties tab

39

43)

44) Execute the model

45) Select Yes in the popup box to see the results

40

46) Review the results and then select the Charts button

47) Similar to the other two models, you can continue to adjust the model parameters by selectingthePredict button until you are happy with the results, which is highly recommended 48) Once you are happy with the results, select the Grid button to review the prediction

41

49) We will be either cutting and pasting the values from SAP Predictive Analysis solution or directly entering them into an input schedule within SAP Business Planning and Consolidation 50) Please do not exit out of SAP Predictive Analysis at this point

51) Re-open your BPC planning session 52) Open the input schedule called Home tab titled 5. Update Sales Revenue Forecast

42

53) Validate the user ID and the entity values are correct and adjust as necessary

54) Enter the new forecast values that were created using SAP Predictive Analysis. These values can either be cut and pasted into the input schedule or manually entered from step 50 55) Press the Save Data button once the new forecast has been entered A similar approach could be taken for the other products in the spice blends product group

56) Press the Yes button to save the results

43

57) Verify data that the new forecast values have been updated into the system 58) When this activity is done, you can log off the system by pressing the button

59) You have completed the exercise!

You are now able to: Import a file into SAP Predictive Analysis Create a simple sales revenue forecasting model and adjust parameters Update the sales revenue forecast based on the results of the predictive modeling Bonus: Configure your current model to use a Double Exponential Smoothing Algorithm

44

EXERCISE GROUP 2 THIS GROUP OF EXERCISES FOCUSES ON DEVELOPING PREDICTIONS WITH THE SAP PREDCITIVE ANALAYSIS STANDALONE TOOLKIT USING THE BUILT IN HANA READER/WRITER.
Exercise
2.1 Verify System Access 2.2 Using SAP Predictive Analytics Online HANA Reader with SAP Business Planning and Consolidations Powered by SAP HANA applying a data filter 2.3 Using SAP Predictive Analytics to sample data online 2.4 Using SAP Predictive Analytics to write data to HANA table 2.5 Using SAP Predictive Analytics Offline HANA Reader with SAP Business Planning and Consolidations Powered by SAP HANA converting BPC time to PA time and storing results back into HANA using the JDBC writer

Estimated Duration
5 minutes 10 minutes 10 minutes 10 minutes

20 minutes

EXERCISE 2.1 VERIFY SYSTEM ACCESS


This exercise may be skipped if already performed in previous exercise.
Estimated time: 5 minutes Objective In this exercise, you will verify that you will have access to the various solutions that will be used within the exercises. It is important to note that each student will be given a user ID and password at the web page, which will be used for all the exercises. It is critical that each student use their assigned user ID when accessing systems so that they do not affect other students exercises. Exercise Description For the days exercise, the user will need to access the following systems:: SAP Predictive Analysis SAP HANA Studio

46

EXERCISE 2.1 SOLUTION

Explanation
1) Locate desktop icon for SAP Predictive Analysis and open this link. 2) Alternative Approach: Start All Programs SAP SAP Business Intelligence SAP Predictive Analysis

Screenshot

3) Once you have verified that you are running SAP Predictive Analysis, you will need to leave this program open for the next exercise.

4) Locate desktop icon for SAP HANA Studio Alternative Approach: Start All Programs SAP HANA SAP HANA Studio

47

5) Check for TechEd 2013 System availability. If system does not appear on your selection screen, right click on the white space and select Add System

6) Enter HANA server information as shown

48

7) Enter assigned workshop user id (EA161_XX, where XX is your assign workshop user id) and password (to be provided during workshop)

8) Verify you can access the HANA Catalog folder

49

9) Once you have verified that you are running SAP HANA Studio, you will need to leave this application open.

10) You have completed the exercise.

You are now able to: Verify access to SAP Predictive Analysis Verify access to SAP HANA Studio

End of exercise.

50

EXERCISE 2.2 USING THE HANA READER OPTION IN SAP PREDICTIVE ANALYSIS - APPLYING A FILTER ON BPC DATA IN HANA
Estimated time: 20 minutes Objective In this exercise, we will be playing the role of a customer relationship manager responsible for managing the sales revenue forecast at a particular customer. For convenience, each workshop participant will manage a customer with the same name as their logon ID. Please note that every customer will have their own unique set of actual/forecast data so the screenshots may not match the scenario for your customer. In this exercise, we will be extracting data for a customer report that will reside in a dedicated HANA table. Users completing this exercise you will be able to understand how the HANA Reader in SAP Predictive Analysis may read data directly and how various filtering can be applied without the need for intermediate file creation. Exercise Description For this exercise, we will be performing the following activities Define a connection from SAP Predictive Analysis to a HANA table view containing BPC data. Define a simple filter to extract one customer View the output/results Modify the filter criteria to extract one customer for a specified year View the output/results

51

EXERCISE 2.2 SOLUTION


Define a connection from SAP Predictive Analysis to a HANA table containing BPC data

Explanation
1) Locate desktop icon for SAP Predictive Analysis and open this link. 2) Alternative Approach: Start All Programs SAP Business Intelligence SAP Predictive Analysis 3) Select the New Document from the menu

Screenshot

52

4) Select SAP HANA ONLINE as a new data source

5) Type in the HANA server and server instance. Select the Authenticate by database user option and enter your assigned HANA user Id (for example: EA161_01) and password Welcome1. Click on Connect SAP HANA Instance to return a list of available tables and views.

Cut and Paste: Server: dewdfti34002.wdf.sap.corp Instance: 01

53

6) Select the HANA system generated view of the BPC data set following the path: SAP>BW>CPMB>P9IOME V_INTERNAL The system designation of _INTERNAL is one of the outputs from a BW model import. In this case, the P9IOMEV_INTERNAL view is an imported model of the BW cube supporting the BPC model translated into pure HANA based tables. Important tip: Do not build connections or any other HANA structures directly on the tables directly supporting the BW objects themselves. These structures are designed to support these BW objects but do not have all functionality self-contained for seamless data access (such as roll up and aggregation functions).

7) Select the DESIGNER view and PREDICT mode to view the new data source created in your modeler.

54

8) Hover mouse pointer on new connection icon to view available options. Select Run till Here: to validate that PA can read from HANA

9) Is the read is successful you will see the following informational message, click on YES to view the read data.

10) The system changes its view to Results and a report containing the data extracted is displayed.

11) Return to Designer mode

12) Select the Data Preparation tab containing a collection of pre-delivered functions that may be applied

55

13) Drag and drop the Filter function into the workspace near the defined database connection icon. A connecting arrow should automatically appear, however if it does not you can connect the two processes by selecting the connector point on the data source, click and hold to extend a line to the Filter connection point and release your mouse button when completed.

14) Hover mouse pointer on Filter icon and access the Configure Properties option

56

15) We do not want to exclude any dimension in our extract so in our Column Filter add a check in the Select All/None control box. All columns will now be retained in the filters output.

57

16) We will filter the incoming data to extract one customer and one year in this demonstration. In the Row Filter section, find CUSTOMER and click on the name to open a filter definition box.

17) Select the Type for In List option and type in your assigned user id EA161_XX (were XX is your assigned workshop user number). Select the radio button keep only to retain filtered data in the output file. Click on OK to return to the filter definition window.

58

18) Note the addition of a filter definition for the USERID dimension

19) Save and Close the filter definition

20) Hover mouse pointer on Filter icon and access the Run Till Here option

59

21) View Results

22) Note the results contain only user ids selected

23) Return to the modeling worksheet by selecting Designer and Predict view options

60

24) Select one additional dimension to add to the filter select YEAR2 for only 2013

25) Save and Close the filter definition

61

26) Hover mouse pointer on Filter icon and access the Run Till Here option

27) Select Yes to view filtered results

28) Validate that the output has been filtered on the selected year and user id

62

29) Save Model by following menu path File>Save As

30) Enter model name in the pattern of READ_FILTER_EA161_XX (XX being your user id for the workshop)

End of exercise.

63

EXERCISE 2.3 USING SAP PREDICTIVE ANALYTICS TO SAMPLE DATA


Estimated time: 10 minutes Objective In this exercise, you will extend the model created in the previous exercise to include a sampling process that will pass through only the Nth largest values. It is important to note that each student will be given a user ID and password on the web page, which will be used for all the exercises. It is critical that each student use their assigned user ID when accessing systems so that they do not affect other students exercises.

Exercise Description For this exercise, the user will need to access the following systems:: SAP Predictive Analysis SAP HANA Studio

64

EXERCISE 2.3 SOLUTION

Explanation
1) Locate desktop icon for SAP Predictive Analysis and open this link. 2) Alternative Approach: Start All Programs SAP SAP Business Intelligence SAP Predictive Analysis

Screenshot

3) Once you have verified that you are running SAP Predictive Analysis, you will need to leave the program open for the next exercise.

65

4) Access the model from the previous exercise, double click on the model id to open

5) Enter User Id (of the form EA161_XX, where XX is your assigned workshop id number) and Password to allow PA to make a connection to the HANA database.

66

6) Select Designer and Predict view modes to view current model structure

7) Drag and drop the Sample process and allow system to create a logical connection to the previous structure

8) Hover mouse pointer on new connection icon to view available options. Select Configure Properties

67

9) Enter the following: Sampling Type: First N Limit Rows by: Number of Rows Number of Rows: 20 Minimum Rows : leave blank Save and Close

10) Execute the model from the Sample icon using the Run to Here option

11) Select YES to view the sampled data

68

12) Note that the data presented is filtered to one user id/year and is limited to the first N rows.

13) Save model, enter model name in the pattern of READ_FILTER_SAMPLE_ EA161_XX (XX being your user id for the workshop)

End of this exercise.

69

EXERCISE 2.4 USING SAP PREDICTIVE ANALYTICS TO WRITE DATA TO HANA TABLE
Estimated time: 10 minutes Objective In this exercise, you will use SAP Predictive Analytics to extract BPC data using the HANA reader, filter and sample the data, then write the results to a custom table in HANA. It is important to note that each student will be given a user ID and password on the web page, which will be used for all the exercises. It is critical that each student use their assigned user ID when accessing systems so that they do not affect other students exercises. Exercise Description For the days exercise, the user will need to access the following systems:: SAP Predictive Analysis SAP HANA Studio

70

EXERCISE 2.4 SOLUTION

Explanation
1) Locate desktop icon for SAP Predictive Analysis and open this link. 2) Alternative Approach: Start All Programs SAP Business Intelligence SAP Predictive Analysis

Screenshot

3) Once you have verified that you are running SAP Predictive Analysis, you will need to leave the program open for the next exercise.

4) Open the model saved in the previous exercise: READ_FILTER_SAMPLE_ EA161_XX. Double click on the item to open it.

71

5) Enter user id and password to open a connection to HANA and read the dataset

6) Drag and drop the HANA Writer process and allow the system to create a logical connection to the last process in your current model.

7) Hover mouse pointer on new connection icon to view available options. Select Configure Properties

72

8) Enter the following: Schema Name: EA161_XX Table Type: Column Store Table Name: EA161_XX_OUTPUT (XX corresponds to your assigned workshop user id) Check the box for Overwrite Table.

9) Hover mouse pointer on new connection icon to view available options. Select Run till Here 10) Click on YES to view what was written to HANA

11) View data

73

12) Save your final model using the name: READ_FILTER_SAMPLE_ WRITE_EA161_XX (XX is your workshop assigned user id) 13) Open your HANA Modeler 14) Follow the path: Folder Catalog Find your Schema (in the form of EA161_XX, XX is your workshop assigned id number) Find sub-folder named Tables. Locate your generated output table (in the form of EA161_XX_OUTPUT)

15) Right click to open the context menu for the EA161_XX_OUTPUT table, and select Open Content to view the records written back to HANA by the PA model.

74

16) Verify that these are the same records you viewed from the PA moldel output

17) Return to your PA model, READ_FILTER_SAMPLE_ WRITE_EA161_XX

75

18) Change the properties of the Sample as follows Save

19) Select Run Analysis

20) Select Yes to view new result set

21) Note the result set is now sampled to only five records

76

22) Return to HANA and refresh the view of the output table

Before refreshing:

23) Refresh the table view:

77

24) View table contents after refresh

End of exercise.

78

EXERCISE 2.5 USING SAP PREDICTIVE ANALYTICS OFFLINE HANA READER WITH SAP BUSINESS PLANNING AND CONSOLIDATIONS POWERED BY SAP HANA CONVERTING BPC TIME DIMENSION TO PA TIME CHARACTERISTIC AND STORING RESULTS USING JDBC WRITER BACK INTO HANA
Estimated time: 30 minutes Objective In this exercise, you will use SAP Predictive Analytics to extract BPC data using the HANA offline reader, filter and sample the data, translate BPC date fields to SAP PA calendar fields, execute a time series PA function, then write the results to a custom table in HANA. It is important to note that each student will be given a user ID and password at the web page, which will be used for all the exercises. It is critical that each student use their assigned user ID when accessing systems so that they do not affect other students exercises. Exercise Description For the days exercise, the user will need to access the following systems:: SAP Predictive Analysis SAP HANA Studio

79

EXERCISE 2.5 SOLUTION

Explanation
1) Locate desktop icon for SAP Predictive Analysis and open this link. 2) Alternative Approach: Start All Programs SAP Business Intelligence SAP Predictive Analysis

Screenshot

3) Verify that you are able to run SAP Predictive Analysis

80

4) Click on New Document

81

5) Select the SAP HANA Offline mode this mode will transfer data from HANA into the SAP PA tool on your desktop.

6) Enter SAP HANA Server, instance, user id, and password to establish a connection from SAP PA to HANA. Click on Connect to SAP HANA Instance to initiate the connection.

82

7) Select the BPC data view created in HANA from the BW model import

8) Click on Preview and Select Data then click on Select - tis option will allow you to filter the data you want to transfer offline from HANA into SAP PA.

83

9) A filter definition appears, this filter will be used to limit which records are transferred from HANA into the SAP PA tool. Click on the value preview for the attribute for PRODUCTP to view sample values contained in the dataset. Click on the set a filter. icon to

10) Click on Add and Keep Only to select one product (P00001) for inclusion into the filter Click on Close to finalize the filter selection for customer.

84

11) In the same manner as steps 10-11, enter a filter for YEAR2 (use the filter values of 2012, 2012, and 2013).

85

12) In the same manner as step 10-11 enter a filter for CATEGORYP (select the filter values V001).

86

13) In the same manner as steps 10-11 enter a filter for USERID (select the filter values EA161_XX where XX corresponds to your assigned workshop id)).

14) After all three filter conditions have been defined, click on the Acquire button to read the selected data from HANA and transfer the read records into the SAP PA tool. Note that BPC only has one measure, SignData and the system has already preselected it.

87

15) SAP PA opens a report showing the transferred data. Note the format of the TIME characteristic - it is in a character format (as indicated by the associated ABC designation in the header). In order to use these values in PA we first need to convert the ABC charter format to true PA TIME format.

16) Change the view mode to Predict /Designer mode.

88

17) Add a Filter form the

Data

Preparation tab to remove all unnecessary data columns Drag and drop filer icon from list and system will create a process connection (arrow) automatically

18) Configure the Filter by mousing over the icon and selecting

89

19) Deselect all data columns, then select only the following: TIME USERID Currency ACCOUNTP PRODUCTP CATEGORYP SignData

Save and close.

20)

Add a Formula function module from the Data Preparation tab to start to convert BPC TIME (string) into numeric (floating point) components. Note: SAP PA does not have a direct conversion function to convert a string into an integer

21) Mouse over the Formula icon and select Configure Properties

90

22) The data received from BPC is in a character format. SAP PA requires date formats for some statistical algorithms. This process begins the conversion of the character format received from BPC/HANA into a Date format that can be consumed by SAP PA functions. Copy code provided into Expression workspace. This code reads the characters patterns representing YEAR and converts them in a numeric equivalent value.

Copy the following code:

SUBSTRING([TIME],1,4)

Label formula output field that will be generated as: Enter Year_Extract as new column name for results Verify the code entry by running the Validation Click on Save and Close

YEAR_Extract

91

23) Mouse over function icon and select Run Till Here

24) Do NOT switch to Results view after successful execution

25) Mouse over function icon and select View Results Note that a new column appears that is labeled Year2Number and contains the year value in string format

26) Return to the design workspace (Click on Designer view mode)

92

27) Mouse over the formula function created in step 16 and select the Rename option. Rename this function as Extract YEAR from BPC TIME

28) Drag and drop a new function step by repeating the steps outlined in 16-18. Entering the following code SUBSTRING([TIME],6,8 Into the Expression workspace Label new calculation field MONTH_Extract Validate. Save and Close. Rename this function as Extract Month from BPC TIME

Copy the following code:

SUBSTRING([TIME],6,8)

29) Run the new function created in 28 by repeating the relevant steps in 19-21. View the results and note that the extracted MONTH_Extract and YEAR_Extract are in character ABC format.

93

30) Combine the extracted YEAR and Month values into a date pattern recognizable by SAP PA (i.e.: MM-DD-YYYY). Repeat steps 16, 17 and 18 and drag and drop a new formula process step, adding to the existing chain

31) Mouse over the new link and select properties to enter coding Name the new function output as: DATE_String Label this function: Concatenate month and year into Data format We are forming the basis of a PA compatable Date field by combining the month, year, and the date (always the first of the month in this exercise).

Cut and paste expression: CONCAT([MONTH_Extract],CONCAT('-',CONCAT('1',CONCAT('',[YEAR_Extract]))))

32) Execute Run till Here and view results: note the population of the new column DATE_String. Also note that DATA_String is still a character based filed, not a true Predicative Analysis date field.

94

33) Use the Data Type Conversion function to convert this field. Drag and drop Data Type Conversion function and place at end of existing process string

34) Data Type Definition converts from Character based to Date based format Enter an new Alias Name: Date_Converted Change the Primary Data Type to DATE Select the DATA format MM-DD-YYYY Save and Close.

35) Rename the Data Type Definition process as: Convert Date_String to Date_Converted

36) View new output Note the change in the data type for the column Date_Converted

95

37) Save your process with the title : EA161_Offline_ XX (where XX is your workshop assigned number id)

38) Drag and drop Triple Exponential Smoothing algorithm to the end of your process definition

39) Mouse over to access Configure Properties

96

40) Configure the function Output Mode: Forecast Dependent Col: SignData Consider Date Column Period: Month(12) Date Column: DATE_Converted Missing Values: STOP Period: Month(12) Periods to Predict (12) Rename the Year and Month columns that will be generated as YearPredicted and MonthPredicted as shown.

41) Execute function (Run Till Here)

42) View Results

97

43) Note that data has been updated with three new columns based upon the predicted forecast algorithm

44) Select Visualize to view the data graphically

98

45) Right Click on the Predictive Value field and select Create a measure from the context menu.

46) The filed containing the calculated predictive values will appear in the Measures window

99

47) Drag and drop the two measures into the Y Axis definition Drag and drop YearPredicted and MonthPredicted into the X Axis (make sure YearPredictive is located above MonthPredictive for correct display)

48) Select the Line Chart as the chart type

100

49) Report should appear as follows:

50) Return to the Design mode to change predictive algorithm settings

101

51) Adjust the Alpha coefficient to 0.99 Save the model Re-run the analysis Note: The data for each user is slightly different. You may want to adjust all three factors (the alpha, beta and gamma) to observe effects.

52) Note the improved tracking of the predicted values against the actual values represented by SignData In actual practice, users would continue adjusting parameters until the prediction meets tracking expectations. The focus of this exercise is demonstrating how SAP Predictive Analysis can integrate with SAP HANA/BPC and not how to define the best predictive algorithm.

102

53) Return to design mode

54) Now that we have a predicted values, lets write them back to HANA We will first strip off unnecessary data columns using a Filter Drag and drop a new Filter into the process string

55) Select only the YearPredicted, MonthPredicted, and PredictedValue columns to be retained

103

56) We will only keep the forecasted values for the year 2014

57) Save and close the Filter configuration

104

58) Execute the Filter by mousing over the Filter icon and selecting Run Till Here

59) View filtered results (only the predicted 2014 values are displayed)

60) Convert the numeric YearPredicted and MonthPredicted into character string format in preparation for storage into HANA Drag and drop Data Type Conversion function and place at end of existing process string

105

61) Configure the Data Type definition to convert YearPredicted and MonthPredicite to String charateritics.

62) Drag and drop the JDBC Writer to send this new forecasted data back into HANA

106

63) Open the configuration of the JDBC Writer Enter the following: Database Type: HANA Driver Path: use the Browse buttoin to locate the required ngdbc.jar driver, path should be: C:\Program Files\SAP Predictive Analysis\Desktop\plugins\co m.businessobjects.connecti onserver.standalone_3.2.1. v201305070036\ConnectionServer\jdb c\drivers\newdb\ngdbc.jar Machine Name: the URL for the HANA system Port Number: 30115 Database Name: enter the HANA schema that will contain the target table, in the format of EA161_XX where XX is your assigned workshop user id number. Enter HANA User ID and Password Table Name: EA161_XX_FORECAST (where XX is your assigned user id for the workshop. SAVE and Close.

107

64) Save your process with the title: EA161_Offline_ XX (where XX is your workshop assigned number id) overwrite any existing model.

65) Execute the entire process

66) Upon successful execution, open proceed to the HANA Molder and refresh your session

108

67) Find the new table in the EA161 Schema and under the folder Tables that was created using the JDBC Writer

68) Highlight the table name and right click and select Open Data Preview.

69) View forecasted BPC data written into HANA ready for consumption by BI, BPC, etc

109

70) Review the entire process in SAP Predictive Analysis

71) Questions to consider

Why did we have to change the data types in PA for Month and Year?

What was the purpose of the first Filter?

How would the Smoothing algorithm react if we left the 2013 records for month 10, 11, and 12 (which have zero values) in the date input to the function?

End of Exercise

110

EXERCISE GROUP 3
This exercise is mainly intended for showing you the underlying technical integration that is happening between several different applications within SAP (Business Objects Dashboards, Business Planning and Consolidation, and the HANA Predictive Analysis Library). The intention is not to show you how to code the individual technical pieces, but more about showing you how all the different pieces fit together. For this reason we do not ask you to write any code in this exercise, we are only showing you the code that was written to get these different pieces working together and exposing/presenting it to you for your own analysis. Real world use cases could easily be very different from this particular scenario and it should be noted that these exercises are only intended as an educational reference or example.

Exercise
3.1 VERIFY SYSTEM ACCESS 3.2 USING AN SAP BUSINESS OBJECTS DASHBOARD TO CHANGE FORECASTING PARAMETERS FROM WITHIN SAP BUSINESS PLANNING AND CONSOLIDATIONS 3.3 REVIEW DASHBOARD DESIGNER WRITEBACK METHODS 3.4 USING AN SAP BUSINESS PLANNING AND CONSOLIDATIONS WRITE BACK BADI TO TRIGGER A HANA DATA BASE PROCEDURE 3.5 RUNNING A HANA DATA BASE PROCEDURE TO CALL A PREDICTIVE ANALYSIS LIBRARY FUNCTION FOR A SPECIFIC DATA REGION 3.6 USING A BW DATA STORE OBJECT TO VIEW PREDICTIVE FORECASTS WRITTEN FROM WITHIN HANA DATA BASE PROCEDURES 3.7 CALLING AN SAP BUSINESS PLANNING AND CONSOLIDATIONS DATA MANAGER PACKAGE TO TRIGGER A HANA DATA BASE PROCEDURE 3.8 RUNNING A HANA DATA BASE PROCEDURE TO CALL A PREDICTIVE ANALYSIS LIBRARY FUNCTION FOR MANY DATA REGIONS 3.9 APPENDIX SQL Script Procedure Code and Write Back BADI Code

Estimated Duration
5 minutes

10 minutes

5 minutes 5 minutes

5 minutes

5 minutes

5 minutes

5 minutes NA

111

EXERCISE 3.1 VERIFY SYSTEM ACCESS

Estimated time: 5 minutes Objective In this exercise, you will verify that you will have access to the various solutions that will be used within the exercises. It is important to note that each student will be given a user ID and password at the web page, which will be used for all the exercises. It is critical that each student use their assigned user ID when accessing systems so that they do not affect other students exercises. Exercise Description For the days exercise, the user will need to access the following systems:: SAP HANA Studio SAP Business Planning and Consolidation

112

EXERCISE 3.1 SOLUTION

Explanation
1) Locate the desktop icon for SAP HANA Studio and Double Click it. 2) Alternative Approach: Start All Programs SAP HANA SAP HANA Studio

Screenshot

3) Once you have verified that you are running SAP HANA Studio, you will need to leave this application open. 4) User can minimize the system while working with other solution components

3) Verify access to BPC by opening Internet Explorer using the link on your remote desktop

113

4) Follow the path: Favorites > EA161 > Web Logon BPC

5) You will now need to enter the user ID and password to access the SAP Business Planning and Consolidation System. 6) After entering the user ID and password, press the Logon button User ID should be of the format EA161_XX where XX is a unique number that has been assigned to each student Password: Welcome!

114

7) Once you have verified that you are running SAP Business Planning and Consolidations, you will need to validate that you are looking at the right model and will then exit the program

Optional: Only if Environment is not correct from previous step 8) At the bottom right corner, make sure you are connected to the EA161 environment. 9) If you are not connected to the correct environment, select the environment labeled EA161. Click the Connect button to change the model. 10) If the environment was changed in this step, please re-validate Step 7

115

11) Verify that your user ID has Favorites Assigned to your user. 12) Workspace favorite will be called EA161_XX BPC Predictive Forecasting, where EA161_XX is your user id 13) Dashboard favorite will be called EA161_Sales_Revenue_Da shboard_EA161_XX, where EA161_XX is your user id

116

EXERCISE 3.2 USING AN SAP BUSINESS OBJECTS DASHBOARD TO CHANGE FORECASTING PARAMETERS FROM WITHIN SAP BUSINESS PLANNING AND CONSOLIDATIONS
Estimated time: 10 minutes Objective In this exercise, we will open up an existing SAP Business Objects Dashboard and execute three different types of exponential smoothing algorithms in order to forecast/predict sales revenue based on actuals. You will be able to change the parameters for single, double, and triple exponential smoothing. Each algorithm uses forecasting parameters which allow you to control the accuracy and trending weight on the actual forecasted values. For single exponential smoothing, you will be able to change the ALPHA parameter. For double exponential smoothing, you will be able to change the ALPHA and BETA parameters. And for triple exponential smoothing, you will be able to change the ALPHA, BETA, and GAMMA parameters.

Exercise Description For this exercise, we will be performing the following activities Open a Business Objects Dashboard in BPC and adjust exponential smoothing parameters to change the forecasted values for Sales.

117

EXERCISE 3.2 SOLUTION

Explanation
Optional: If BPC was closed in previous section, perform steps 1-3 1) Verify access to BPC by opening Internet Explorer using the link on your remote desktop 2) Follow the path: Favorites > EA161 > Web Logon BPC

Screenshot

Optional 3) You will now need to enter the user ID and password to access the SAP Business Planning and Consolidation System 4) After entering the user ID and password, press the Logon button Single sign-on was not setup for this system as would have been done by many of our customers Password: Welcome!

118

5) Select the Dashboards Favorite called EA161_Sales_Revenue_D ashboard_EA161_XX

6) Take a moment to acquaint yourself with the Dashboard. Notice the SAVE, EXECUTE, UPDATE FORECAST, and REFRESH buttons. SAVE Saves the parameter value you have selected for the type of algorithm used (Single, Double, or Triple). EXECUTE Executes the Predictive Analysis function using the parameter value you have previously saved. UPDATE FORECAST uses the algorithm you are currently looking at to update the forecast category (V004) this category is the approved or accepted forecast. This button will only be visible when forecast settings match saved forecast REFRESH refreshes the report/graph output. NOTE: The data for every

119

student is unique so the resulting data will likely produce a different chart Also, the predicted forecast will use data from 2011, even though the dashboard only displays data from 2012 7) Select a different exponential smoothing algorithm (in this screenshot we are using the Triple Smoothing) and change the parameters. Click SAVE, then EXECUTE, and then REFRESH, noting how the forecasted values change on the graph output.

NOTE: Remember to hit REFRESH after executing the predictive functions so that you can see the output.

8) Now update the forecast. Click UPDATE FORECAST, and then REFRESH, noting how the forecasted value (Green Line) have changed on the graph output. This is the approved or accepted forecast (Category V004)

120

9) Select a different Product and perform the same steps to adjust the forecast. Note how some products have different trends and the smoothing algorithms behave differently depending on the data set used.

10) You have completed the exercise!

You are now able to: Open a Business Objects Dashboard in BPC and adjust exponential smoothing parameters to change the forecasted values for sales revenue

121

EXERCISE 3.3 OPTIONAL REVIEW DASHBOARD DESIGNER WRITEBACK METHODS

Estimated time: 5 minutes Objective In this exercise, we will be displaying what values will be sent back to BPC from the dashboard using the EPM Connector. This exercise will set the state for Exercise 4, which will discuss what is done with the values written back from the dashboard using the write-back BADI. Please understand that within the Forecast Parameter model, we not only store the forecasting parameters such as alpha, beta and gamma for each forecasting method (i.e. single, double and triple exponential smoothing), but we also store what method should be used to generate forecasting going forward. This means that customer, product, entity combination can use any of the three models specified and will use the forecast parameters saved for that method as well. NOTE: This exercise will be conceptual and will not require any specific actions to be performed in the system. Exercise Description For this exercise, we will be performing the following activities Review the dashboard to review all cases where we are writing data back to BPC Review the specific information that is being sent with each write-back activity

122

EXERCISE 3.3 SOLUTION

Explanation
1) Here we are reviewing the same dashboard we used in the previous exercise

Screenshot

2) For product P00001 (i.e. Adjika) we have selected single exponential smoothing and an Alpha = 0.2 3) Selecting Save will send one record to the Forecast Parameter model

123

4) When we press Execute we will write a record back to let the system know to execute the forecast for the Single Exponential Smoothing algorithm

5) When we press the Update Forecast button, the dashboard will send a record to the Forecast Parameter Model to run the prediction algorithm for single exponential smoothing to the forecast version 6) Offsetting records will also be created to the Forecast parameter table to set the results equal to zero for double and triple exponential smoothing algorithms (i.e. category V006 & V007 respectively) 7) Once we select refresh button, we will see the updated data

124

8) For product P00001 (i.e. Adjika) we have selected double exponential smoothing and an Alpha = 0.2 and Beta = 0.2 9) Selecting Save will send two records to the Forecast Parameter model

10) When we press Execute we will write a record back to let the system know to execute the forecast for the Single Exponential Smoothing algorithm

125

11) When we press the Update Forecast button, the dashboard will send a record to the Forecast Parameter Model to run the prediction algorithm for single exponential smoothing to the forecast version 12) Offsetting records will also be created to the Forecast parameter table to set the results equal to zero for single and triple exponential smoothing algorithms (i.e. category V005 & V007 respectively) 13) Once we select refresh button, we will see the updated data

14) For product P00001 (i.e. Adjika) we have selected triple exponential smoothing and an Alpha = 0.2, Beta = 0.2 and Gamma= 0.2 15) Selecting Save will send three records to the Forecast Parameter model

126

16) When we press Execute we will write a record back to let the system know to execute the forecast for the Single Exponential Smoothing algorithm

17) When we press the Update Forecast button, the dashboard will send a record to the Forecast Parameter Model to run the prediction algorithm for single exponential smoothing to the forecast version 18) Offsetting records will also be created to the Forecast parameter table to set the results equal to zero for single and triple exponential smoothing algorithms (i.e. category V005 & V007 respectively) 19) Once we select refresh button, we will see the updated data

20) You have completed the exercise!

You are now able to: Understand what values are being written back from the dashboard to the SAP Business Planning and Consolidation solution

127

EXERCISE 3.4 USING AN SAP BUSINESS PLANNING AND CONSOLIDATIONS WRITE BACK BADI TO TRIGGER A HANA DATA BASE PROCEDURE

Estimated time: 5 minutes Objective In this exercise, we will be displaying the BPC Write Back BADI which was used to trigger a HANA Database Procedure containing the Predictive Analysis Library function call. We will not ask you to code anything and are only showing you this step in order for you to see how the different technical integration points all work together. NOTE: Please do NOT modify the code in any way as it WILL AFFECT OTHER USERS! Exercise Description For this exercise, we will be performing the following activities Open SAP GUI and navigate to the BPC Write Back BADI Display the ABAP Class code which was used in this Write Back BADI

128

EXERCISE 3.4 SOLUTION

Explanation
1) Locate the desktop icon for SAP GUI and open it. 2) Alternative Approach: Start All Programs SAP Front End SAP Logon 3) Select the M39 System from the list of available systems. NOTE: Double-Click this System to Logon via SAP GUI

Screenshot

Application Server: dewdfti34002.wdf.sap.corp Instance No: 10 System ID: M39

4) You will now need to enter the user ID and password to access the SAP BW on HANA System Password: Welcome! 5) After entering the user ID and password, press Enter 6) Go to transaction /nSE20 as shown in the screenshot and enter ZENH_BPC_PAL as the name of the Enhancement Implementation 7) Click on the DISPLAY icon (glasses)

8) Navigate to the Technical Details tab. Here you can see all the relevant ABAP Objects for the BPC Write Back BADi Implentation

129

9) Go back to the Enh. Implementation Elements tab. Expand the arrow to the left of the ZBADI_BPC_PAL Implementation and double click on Filter Val. As shown in the screenshot. NOTE: This BPC Write Back BADi is set up to be triggered only for the FORECAST Model within the EA161 Environment. Furthermore, it will only be triggered upon Manual write back (MODULE_ID = MAN) 10) Now Double Click on the Implementing Class as shown in the screenshot. NOTE: The ABAP Class being executed for this Write Back BADi is ZCL_UJ_BPC_PAL. 11) Now Double Click on the Display icon (glasses). IMPORTANT: Do NOT click on the Edit icon (pencil) this is an ABAP Class that everyone in the session needs to be able to display so please do NOT click Edit or attempt to modify this code PLEASE 12) After clicking Display you should be taken to the ABAP Class Editor (transaction SE24). Here you can see all the relevant properties of the ABAP Class ZCL_UJ_BPC_PAL which is used to execute our PAL procedures on the HANA db 13) Double Click on the PRE_PROCESS method as shown in the screenshot

130

14) The PRE_PROCESS method is where we can see the actual ABAP code which is being executed when a user attempts to write data back manually to the FORECAST model (recall the Filter Values described in Step 9 above). Lines 20-22 define the names of the SQL Script Procedures we are running.

SEE APPENDIX H for the ABAP Source Code Text

15) You have completed the exercise!

You are now able to: Open SAP GUI and navigate to the BPC Write Back BADI Display the ABAP Class code which was used in this Write Back BADI

131

EXERCISE 3.5 RUNNING A HANA DATA BASE PROCEDURE TO CALL A PREDICTIVE ANALYSIS LIBRARY FUNCTION FOR A SPECIFIC DATA REGION

Estimated time: 5 minutes Objective In this exercise, we will be displaying the HANA Database Procedure which was used to call a Predictive Analysis Library function. We will not ask you to code anything and are only showing you this step in order for you to see how the different technical integration points all work together. NOTE: Please do NOT modify the code in any way as it WILL AFFECT OTHER USERS!

Exercise Description For this exercise, we will be performing the following activities Open SAP HANA Studio and navigate to the Database Procedures Display the SQL Script which was used in these Database Procedures

132

EXERCISE 3.5 SOLUTION

Explanation
Optional: If SAP HANA Studio was closed, perform steps 1-2 1) Locate the desktop icon for SAP HANA Studio and Double Click it 2) Alternative Approach: Start All Programs SAP HANA SAP HANA Studio 3) Right-Click the white area underneath the tab labeled SAP HANA Systems and select Add System

Screenshot

4) Enter the Host Name and Instance Number as shown and click Next

Host Name: dewdfti34002.wdf.sap.corp Instance Number: 01

133

5) You will now need to enter the User ID and password to access the SAP HANA System. Password Welcome1 6) After entering the user ID and password, click the Finish button

7) You should now see a list of folders underneath a new System Entry for your User ID 8) Expand the Content Folder until you see the Procedures Folder as shown in the screenshot. Go to: sap->bw->cpmb-> Procedures

9) Double Click on the Procedure named PAL_SS_SINGLE_PROD. You can see from the warning that we have prevented write access to the procedure. NOTE: This procedure actually executes the Single Exponential Smoothing Predictive function for a specific data set. Notice that the Input Parameters of the Procedure determine which set of data to run the function on (by USERID, ENTITY, CATEGORY, and PRODUCT)

134

10) Expand the Analytic Views folder within the sap->bw>cpmb package.

These two Analytic Views represent the BPC Finance and Forecast models (respectively). In the SQL Script Procedure from the previous step, you can see we are performing selects on these two Analytic Views to determine the correct data sets for which to run the Predictive Function 11) Note that the procedure firsts selects from the BPC Forecast model to determine the ALPHA parameter written by the Dashboard, then it selects from the BPC Finance model to retrieve the Actuals.

135

12) After selecting the data from the BPC Finance model, the procedure then sets up the parameters for the Predictive Analytics Library function and makes the CALL to the actual Predictive Analytics Library function.

13) The Predictive Analytics Library function returns a result table, which is then written to a HANA Database table

NOTE: This HANA Database table is actually the physical table behind a BW Data Store Object. You will see later in this exercise that this DSO is used for reporting the forecasted values within BW/BPC. 14) You have completed the exercise! You are now able to: Open SAP HANA Studio and navigate to the Database Procedures Display the SQL Script which was used in these Database Procedures

136

EXERCISE 3.6 USING A BW DATA STORE OBJECT TO VIEW PREDICTIVE FORECASTS WRITTEN FROM WITHIN HANA DATA BASE PROCEDURES

Estimated time: 5 minutes Objective In this exercise, we will show how we used a BW Data Store object to View the Predictive Forecasts written from the HANA Database Procedures in the previous steps. Exercise Description For this exercise, we will be performing the following activities Review the Planning Forecast DSO structure within BW Review the BPC Finance MultiProvider structure within BW

137

EXERCISE 3.6 SOLUTION

Explanation
Optional: if SAP GUI was closed, perform steps 1-5 1) Locate the desktop icon for SAP GUI and open it. 2) Alternative Approach: Start All Programs SAP Front End SAP Logon Optional 3) Select the M39 System from the list of available systems. NOTE: Double-Click this System to Logon via SAP GUI

Screenshot

Application Server: dewdfti34002.wdf.sap.corp Instance No: 10 System ID: M39

Optional 4) You will now need to enter the user ID and password to access the SAP BW on HANA System 5) After entering the user ID and password, press Enter 6) Go to transaction /nRSA1 as shown in the screenshot and find the DSO Object named PLNFRCST. The DSO is located in the InfoArea Tree: Business Planning and Consolidation -> EA161: Consuming SAP HANA Predictive Functions with BPC -> PAL Planning Forecasts (Direct Update) 7) Double Click the DSO object to get the structure and fields to show up on the right hand side

138

8) Notice that the DSO object contains the same InfoObjects from the BPC Environment we are using (EA161). This is to ensure that when we view the data in the BPC Front End, BW can perform a UNION between the BPC Finance Model and the DSO

9) Now expand the Settings menu and take note that we are using a DSO of type Direct Update. This type of DSO can only be loaded via a Function Module within BW (or as in our case, by using SQL Script on the HANA Database)

10) Next, lets take a look at the BW MultiProvider behind the BPC Finance model. Find the BW MultiProvider named FINANCE (Technical Name /CPMB/P9MOMEV) and Double Click on it

139

11) After you Double Click the MultiProvider, a Pop-Up window will show you which InfoProviders are inside this MultiProvider. Switch between the InfoCubes tab and the Datastores tab to see that this MultiProvider contains two InfoProviders: 1) The BPC FINANCE cube 2) The Planning Forecast DSO 12) Click on the green arrow (Continue) 13) In the Display MultiProvider view, click on button shown in the screenshot, labeled Identify characteristics

14) Here we can see the relationship between the two InfoProviders (The BPC Finance Cube and the Planning Forecast DSO) Each InfoObject has been mapped between each InfoProvider, so that when data is queried against this MultiProvider, BW can perform a UNION of the data between the two InfoProviders.

140

15) SPECIAL NOTE: You can see that we are mapping the BPC Time Dimension to an Attribute of ZSEQUENCE in the Planning Forecast DSO This is because when we write the data to the DSO in the HANA database procedure we are using a raw integer as a sequence number (this is the format the PAL function outputs). In order to properly UNION the data, an attribute on ZSEQUENCE was created which matches the correct BPC Time ID. 16) You have completed the exercise! You are now able to: Review the Planning Forecast DSO structure within BW Review the BPC Finance MultiProvider structure within BW

141

EXERCISE 3.7 CALLING AN SAP BUSINESS PLANNING AND CONSOLIDATIONS DATA MANAGER PACKAGE TO TRIGGER A HANA DATA BASE PROCEDURE

Estimated time: 5 minutes Objective In this exercise, we will show how we can use a BPC Data Manager Package to trigger a HANA Database Procedure. Exercise Description For this exercise, we will be performing the following activities Review the BPC Data Manager Package which kicks off a BW Process Chain Review the BW Process Chain which calls the ABAP Program to trigger the HANA Database Procedure Review the ABAP Program which calls the HANA Database Procedure

142

EXERCISE 3.7 SOLUTION

Explanation
Optional: If BPC was closed in previous section, perform steps 1-3 1) Verify access to BPC by opening Internet Explorer using the link on your remote desktop 2) Follow the path: Favorites > EA161 > Web Logon BPC

Screenshot

Optional 3) You will now need to enter the user ID and password to access the SAP Business Planning and Consolidation System 4) After entering the user ID and password, press the Logon button Single sign-on was not setup for this system as would have been done by many of our customers Password: Welcome!

143

5) Click on the EPM Office Add-in Excel link in the Launch section

6) Select the connection for the FORECAST model (Second Link) and click on the OK button.

7) Click on the Data Manager tab in the Excel Ribbon

144

8) Now we are going to run a Data Manager Package which has been configured on this Environment to execute the PAL function across all Products for your USERID. The PAL exponential smoothing algorithm (Single/Double/Triple) and its Parameters (Alpha/Beta/Gamma) are used from the Approved/Accepted forecast which each user already set (The Update Forecast button in the Dashboard). 9) Click on the Run Package icon 10) Select the Batch Forecast by USERID Data Manager Package and Run it.

145

11) In the Data Manager Package Prompt click Finish to Run the Package

12) Click OK in the information pop-up

13) Now click on View Status to see the status

146

14) Here you can see how long it took to run the PAL function across all Products for your USERID. (For this sessions data volume, each USERID should take about 30 seconds)

15) Now close all the Pop-Up windows and go back the the Data Manager tab on the Excel Ribbon. Click on Organize Package List to view the configuration of this Data Manager Package. 16) Find the Data Manager Package named Batch Forecast by USERID. 17) Right - Click on it and select Modify Package

147

18) In the Modify Package popup, click on the Modify Script button

19) Take a moment to look at all of the Data Manager Package configurations.

For Example: 20) Click on the TASK line in the left hand window pane

21) Verify the name of the BW Process Chain ID

NOTE: In the next steps, we will be logging onto the SAP BW system with SAP GUI in order to Verify the Process Chain which was configured in the Data Manager Package Optional: if SAP GUI was closed, perform steps 1-5 22) Locate the desktop icon for SAP GUI and open it. 23) Alternative Approach: Start All Programs SAP Front End SAP Logon

148

Optional 24) Select the M39 System from the list of available systems. NOTE: Double-Click this System to Logon via SAP GUI Application Server: dewdfti34002.wdf.sap.corp Instance No: 10 System ID: M39

Optional 25) You will now need to enter the user ID and password to access the SAP BW on HANA System 26) After entering the user ID and password, press Enter 27) Go to transaction /nRSPC as shown in the screenshot and find the Process Chain named ZBPC_PAL_BATCH_FOR ECAST. 28) Double Click the Process Chain to see whats inside

29) If the Choose Display window Pops-Up, make sure you choose the Network button. NOTE: You can change this setting at any time using the Settings Menu

149

30) In the screen that shows up on the right hand side, you can see the various actions that this Process Chain goes through when its being executed. 31) Double Click on the Process Type named Program (As shown in the screen shot)

32) In this screen, we can see that this Process Type is used to execute an ABAP Program. Verify the name of the ABAP Program which is being executed: ZBPC_CALL_PAL_BATCH 33) Click on the Pencil Icon next to the Program Name

34) After clicking the Pencil Icon, you should be taken to the ABAP Editor (Transaction SE38). Now we can see the code from the Program itself. 35) Click on the Display button

150

36) The ABAP program we see here runs a HANA Database Procedure which executes our Predictive Analytics Library functions in Batch Mode (Per USERID, across all Products). Lines 26-28 define the names of the SQL Script Procedures we are running. We can see that Lines 3739 set up the Parameter for the Procedure call. We are using the ABAP Username to pass into the USERID Parameter of the Procedure call. (see Exercise 7 for more details about the Procedure)

SEE APPENDIX I for the ABAP Source Code Text 37) You have completed the exercise! You are now able to: Review the BPC Data Manager Package which kicks off a BW Process Chain Review the BW Process Chain which calls the ABAP Program to trigger the HANA Database Procedure Review the ABAP Program which calls the HANA Database Procedure

151

EXERCISE 3.8 RUNNING A HANA DATA BASE PROCEDURE TO CALL A PREDICTIVE ANALYSIS LIBRARY FUNCTION FOR MANY DATA REGIONS

Estimated time: 5 minutes Objective In this exercise, we will show you the HANA Database Procedures which were created for running the Forecast Predictions in BATCH mode across all data sets. Exercise Description For this exercise, we will be performing the following activities Open SAP HANA Studio and navigate to the Database Procedures Display the SQL Script which was used in these Database Procedures

152

EXERCISE 3.8 SOLUTION

Explanation
Optional: If SAP HANA Studio was closed, perform steps 1-2 1) Locate the desktop icon for SAP HANA Studio and Double Click it 2) Alternative Approach: Start All Programs SAP HANA SAP HANA Studio 3) You should see a list of folders underneath a System Entry for your User ID 4) Expand the Content Folder until you see the Procedures Folder as shown in the screenshot. Go to: sap->bw->cpmb-> Procedures

Screenshot

5) Double Click on the Procedure named PAL_SS_BATCH. You can see from the warning that we have prevented write access to the procedure. NOTE: This procedure executes the Single Exponential Smoothing Predictive function across all data sets for a particular USERID. Notice that the Input Parameter of the Procedure is USERID only.

153

6) Take notice that this Procedure is almost identical to the one we reviewed in Exercise 4 earlier. The only major difference is that in this BATCH procedure we are using a Cursor to loop through the data sets based upon the USERID that was passed in. Each data set is then executed in the same fashion as the Procedure from Exercise 4 (specific data set for each Product).

7) You have completed the exercise!

You are now able to: Open SAP HANA Studio and navigate to the Database Procedures Display the SQL Script which was used in these Database Procedures

154

3.9 APPENDIX
Here is the ASCII text of the SQL Script Procedures, Write Back BADI PRE_PROCESS method, and the Batch Forecasting Program.

Explanation
A) Single Smoothing Procedure

Source

B) Double Smoothing Procedure

C) Triple Smoothing Procedure

D) Single Smoothing BATCH Procedure

E) Double Smoothing BATCH Procedure

F) Triple Smoothing BATCH Procedure

G) BATCH Wrapper Procedure

H) ABAP: Write Back BADI PRE_PROCESS method

I)

ABAP: Batch Forecasting Program

J) BPC Dashboard
EA161_Sales_Revenue_Dashboard_EA161_Exercise.XLF

155

Thank you for participating in this SAP TechEd Virtual Hands-On Workshop! Please, take a few minutes to answer a couple of feedback questions concerning your session.

Find a shortcut to the survey on the desktop of your virtual laptop image or visit
https://www.sapsurvey.com/cgi-bin/qwebcorporate.dll?idx=FSQCZ7

156

2013 by SAP AG or an SAP affiliate company. 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. National product specifications may vary. These materials are provided by SAP AG and its affiliated companies (SAP Group) for informational purposes only, without re presentation 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 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. Please see http://www.sap.com/corporate-en/legal/copyright/index.epx#trademark for additional trademark information and notices.

Potrebbero piacerti anche