Monday, March 26, 2012

How to create Pop-up with system messages in WAD

When I built for my customers WAD with IP functionality, I faced with request to create Pop-up window with FOX and System Messages where user have to respond (Click OK Button).

In this post I will explain how to convert standard System Messages List to Designed Pop-up in WAD 7.

1. Put System Message List component on the bottom of the wad, when its technical name is MESSAGES_LIST_ITEM_1.
2. Put this little CSS code inside HEAD before TAG:
<style type="text/css" >.alertMessage{ font-size: 9pt; font-family: arial; color:#000000; font-weight:normal;}.alertBoxStyle{ cursor: default; filter: alpha(opacity=95); background-color: #FFFFFF; position: absolute; top: 200px; left: 200px; width: 100px; height: 50px; visibility: hidden; z-index: 999; border-style: groove; border-width: 1px; border-color: #FFFFFF; text-align: center;}</style>

This code is defines Message Box Style and you can change it.

3. After Tag insert this code:
<div id="alertLayer" class="alertBoxStyle" >test</div>
This is Message Box object, when wad is initialized this object is hidden ( see alertBoxStyle code).

4. Now add JavaScript Object inside WAD and write this code:

/*this two lines says to WAD on Load and in every change to do getSystemMessages Function*/
document.onchange=getSystemMessages();
window.onload=getSystemMessages;

//this function Hide Alert (after user will click OK)
function hideAlert()
{
alertBox=document.getElementById("alertLayer").style;
alertBox.visibility="hidden";
}

//This Function Create Message Box Object
//In this Function when I Create Button I use for it standard SAP CSS Style urBtnStd

function makeAlert(aTitle,aMessage)
{
var inner;
if(document.getElementById("alertLayer"))
{
alertBox=document.getElementById("alertLayer").style;
inner="<table border=0 width=100% height=100% cellspacing=0>"+"<tr height=27><td class=urTrcHdTrn>";
inner=inner+"<div class=urTrcTitHdr>"+aTitle+"</div></td></tr>"+"<tr height=5><td width=5></td></tr>";
inner=inner+"<tr><td class=alertMessage>"+aMessage+"<BR></td></tr>";
inner=inner+"<tr hegiht=5><td width=5></td></tr>";
inner=inner+"<tr><td align=center><input type=button value=' OK ' onClick='hideAlert()' class=urBtnStd></td><tr></table>";
document.all.alertLayer.innerHTML=inner;
aWidth=600;
aHeight=250;
alertBox.width=aWidth;
alertBox.height=aHeight;
alertBox.left=(document.body.clientWidth-aWidth)/2;
alertBox.top=(document.body.clientHeight-aHeight)/2;

alertBox.visibility="visible";
}
}

//this function gets all system messages and transferred them as is to makeAlert function.
function getSystemMessages()
{
var MESSAGE_LIST_ITEM='MESSAGES_LIST_ITEM_1';
var MESSAGE_LIST_ITEM_BLOCK= MESSAGE_LIST_ITEM+'_AcMess_mrx';
var MESSAGE_LIST_ITEM_FIELD= MESSAGE_LIST_ITEM+'_BiMessageItem-txt';
var msgBlock = document.getElementById(MESSAGE_LIST_ITEM_BLOCK);
if(msgBlock!=null)
makeAlert("System Message",msgBlock.innerHTML);
}

That’s all :)
And this is Result in my testing system:







You can see that Button and Message Box Header have a SAP design and also SAP standard links on messages work properly.

Tuesday, November 22, 2011

Searching By BEx Medium Text Problem in WebIntelligence, BO4.

In my project I faced with a problem when in a WEBI prompt window I selected value with medium text (value with text longer than 20 characters) and report didn't retrieve a data.
In this context a problem was with 0COSTCENTER hierarchy.
In other hand, when I run BEx report stand alone, and chose there in filter the same vale, BEx report retrieves data.
Firstly I checked my BEx Report from BICS connection and saw that in Characteristic properties -> display -> Text View is defined as Medium-Length Text.



