Anda di halaman 1dari 26

Displaying SAP Business One data

using Crystal Report and Xcelsius


DashBoard - Demo

Applies to:
SAP Business One versions 2007 and 8.8
Crystal Report Basic 2008 for SAP Business One SP1
Crystal Reports runtime 2008 SP1
Xcelsius

Summary
The following article demonstrates how to create a runtime Xcelsius dashboard based on SAP Business One
data. The following methods are demonstrated:
1. Using Crystal Report as a data source for the Xcelsius dashboard.
2. Using a Web service as a data source for the Xcelsius dashboard.

Author: Miki Zilbershtein


Company: SAP
Created on: 21 July 2009

Author Bio
Joined SAP in 2003 as part of the IBD SDK infrastructure team. Starting in 2008, she
joined the SAP Business One Solution Architects team, which assists partners with any
technical challenge they face in developing and implementing their solution

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com


© 2009 SAP AG 1
Displaying SAP Business One data using Crystal Report and Xcelsius DashBoard - Demo

Table of Contents
Introduction ......................................................................................................................................................... 3 
1. Introduction to Xcelsius ............................................................................................................................... 3 
2. SAP Business One and Crystal Reports..................................................................................................... 4 
3. Xcelsius ....................................................................................................................................................... 4 
3.1 How to Obtain Xcelsius .......................................................................................................................................... 4 
3.2 SAP Business One Data and Xcelsius ................................................................................................................... 4 
Creating Xcelsius Dashboard using Crystal Report ........................................................................................... 5 
Step 1 – Generate a Crystal Report................................................................................................................ 6 
Step 2 - Design Xcelsius dashboard and export it to a flash file..................................................................... 6 
Step 3 – Embed the flash file into the Crystal report ...................................................................................... 8 
Creating Xcelsius Dashboard Using a Web Service .......................................................................................... 9 
Step 1 – Generate a Web Service for querying the DB ................................................................................ 10 
Step 2 – Import the Web Service to Xcelsius................................................................................................ 13 
Step 3 – Design Xcelsius Dashboard ........................................................................................................... 16 
Appendix 1 – Use .Net object to connect and run query on the DB ................................................................. 22 
Appendix 2 – Service.cs file content ................................................................................................................. 23 
Related Content ................................................................................................................................................ 25 
Copyright........................................................................................................................................................... 26 

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com


© 2009 SAP AG 2
Displaying SAP Business One data using Crystal Report and Xcelsius DashBoard - Demo

Introduction
1. Introduction to Xcelsius

Just like a pilot gets lots of information in one glance of the airplane’s dashboard, managers can
get lots of information in one glance of a well-designed dashboard.
Crystal Xcelsius is a data dashboard design tool that displays summary-level business data in a
visually rich and intuitive format that allows users to analyze and interact with their data in order to
make better business decisions.
Xcelsius has the ability to show data using gauges, charts, and other components, to generate interactive
flash files, and to generate “what if” scenarios – all of which are tremendous tools for decision-making.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com


© 2009 SAP AG 3
Displaying SAP Business One data using Crystal Report and Xcelsius DashBoard - Demo

2. SAP Business One and Crystal Reports


In the first section of the demo, we will use Crystal Reports.
Starting from SAP Business One version 2007, Crystal Reports installation and license are provided to SAP
Business One clients.
In version 2007:
ƒ A special version of Crystal Reports is provided with SAP Business One.
ƒ SAP Business One partners and customers receive a license and installation program for Crystal
Reports.
ƒ Customers and partners need to install Crystal Reports separately.
ƒ Crystal Reports Integration Tool is provided in the SDN downloads area. This is a SAP Business
One add-on for integrating Crystal Reports into the SAP Business One client.
ƒ To download Crystal Reports for SAP Business One version 2007, use the following link:
https://websmp205.sap-
ag.de/~form/handler?_APP=00200682500000001943&EVENT=TREE&TMPL=01200314690900001
653&V=INST&__EVENT=DISPLAY&_SCENARIO=01100035870000000183&_ADDINC=011000358
700001192682007E&_HIER_KEY=201100035870000001522&
In version 8.8:
ƒ Crystal Reports is installed automatically with SAP Business One no integration add-on is needed.
All customers get a single license for Crystal Reports designer, plus 1 license for Crystal Reports runtime
version for each SAP Business One user.

