When important functionality is executed in a web template by a click on a button, it is helpful to have a dialog with the user to ensure that he didn’t press the button by accident and really wants to execute certain actions. Therefore usually a small dialog window which contain texts like “Do you really want to perform this action” is presented to the user and he needs to click a “yes” or “no” button. We call this kind of dialog “pop up to confirm” dialogs. This paper demonstrates how pop up to confirm dialogs can be implemented in SAP web templates. This is modeled within the SAP standard.
Author(s): Matthias Nutt
Created on: 31 December 2013
For technical reasosn the document is split into different parts. This document is part one.
Matthias Nutt worked for SAP (Switzerland) AG. He was a professional consultant from 2002 to 2012 and worked in the area of BW in close co-operation with the development and support team. His work spanned a variety of roles including project manager, technical project manager, consultant, developer, primary and development support.
BW 7.X, BI-IP
1. Overview and outline of the approach
In SAP web templates, especially when using BI-IP functionality, we are often in situations, where a button which triggers an action or changes data is a substantial part of the SAP web template. This could include the execution of a planning sequence or a planning function. Usually the functionality is executed directly once the button has been clicked. Nevertheless sometimes situations occur where the application should ask for a confirmation whether this functionality should be performed or not. This paper discusses an approach which enables this “pop up to confirm” user dialog within the SAP standard.
To model the pop up to confirm dialog we model a main web template which contains the main parts of the application. For each necessary pop up confirm dialog separate web templates will be implemented which show the question to the user, wait for the answer and execute the business logic behind it. During the execution the pop up to confirm web template uses objects (like data providers, etc.) from the main web template, too. In the following, we provide a step-by-step guide how this can be implemented.
2. Preparation steps
To show the pop up to confirm behavior some preparation steps like defining an info cube, a query and an aggregation level are required. We define those objects in this section. Finally we have the basic functionality available in a web template, which we will call the main web template throughout this paper.
The list below shows an overview of the necessary items which we need for our purpose:
- A simple planning/real-time info cube to allow planning
- A simple aggregation level on the planning cube to allow planning
- A simple query to display some data from the planning cube and to allow to enter data
- A simple web template which just contains the main application. This template is the main template and contains the whole planning application.
- Some buttons which perform different actions, for example to execute a SAVE command or trigger a planning sequence/function. These buttons are defined in the main web template
- A simple web template which contains a text message and a “yes” and a “no” button. This web template is the pop up to confirm window which presents the question like “Do you really want to do this?” to the user and waits for the answer (“yes” or “no”).
2.1 Creating the planning cube
Let’s start creating the simple planning cube. We implement the info cube DEMO_001 as real time cube, add info object 0COMP_CODE and 0CURRENCY plus key figure 0AMOUNT and activate it (see screenshot below).
2.2 Creating the aggregation level
In the next step we create the aggregation level by starting the planning modeler via transaction RSPLAN. The name of the aggregation level is DEMO_ALV. All info objects and key figures are ticked in this example. For details please refer to the screenshot below.
2.3 Creating the input ready query
Now we create a simple test query named DEMO_POPUP_QUERY on aggregation level DEMO_ALV. We put 0COMP_CODE and 0CURRENCY in the filter and restrict it to a fixed value (in our case we use the company code 1000 and currency CHF) for demo purposes. To have a key figure we simply drag the key figure 0AMOUNT in the columns and tick the input-ready tick box. In the rows of the query the info objects 0COMP_CODE and 0CURRENCY are used. We make sure that we display the master data entries for 0COMP_CODE and 0CURRENCY. For further details please refer to the screenshots below.
Finally we make sure that the query is started in change mode to enable input readiness right from the opening of the query (see screenshot).
2.4 Creating the main web template
Once the basic preparation steps are done, we can start designing our main web template. Therefore we create the new web template DEMO_POPUP_TO_CONFIRM_MAIN. It contains the data provider DP_MAIN_1 which refers to query DEMO_POPUP_QUERY which was defined above.
In the web template itself, analysis item ANALYSIS_MAIN_1 is used, which refers to data provider DP_MAIN_1 and allows one new line. In addition, button group BUTTON_GROUP_MAIN_1 is created. Here we have button SAVE which executes the save command. For further details please refer to the screenshots below.
Now we can execute the main web template and see the data of the query, enter a new key figure value and save it. But what we would like to achieve is to have a “pop up to confirm” user dialog asking if the data really should be saved. The steps to create this behavior are described in the following.
3 Implementing the pop up to confirm behavior
This desired “pop up to confirm” behavior can be achieved using the command OPEN_TEMPLATE_DIALOG. The basic idea is that a special dialog web template is opened when the user clicks the button. The special dialog web template displays the question to the user and waits for his answer. Depending on the answer the logic is executed of not. This means we create a new web template that will be opened as modal dialog box. It contains the question and a “yes” and a “no” button.
3.1 Creating the save dialog web template
To design the special dialog web template we start creating a normal web template named DEMO_POPUP_TO_CONFIRM_SAVE. It contains a text box named TEXT_POPUP_SAVE_1, with the text “Do you really want to save?”. In addition the button group BUTTON_GROUP_POPUP_SAVE_1 contains the two buttons “yes” and “no”. As these objects are unique to this web template we need to give them an unique name, especially a name which is not used already in our main web template (see the SAP help pages for more details). The screenshot below shows the web template.
The desired modeling for the “no” buttons is: If the user clicks the “no” button the modal web template should be closed without any action. This can be implemented using the command CANCEL_TEMPLATE_DIALOG. It is the only command on that button and shown in the screenshot below.
For modeling the “yes” button, the desired behavior is: If the user clicks the “yes” button, the data should be saved and after that the modal dialog box should be closed. We achieve this by using the command “SAVE”, followed by command OK_TEMPLATE_DIALOG.
This is all we need for the “save” dialog web template. As the SAVE-command needs to be executed in the pop up web template, it is not needed in the main web template anymore and will be deleted there. Instead we need to change the main web template button in a way that it starts the pop up web template.
3.2 Changes to the main web template
In order to trigger the save pop up dialog web template, changes to the command on the save button need to be implemented in the main web template. Instead of saving the data directly, we now open the save dialog web template DEMO_POPUP_TO_CONFIRM_SAVE to achieve the “pop up to confirm” behavior. The save command is deleted and the OPEN_TEMPLATE_DIALOG command is inserted as the screenshots below demonstrate.
3.3 Testing the main template
We can test the main web template with the “popup to confirm” behavior now. Executing the main web template shows the save button and the query. Entering 100 CHF gives the following screenshot:
Now we click the “save” button. The system opens the dialog web template as a pop up. We can see the question and the two buttons. This is shown in the following screenshot.
If we click the “no” button the data is not saved, but the pop up window is closed. If we click the “yes” button, the data will be saved and the window will be closed. Basically this already explains the basic way how the “popup to confirm” behavior can be implemented.
Please continue reading the second part of this document.