It was logical, because I saw in prompt text longer than 20 characteristics, but only after selection of a long value report didn't retrieve a data.
After this, I checked InfoObject BEx definitions in RSA1 transaction, BW. To my surprise there also were good definitions: Text Type = 2 Medium-Length Text. But a report still didn't retrieve a data.


After a brainstorming with Valentin Gorelik (Senior BW Consultant), I decided to change "Provider-Specific Properties of the InfoObject". I chose in display property option "F Key and Text as Medium Text".

After these changes the WEBI start to work properly!

Sunday, September 25, 2011

How to Drill-Down from Xcelsius chart to WEB Page

A common requirement in the dashboard is to Drill-Down from a chart to the web-page (WEBI Report/Bex Report/Google) with selected data.
I solved this issue by using "Insertion Option" of Chart component and URL Button component.
In this post I will explain the full solution with examples.
Firstly I used this data," Sales by Country and Month":

I created column chart on Xcelsius:

Chart Parameters:
·         Title: Sales Chart
·         Data: By Series
o   First series:
§  Name: Sheet1!$A$2
§  Values(Y): Sheet1!$B$2:$M$2
o   Second series:
§  Name: Sheet1!$A$3
§  Values(Y): Sheet1!$B$3:$M$3
o   Third series:
§  Name: Sheet1!$A$4
§  Values(Y): Sheet1!$B$4:$M$4
o   Category Labels:  Sheet1!$B$1:$M$1






Under the chart data on worksheet I filled additional cells:

The "Insertion Options of the chart" will be linked to these cells. Insertion Options Parameters:
·         Enable Data Insertion: Checked
·         Series Name Destination: Sheet1!$B$8
·         Insertion Type: Position
·         Series
o   North America:
§  Destination: Sheet1!$B$9
o   Europe:
§  Destination: Sheet1!$C$9
o   Asia:
§  Destination: Sheet1!$D$9
·         Insert On: Mouse Click
·         Default Section:
o   Series: North America
o   Item: 1

Defining of additional cells:
1.       B7 (Trigger Cell): =B8&B9&C9&D9
This cell will update them value on every change of cells: B8,B9,C9,D9, where these cells change on every click on chart
2.       B10 (Current Position): =IF(B8=A2,B9,IF(B8=A3,C9,IF(B8=A4,D9,0)))
This formula will choice a selection position from cells: B9, C9, D9 according to selected description (B8 selected series).
3.       B11 (Selected Month): =CHOOSE(B10,B1,C1,D1,E1,F1,G1,H1,I1,J1,K1,L1,M1)
This formula will choice a month from chart data according to position.
4.       B12 (URL North America): ="http://www.google.co.il/#q=North America Sales "&B11
This formula concatenates URL of North America data (In this example Google search page with constant string) and a selected Month.
5.       B13 (URL Europe): ="http://www.google.co.il/#q=Europe Sales "&B11
This formula concatenates URL of Europe data (In this example Google search page with constant string) and a selected Month.
6.       B14 (URL  Asia): ="http://www.google.co.il/#q=Asia Sales "&B11
This formula concatenates URL of Asia data (In this example Google search page with constant string) and a selected Month.
7.       B15 (URL): =IF(B8=A2,B12,IF(B8=A3,B13,IF(B8=A4,B14,"")))
This formula will choice a URL from B11, B12 and B13 according to a selected description (B8 selected series).
Of course in the same way we can put URL to Webi Report and transfer the month as prompt parameter.

Now create a URL Button, with these parameters:
·         URL: Sheet1!$B$15
·         Encode URL: Unchecked

URL Button Behavior parameters:
·         Trigger Cell: Sheet1!$B$7
·         When Value Changes: Checked

To hide the button just put it on Chart Area -left mouse click -> "Send to Back"
Run the Dashboard – its work!



Tuesday, September 6, 2011

My First Blog

Hey Folks,

My name is Aharon , and this is my first blog post.
I'm senior SAP BW/BI/IP consultant and also Android fan.
I decided to start blogging about various challenges,
which I deal with in my professional and personal life.

I hope this blog will be interest for you.

Aharon