3. Xcelsius

3.1 How to Obtain Xcelsius


ƒ You need to buy Xcelsius separately.
For information on buying Xcelsius, contact your local SAP representative.
ƒ In this demo, we use the Xcelsius Engage license.
For more information about Crystal Reports and Xcelsius, please use the following link to the Business
Object tools landing page:
https://websmp106.sap-
ag.de/~form/sapnet?_SCENARIO=01100035870000000183&_SHORTKEY=01100035870000711038&_OB
JECT=011000358700000566202008E&_ADDINC=011000358700001192682007E&

3.2 SAP Business One Data and Xcelsius


Xcelsius is able to work with data from different sources. In the following demo, we will show how to display
live data from SAP Business One in an Xcelsius dashboard.
When using Xcelsius Engage there are different ways to connect the dashboard to live data. In both samples
we will run queries on SAP Business One data base.
1. In the first sample we’ll use the Crystal report for querying the DB – and than we’ll use ‘Crystal
Report Data Consumer’ connection in Xcelsius to forward the live data to the Xcelsius dashboard.
2. In the second sample we’ll use a web service for querying the DB – and than we’ll use ‘Web Service
Connection’ to forward the live data to the Xcelsius dashboard.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com


© 2009 SAP AG 4
Displaying SAP Business One data using Crystal Report and Xcelsius DashBoard - Demo

We will talk about it more in the sample.

Creating Xcelsius Dashboard using Crystal Report


In the following demo, we’ll generate an Xcelsius dashboard showing SAP Business One data. We’ll be
using the Crystal Reports for querying the data from the database.
Let’s assume that the year is about to end and the manager wants to view the performance of the sales
employees in the last year. In order to fill his requirement, we will run a Gross Profit by Sales Employee
(Annual) report for invoices.
To create the demo, do the following:
1. Generate a Crystal Report.
2. Design Xcelsius dashboard and export it to a flash file.
3. Import the flash into the Crystal Report.
To see the final demo, you can download it from here (see the CrystalReport folder).

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com


© 2009 SAP AG 5
Displaying SAP Business One data using Crystal Report and Xcelsius DashBoard - Demo

Step 1 – Generate a Crystal Report


** Please refer to “GrossProfitBySalesPersonAnalysis.rpt” sample file.
1. Load the “Crystal Report Designer”.
2. Click on the “Report Wizard”
3. Choose connection to B1 DB.
4. Data: Under B1 company DB (for example: SBODemoUS) Æ choose dbo Æ Tables, choose “OINV
and OSLP”. Click on the “Next” Button.
5. Link: Check that the Link is ok and click on the “Next” button.
6. Field to display: Choose the following fields –
a. From OSLP table: SlpName
b. From OINV table: GrosProfit. Click on the “Next” Button.
7. Grouping: choose the OSLP.SlpName, Click on the “Next” Button.
8. Summaries: keep the default (OINV.GrosProfit).
9. Group Sorting: Click on the “Next” Button.
10. Chart: Click on the “Next” Button.
11. Record Selection:
a. Choose OINV.DocStatus Æ “Is Equal to” Æ “O”
b. Choose OINV.DocDate Æ “Is Between” Æ Type the relevant date you want to show in your
report. (for example: 01,01,2009 00:00:00 and 31,12,2009 00:00:00)
Click on the “Next” Button.
12. Click on “Finish”, the report will be generated.

Step 2 - Design Xcelsius dashboard and export it to a flash file


** Please refer to the “GrossProfitBySalesPersonAnalysis.xlf” sample file.
1. Load the “Xcelsius” (tip: make sure that excel is not running at the background).
2. Prepare the data area according for your needs. For example since I know that I have 7 different
sales persons in my company my data area will look like this:

** The values in the fields are not important at this stage since the real values will be forward to
Xcelsius during runtime. We just need to define which excel cells are going to be used.
3. Summarize the total sales for all the sales persons.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com


© 2009 SAP AG 6
Displaying SAP Business One data using Crystal Report and Xcelsius DashBoard - Demo

