Conditional Scheduling in SAP BI Web Intelligence
Unlike in Crystal Reports, In SAP Web Intelligence, it is not possible to schedule based on conditions.
However, often times you can accomplish this with the Publications as follows.
- Create a Webi document that will be used to pre-process the Dynamic Recipients list.
- Schedule to Excel the Document created at step 1
- Create the WebI Document to be used as Dynamic Recipients list for the Publication
- Create the Publication
- Fine tune the recurrence for the various schedules
In our sample, we will use the eFashion sample Universe / Database.
The sample business case is:
If Sales Revenue for a given City drops below certain threshold (2 Million USD), I want the board of directors to be informed via email and a personalized report to be sent to this group.
However, if the Sales for a City are more than 2 Million but lower than 3 Million I want the store manager to be informed.
We assume in this sample that you are familiar with both SAP BI Web Intelligence, and with SAP BI Publications.
Let us now see the steps in detail:
Here you put only the basic stuff that is needed to build the list for the recipients.
In this sample, I entered in the report body the fields City and Sales Revenue.
Then I have created a Variable, type dimension, with the formula:
=If [Sales revenue] <3000000 Then “firstname.lastname@example.org”
ElseIf [Sales revenue] <5000000 Then “email@example.com”
Then I added this variable to the table. This is what I got:
Then I filtered to remove the rows than do not need an alert (Right click, Filter, Add Filter, etc. as per below image)
This is the filtered output.
One last suggested set of steps is to:
– set the page margins to 0 and
– remove the report title
– align the table to the top left immediately under the report header.
We want to do this because otherwise when creating the Webi doc used for the Dynamic Recipients list you may have some issues when it tries to identify the column names.
I explain this in more detail in this presentation https://archive.sap.com/documents/docs/DOC-52500
Then save it to the Enterprise, and test it from BI Launchpad, you want to be sure that it works
This will create the data provider for the final Dynamic Recipient List source document.
This step is necessary, because the condition is based on a variable, and the Publications engine is not able to process variables within a Webi Document. This is the reason why we need to create this intermediate Excel Data Provider, so that we will have raw data and not variables.
To do so:
Logon to BI Launchpad, go to the folder where you saved the Webi Document that will be used to create the data provider for the final Dynamic Recipient List source document.
- In the Recurrence, select Run Now. (Later you will re-schedule it and here you will enter the required settings. Bear in mind that this must be refreshed before the publication will be sent.)
- In the Formats select the output format: Microsoft Excel
- In the Destinations section, enter: File System
If you have only one node, better to save on the server itself, otherwise it is preferable to save the output xls in a shared location. In either case, you need to be sure that the specified user name and password are correct and that account has r/w access to the folder you are scheduling the xls to.
(Remember to activate the File System destination for all the Adaptive Job Servers in the landscape or you will get an error)
Now save it to enterprise with a name like “Dynamic Recipients Final”, and once again, go to the BI Launchpad and test that the document can be refreshed without any issues.
In Web Intelligence, create a new WebI document, based on Excel Personal Data Provider.
The source file is the XLSX file created by the schedule at step 3.
This document will be practically identical to the one created at Step 1, the only difference is that the field with the email address is no longer a variable, hence this can be used as a Dynamic Recipients List.
Once created the document, save to enterprise with a recognizable name, i.e. “Dynamic Recipients Final”
From the BI Launchpad, navigate to the folder where you will store the publication, right click and Select New > Publication.
In the General Properties, enter the Title,
in the Source Documents enter the Report you created at point #3
Now, from the left menu, select the Dynamic Recipients option, and specify the Source for Dynamic Recipients, then click on OK, after which you must select the Query and Map the fields.
You must also flag the checkbox “Use entire list”.
Next step is to configure the Personalization, which will be used to deliver the personalized reports to the users.
Last step is to complete the Destinations, see example in the image below.
You can also refine the publication advanced settings according to your requirements.
PS: It is not in the scope of this document to explain how Publications work, for more information please review the Business Intelligence Launch Pad User Guide.
Now you can test the publication, and adjust where necessary.
Once you have successfully tested the various steps, it is time to adjust the recurrence of the various schedules, so that you have consistent results.
It is not in the scope of this document to go too much in depth into the details; however, it is suggested to put in place measures that prevent data inconsistency.
For example, the Publication should run after the Dynamic Recipients list has been refreshed, and before this can happen, the XLSX with the pre-processed recipients list must have been produced.
You can accomplish this with scheduling based on events, which is covered in the BI Launchpad User guide (7.1.8).
Although Web Intelligence does not have a feature that allows scheduling documents based on conditions, you can accomplish this by using publications and intermediate steps that create a temporary MS Excel data provider used to create a Dynamic Recipients list.