4. Add a chart to your Xcelsius canvas area, for example: Pie chart. Fill the chart’s properties as
described below:
a. General Æ Titles Æ chart: ‘Annual Gross Profit Analysis By Sales Person”
b. General Æ Data Æ Values: Select the Gross Profit values (In this example it should be:
Sheet1!$B$2:$B$8)
c. General Æ Data Æ Lables: Select the Sales Person Names (In this example it should be:
Sheet1!$A$2:$A$8)
5. Add a gauge to the Xcelsius canvas area. Fill the gauge’s properties:
a. General Æ Title: “Total Gross Profit”
b. General Æ Data: select the cell with the Total gross profit value (In this example it should be:
Sheet1!$B$9)
c. General Æ Scale: Set the minimum and maximum limits (for example: 0, 3000000).
* Tip – In the “GrossProfitBySalesPersonAnalysis.xlf” file alerts are also demonstrated.
6. Add horizontal sliders for each one of the sales persons. (The horizontal sliders will be used for the
running the “what if” scenarios). Fill the horizontal slider properties:
a. General Æ Title: Choose the relevant cell for the title (for example - Sheet1!$A$2)
b. General Æ Data: Choose the relevant cell for the data (for example - Sheet1!$B$2)
c. General Æ Scale: Set the maximum (for example: 600000)
** repeat steps a & b for each one of the sales employees.
7. Define the range of cells that will hold the data from the crystal report:
a. In the upper menu click on “Data Æ Connection”
b. Click on “Add” and choose Æ “Crystal Report Data Consumer”
c. Row Headers: The data for this sample is saved in rows therefore select the relevant data
into the “Row Header” property. (In this example it should be: Sheet1!$A$2:$A$8)
d. Data: select the relevant cell that will hold the data into the “Data” property. (In this sample it
should be: Sheet1!$B$2:$B$8)
e. Click on close.
8. Export the Xcelsius dashboard into a flash:
a. In the upper menu click on File ÆSave.
b. In the upper menu click on File Æ Export Æ Flash (SWF)

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com


© 2009 SAP AG 7
Displaying SAP Business One data using Crystal Report and Xcelsius DashBoard - Demo

Step 3 – Embed the flash file into the Crystal report


** Please refer to the “GrossProfitBySalesPersonAnalysisWithFlash.rpt” file
1. Load the crystal report generated in step 1 into the Crystal report designer.
2. In the upper menu click on “Insert Æ Flash”
3. Browse to the flash file generated in step 2 section 8, click on the ok button.
4. Click on the area in the report you want to have the flash in. (for example: Report Header). The flash
will be added empty without any values to the report.
5. Bind the data from crystal report to the flash:
a. Right click on the flash Æ and choose “Flash Data Expert”
b. Drag and drop the “OSLP.SlpName” into the “Insert Row Label” table
c. Drag and drop the “OINV.GrosProfit” into the “Insert Data Value” table. Since we have many
rows for each sales employee, we’d like crystal report to group the data before sending it to
the flash. In order to do it:
i. Click on the “Options” button
ii. Under “Calculate this summary” choose “Sum” and click on the ok button.
iii. Click on the ok button
The report is ready; you can run it from Crystal designer or from B1 integration Add-On (under:
Administration Æ Crystal Report Administration Æ Manage Crystal Reports.)
* Tip – once running the a report with a flash, in order to use the ‘what if’ scenario first double click on the
flash area.
** Tip - You must have Crystal Report runtime version 2008 SP1 in order to be able to show flash inside your
Crystal Report. For making sure you have to correct “Crystal Report runtime version” for running flash in your
CR reports, please refer to Crystal Report Runtime blog -
https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/14516

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com


© 2009 SAP AG 8
Displaying SAP Business One data using Crystal Report and Xcelsius DashBoard - Demo

Creating Xcelsius Dashboard Using a Web Service


In the following demo we’ll generate an Xcelsius dashboard showing B1 Data. We’ll develop a web service
and use it with Xcelsius for querying the data from the DB.
Let’s assume that the year is about to end and the manager wants to know which items made the most profit
in the last year. In order to fill his requirement we will generate the “Sales Analysis by Items (Annual) report
for Invoices”.
To create the demo, do the following:
1. Generate a web service for querying the DB.
2. Import the web service (generated in section 1) to Xcelsius.
3. Design Xcelsius Dashboard.
To see the final demo, you can download it from here (see the WebService folder).

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com


© 2009 SAP AG 9
Displaying SAP Business One data using Crystal Report and Xcelsius DashBoard - Demo

Step 1 – Generate a Web Service for querying the DB


In this step we’ll develop a web service that runs a query on the DB. We chose to use the DI Server web
services for connecting and querying the DB, however you can directly connect and run a query on the DB
using .NET objects as shown in appendix1.
** Please refer to “QryDbWebService” Sample.
1. In Visual Studio choose “File Æ New Æ Web Site”
2. Click on “ASP.Net Web Service”, Adjust the solution location and click on the “OK” button.

A new solution will be generated.


3. Right click on your project name and choose: “Add Web References”. The following window will
open:

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com


© 2009 SAP AG 10
Displaying SAP Business One data using Crystal Report and Xcelsius DashBoard - Demo

4. Click on “Web Services In the local machine” (Please note: this option is relevant only if you have
the B1WS installed on your local machine! If you don’t have B1WS installed, you can also generate
the web service using .NET objects as shown in appendix 1).
5. Choose “Login service”, rename it and click on the “Add Reference” button.
6. Repeat steps 3-5 and add the “CompanyService” as well.
7. Open the “Service.cs” file (under AppCode folder).
8. Above the “HelloWorld” Web method add the following struct:
public struct QueryResult
{
public string ItemName;
public string Quantity;
public double GrossProfit;
public string ItemGroupName;
}
9. Rename the “HelloWorld” web method to “RunQuery”.
10. Change the Return value to “QueryResult”
11. Edit the “RunQuery” web method:
a. Remove the “return "Hello World";”
b. Add the code for login to your B1 DB, for example:

LoginService.LoginService serviceLogin = new LoginService.LoginService();


return serviceLogin.Login("(Local)", "SBODemoUS",
LoginService.LoginDatabaseType.dst_MSSQL2005, true, "sa", "B1Admin", "manager",
"manager",LoginService.LoginLanguage.ln_English , true, "localhost:30000");
Run the wanted Query on your DB, for example the following query return the 10 items
with the top gross profit for the required time range. :

CompanyService.CompanyService CmpService = new CompanyService.CompanyService();

// Create message Header


CompanyService.MsgHeader CmpMsgHdr = new CompanyService.MsgHeader();
CmpMsgHdr.SessionID = SessionID;
CmpMsgHdr.ServiceName = CompanyService.MsgHeaderServiceName.CompanyService;
CmpMsgHdr.ServiceNameSpecified = true;

CmpService.MsgHeaderValue = CmpMsgHdr;

// Create Input parameters


CompanyService.RecordsetParams MyRecordsParams = new
CompanyService.RecordsetParams();
MyRecordsParams.Query = "SELECT top 10 OITM.[ItemName], sum(INV1.[Quantity]) as
Qty,sum(INV1.[GrssProfit]) as GrossProfit, OITB.[ItmsGrpNam] From OINV INNER JOIN
INV1 ON OINV.DocEntry = INV1.DocEntry INNER JOIN OITM ON INV1.ItemCode =
OITM.ItemCode INNER JOIN OITB ON OITM.ItmsGrpCod = OITB.ItmsGrpCod WHERE
OINV.[DocDate] >= '2008-01-01' and OINV.[DocDate] <= '2009-12-31' GROUP BY
OITM.[ItemName], OITB.[ItmsGrpNam] order by sum(INV1.[GrssProfit]) desc";
// Invoke query
CompanyService.Recordset RS_QryResult = new CompanyService.Recordset();
RS_QryResult = CmpService.Query(MyRecordsParams);
Parse Query result – Since Xcelsius Engage knows to read Web service only with a
single schema and without complex types. We need to provide simple data types as an

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com


© 2009 SAP AG 11
Displaying SAP Business One data using Crystal Report and Xcelsius DashBoard - Demo

output, Therefore in this step we will parse the query result into a more simple data
type. We will transfer the data from the RecordSet into our “QueryResult” struct.
For example:
QueryResult[] QryRes = null;
QryRes = new QueryResult[RS_QryResult.Row.Length];
int i = 0;
while (i < RS_QryResult.Row.Length )
{
QryRes[i].ItemName = RS_QryResult.Row[i].Property[0].Value;
QryRes[i].Quantity = RS_QryResult.Row[i].Property[1].Value;
QryRes[i].GrossProfit = double.Parse(RS_QryResult.Row[i].Property[2].Value);
QryRes[i].ItemGroupName = RS_QryResult.Row[i].Property[3].Value;
i++;
}
Send the formatted data as a returned value:
return QryRes;

The Service.cs file should look as shown in Appendix 2.


** The Web service is ready; In step 2 you’ll need to provide its wsdl address. For the Xcelsius Designing
phase (step 2), You can either run it from visual studio (during development), or deploy it and use the
deployed address.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com


© 2009 SAP AG 12
Displaying SAP Business One data using Crystal Report and Xcelsius DashBoard - Demo

Step 2 – Import the Web Service to Xcelsius


In this step we’ll consume the web service we’ve generated in step 1 in the Xcelsius.
** Please refer to “GrossProfitAnalisysByItem.xlf” Sample.
1. Load Xcelsius Engage.
2. In the upper menu click on “Data Æ Connections”
3. Click on the “Add” button and choose: “Web Service Connection”
4. Copy the address of your service WSDL into the “WSDL URL” field and click on the “Import” button.
5. Choose the “RunQuery” method in the “Method field”:

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com


© 2009 SAP AG 13
Displaying SAP Business One data using Crystal Report and Xcelsius DashBoard - Demo

6. Now we need to tell Xcelsius, to which fields to copy the web service output. In order to do it we
need to fill the “Insert In” field for each one of the following output values:
a. ItemName
b. Quantity
c. GrossProfit
d. ItemGroupName
For example: ItemName field values will be saved in “Sheet1!$A$2:$A$16”

7. Click on the “Usage” tab and check the “Refresh On Load” checkbox. (Please note that you can
decide how frequent you want to refresh your data).

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com


© 2009 SAP AG 14
Displaying SAP Business One data using Crystal Report and Xcelsius DashBoard - Demo

8. Click on the “Close” button.


** Tip – In order to check that your Web service is working properly, before you continue to develop the
dashboard you can use a “Grid” component to reflect the fields you’ve chosen for the “Insert In” field:

Click on the Preview button and you’ll see the result of your query:

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com


© 2009 SAP AG 15
Displaying SAP Business One data using Crystal Report and Xcelsius DashBoard - Demo

Step 3 – Design Xcelsius Dashboard


1. In order to make it easier to design the Xcelsius dash board, copy values into the fields that your
component will read from.(It doesn’t have to be the real values, just any values in the relevant fields).
For Example:

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com


© 2009 SAP AG 16
Displaying SAP Business One data using Crystal Report and Xcelsius DashBoard - Demo

2. Add a Bar chart: From the “Component” tool barÆ under charts Æ drag and drop a “Bar Chart”. Fill
the chart’s properties as described below:
a. General Æ Titles Æ chart: ‘Annual Sales Analysis By Item”
b. General Æ Titles Æ sub title: ”Gross Profit”
c. General Æ Data Æ Choose “By Series”, Click on the (+) to add new series.
d. Name the Series: “Item Gross Profit”
e. Value(X) – Choose the “Gross Profit” values (Sheet1!$C$2:$C$11)
f. Category Labels (Y) – Choose the Item Name values (Sheet1!$A$2:$A$11)
Tip: for a better visibility: go to appearance tab and reduce the “marker size” value.
The dashboard should look like this:

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com


© 2009 SAP AG 17
Displaying SAP Business One data using Crystal Report and Xcelsius DashBoard - Demo

3. I’d like to show the gross profit distribution per item group. In order to do it, first we need to
summarize the gross profit per items group.
a. Add the following formula for each one of the items group:
“=SUMIF(D$2:D$11,F2,C$2:C$11)”

4. Add a Pie chart: From the “Component” tool barÆ under charts Æ drag and drop a “Pie Chart”. Fill
the chart’s properties as described below:
a. General Æ Titles Æ chart: ‘Annual Sales Analysis Per Item Groups”
b. General Æ Titles Æ sub title: ”Gross Profit”
c. General Æ Data Æ Values: Choose the values we’ve calculated on section a
(Sheet1!$G$2:$G$4).
d. General Æ Data Æ Labels: Choose the item groups names (Sheet1!$F$2:$F$4)

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com


© 2009 SAP AG 18
Displaying SAP Business One data using Crystal Report and Xcelsius DashBoard - Demo

5. Add a Total Gauge: From the “component” tool bar Æ Under “single Value” Æ drag and drop a
“Gauge”. Fill the Gauge’s properties as described below:
a. In the Excel part of the Xcelsius designer - Summarize the gross profit column as shown
below:

b. General Æ Title: “Total Gross Profit”


c. General Æ Data: Choose the field that holds the total summary (Sheet1!$C$12).
d. General Æ Data Æ Scale: Adjust the “Maximum Limit” value to fit your data (for example:
2500000).

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com


© 2009 SAP AG 19
Displaying SAP Business One data using Crystal Report and Xcelsius DashBoard - Demo

6. Add a “What If” scenario: we’d like to show how a change in the Gross profit of one of the top 5
selling items will influence the total gross profit. In order to do it we will add 5 “Horizontal Sliders” that
will represent the gross profit for each one of the top selling 5 item.s User will be able to change the
value of each one of them and see how the total gross profit is affected.
a. From the “component” tool bar Æ Under “single Value” Æ drag and drop an “Horizontal
Slider”. Set the following properties:
i. General Æ Title: Should point to the cell that holds the Item Name of the relevant
item (for example: “Sheet1!$A$2”).
ii. General Æ Data: should point to the cell that holds the gross profit value of the
relevant item (for example: ” Sheet1!$C$2”).
iii. General Æ Data Æ Scale: Adjust the “Maximum Limit” value to fit your data (for
example: 350000).
iv. Repeat steps i-iii for each one of the top 5 selling items.

Tip: You can choose a “Theme” and design the Xcelsius dash board according to your taste and
needs. For example; I chose the “Elan” theme.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com


© 2009 SAP AG 20
Displaying SAP Business One data using Crystal Report and Xcelsius DashBoard - Demo

Your dashboard is ready and it should look like this:

7. Click on the “Preview” button and see your dash board running. You can check the ‘what if’ scenario
by changing the values off the horizontal sliders and see how the values in the graphs and gauge
are changed accordingly.
Your Dash board is ready you can export it to power point, flash, PDF etc…

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com


© 2009 SAP AG 21
Displaying SAP Business One data using Crystal Report and Xcelsius DashBoard - Demo

Appendix 1 – Use .Net object to connect and run query on the DB


public Service () {
}
public struct QueryResult
{
public string SlpName;
public string Commission;
}

[WebMethod]
public QueryResult[] RunQuery()
{
// Open Connection - Query Data from DB table - Close connection
SqlConnection connection = new SqlConnection("Data Source=(local);Integrated
Security=SSPI;Initial Catalog=SBODemoUS");
SqlDataAdapter adapter = new SqlDataAdapter(
"SELECT SlpName, Commission FROM OSLP", connection);
DataTable DT_QryResult = new DataTable();
adapter.Fill(DT_QryResult);
connection.Close();
// Parse data to be forward to Xcelsius
QueryResult[] QryRes = null;
QryRes = new QueryResult[DT_QryResult.Rows.Count];
int i=0;
foreach (DataRow row in DT_QryResult.Rows)
{
QryRes[i].SlpName = row["SlpName"].ToString();
QryRes[i].Commission = row["commission"].ToString();
i++;
}
return QryRes;

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com


© 2009 SAP AG 22
Displaying SAP Business One data using Crystal Report and Xcelsius DashBoard - Demo

Appendix 2 – Service.cs file content


using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService
{
public Service () {
}
public struct QueryResult
{
public string ItemName;
public string Quantity;
public double GrossProfit;
public string ItemGroupName;
}

[WebMethod]
public QueryResult[] RunQuery()
{
/////////////// Connect to DB ////////////////
string SessionID = "";
LoginService.LoginService serviceLogin = new LoginService.LoginService();
SessionID = serviceLogin.Login("(Local)", "SBODemoUS",
LoginService.LoginDatabaseType.dst_MSSQL2005, true, "sa", "B1Admin", "manager",
"manager", LoginService.LoginLanguage.ln_English, true, "localhost:30000");

/////////////// Run Query ////////////////


CompanyService.CompanyService CmpService = new CompanyService.CompanyService();

// Create message Header


CompanyService.MsgHeader CmpMsgHdr = new CompanyService.MsgHeader();
CmpMsgHdr.SessionID = SessionID;
CmpMsgHdr.ServiceName = CompanyService.MsgHeaderServiceName.CompanyService;
CmpMsgHdr.ServiceNameSpecified = true;

CmpService.MsgHeaderValue = CmpMsgHdr;

// Create Input parameters


CompanyService.RecordsetParams MyRecordsParams = new
CompanyService.RecordsetParams();
MyRecordsParams.Query = "SELECT top 10 OITM.[ItemName], sum(INV1.[Quantity]) as
Qty,sum(INV1.[GrssProfit]) as GrossProfit, OITB.[ItmsGrpNam] From OINV INNER JOIN
INV1 ON OINV.DocEntry = INV1.DocEntry INNER JOIN OITM ON INV1.ItemCode =
OITM.ItemCode INNER JOIN OITB ON OITM.ItmsGrpCod = OITB.ItmsGrpCod WHERE
OINV.[DocDate] >= '2008-01-01' and OINV.[DocDate] <= '2009-12-31' GROUP BY
OITM.[ItemName], OITB.[ItmsGrpNam] order by sum(INV1.[GrssProfit]) desc";
// Invoke query
CompanyService.Recordset RS_QryResult = new CompanyService.Recordset();
RS_QryResult = CmpService.Query(MyRecordsParams);

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com


© 2009 SAP AG 23
Displaying SAP Business One data using Crystal Report and Xcelsius DashBoard - Demo

/////////////// Parse Query Result ////////////////


QueryResult[] QryRes = null;
QryRes = new QueryResult[RS_QryResult.Row.Length];

int i = 0;

while (i < RS_QryResult.Row.Length )


{
QryRes[i].ItemName = RS_QryResult.Row[i].Property[0].Value;
QryRes[i].Quantity = RS_QryResult.Row[i].Property[1].Value;
QryRes[i].GrossProfit = double.Parse(RS_QryResult.Row[i].Property[2].Value);
QryRes[i].ItemGroupName = RS_QryResult.Row[i].Property[3].Value;
i++;
}
return QryRes;

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com


© 2009 SAP AG 24
Displaying SAP Business One data using Crystal Report and Xcelsius DashBoard - Demo

Related Content
For more information about this topic:
1) Crystal Report Runtime blog - https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/14516
2) Xcelsius Landing Page -
https://service.sap.com/~form/sapnet?_SCENARIO=01100035870000000183&_SHORTKEY=01100
035870000711038&_OBJECT=011000358700000566202008E&_ADDINC=0110003587000011926
82007E&

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com


© 2009 SAP AG 25
Displaying SAP Business One data using Crystal Report and Xcelsius DashBoard - Demo

Copyright
© Copyright 2009 SAP AG. 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.
Microsoft, Windows, Excel, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation.
IBM, DB2, DB2 Universal Database, System i, System i5, System p, System p5, System x, System z, System z10, System z9, z10, z9,
iSeries, pSeries, xSeries, zSeries, eServer, z/VM, z/OS, i5/OS, S/390, OS/390, OS/400, AS/400, S/390 Parallel Enterprise Server,
PowerVM, Power Architecture, POWER6+, POWER6, POWER5+, POWER5, POWER, OpenPower, PowerPC, BatchPipes,
BladeCenter, System Storage, GPFS, HACMP, RETAIN, DB2 Connect, RACF, Redbooks, OS/2, Parallel Sysplex, MVS/ESA, AIX,
Intelligent Miner, WebSphere, Netfinity, Tivoli and Informix are trademarks or registered trademarks of IBM Corporation.
Linux is the registered trademark of Linus Torvalds in the U.S. and other countries.
Adobe, the Adobe logo, Acrobat, PostScript, and Reader are either trademarks or registered trademarks of Adobe Systems
Incorporated in the United States and/or other countries.
Oracle is a registered trademark of Oracle Corporation.
UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group.
Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of
Citrix Systems, Inc.
HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C®, World Wide Web Consortium, Massachusetts
Institute of Technology.
Java is a registered trademark of Sun Microsystems, Inc.
JavaScript is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by
Netscape.
SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP Business ByDesign, 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.
Business Objects and the Business Objects logo, BusinessObjects, Crystal Reports, Crystal Decisions, Web Intelligence, Xcelsius, and
other Business Objects products and services mentioned herein as well as their respective logos are trademarks or registered
trademarks of Business Objects S.A. in the United States and in other countries. Business Objects is an SAP company.
All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document
serves informational purposes only. National product specifications may vary.
These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP
Group") for informational purposes only, without representation 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 COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com


© 2009 SAP AG 26

Anda mungkin juga menyukai