Академический Документы
Профессиональный Документы
Культура Документы
Applies to:
Crystal Reports 2008, BusinessObjects Integration Kit for SAP Solutions
Summary
This document outlines the required steps to install and configure BusinessObjects Enterprise in combination with SAP NetWeaver BI. Author: Ingo Hilgefort
Author Bio
Ingo Hilgefort started in 1999 with Seagate Software / Crystal Decisions as a Trainer and Consultant. He moved to Walldorf for Crystal Decisions by end of 2000 and worked with the SAP BI Development team on integrating Crystal Reports with SAP BW. He then relocated to Vancouver in the year 2004 and worked as Product Manager / Program Manager (Engineering) on the integration of Business Objects products with SAP products. He is now focusing on the topic of Embedded Analytics for the SAP Solutions.
Table of Contents
SAP as a Datasource for Crystal Reports ..........................................................................................................3 SAP BW Metadata in Crystal Reports ................................................................................................................4 Dimension and Characteristics .......................................................................................................................5 Display attributes and Navigational Attributes ................................................................................................7 Keyfigures, Units, and Currencies ..................................................................................................................9 Hierarchies ....................................................................................................................................................10 Crystal Reports with simple SAP BW queries ..................................................................................................11 Creating Crystal Reports Using the SAP Toolbar.........................................................................................11 Creating Crystal Reports Using the Database Explorer ...............................................................................15 Creating your First Report with Crystal Reports on Top of SAP BI ..................................................................22 Insert a Field .................................................................................................................................................26 Insert Additional Fields..................................................................................................................................27 Preview the Report........................................................................................................................................28 Resize Fields.................................................................................................................................................30 Change Field Headings.................................................................................................................................31 Add Summary Information ............................................................................................................................31 Add a title ......................................................................................................................................................33 Format an Object ..........................................................................................................................................34 Grouping & Charting .....................................................................................................................................36 Save the Report ............................................................................................................................................38 Creating your First Report with Hierarchies from SAP BI.................................................................................39 Formulas for Hierarchical Reporting .............................................................................................................48
Formula Hierarchy Level ............................................................................................................................................48 Count Hierarchical Children .......................................................................................................................................48
The available SAP data sources for Crystal Reports are: SAP R/3 Tables and cluster (Open SQL). ABAP functions. Classic InfoSets. SAP queries and InfoSet queries.
SAP BW Tables and cluster (Open SQL). ABAP Functions. Direct ODS access (without the need for an SAP BW query). BW queries and BW cubes.
Crystal Reports designer element Separate fields for key and description per characteristic. Fields representing a parent-child relationship. Measure element in a grouping called Keyfigure. Each Keyfigure can have up to three elements: numeric value, unit, and formatted value. Measure element in the folder Keyfigure. (Information about the details of the calculated keyfigure is not available in Crystal Reports.) Measure element in the folder Keyfigure (Information about the details of the restricted keyfigure is not available in Crystal Reports.) Filters will be applied to the underlying query but are not visible in the Crystal Reports designer. Separate fields for key and description per navigational attribute. Each display attribute becomes one field in the field explorer. The display attributes are grouped together with the actual characteristic. Parameters.
Calculated Keyfigure
Restricted Keyfigure
SAP variables
Dimension and Characteristics The image shows an SAP BI query in the BEx Query Designer.
The rows of this query include several characteristics and the columns several keyfigures. On the left side, the actual cube structure is shown with the cube dimensions (not to be confused with characteristics).
Building a Crystal Report on top of such an SAP BW query will result in the following elements:
Each characteristic in the query will result in an element in the field explorer with a key and a description item (Example: City Key and City Name). In addition each characteristic will also generate a Node ID and a Parent Node ID which can be used for hierarchical reporting. Each characteristic will also generate a Member Unique Name field which represents the technical key value.
Display attributes and Navigational Attributes Display attributes are InfoObjects which are logically assigned or subordinated to a characteristic. For example: The characteristic customer has two attributes: Phone number Fax number
The following screen shows an SAP BI query in the BEx Query Designer.
The row structure includes a characteristic Customer with four display attributes (Geographical Height, Postal Code, Sector Code, and Area Code).
In addition the BW query contains three navigational attributes in the rows: Regional Code, Postal Code, and Area Code. A navigational attribute can easily be identified by the double underscore (__) in the technical name of the navigational attribute.
Building a Crystal Report object on top of such an SAP BW query will result in the following elements:
Each characteristic in the query will result in an element in the field explorer with a key and a description field. Each navigational attribute in the query will result in an element in the field explorer with a key and a description item (for example, Regional Code and Area Code). Each display attribute will create an element in the field explorer underneath the corresponding characteristic (for example, Customer number with several display attributes). Crystal Reports will include all available display attributes for the characteristic and not only the display attributes that are included in the SAP BW query.
Keyfigures, Units, and Currencies Each keyfigure used in an SAP BW query can have up to three elements: Numeric value of the keyfigure. Unit or currency information. Formatted value, representing the user-specific formatting.
Each keyfigure is represented with a field in a group called Key Figures. In the case the keyfigure is configured in SAP BW with a unit, an additional field will be added representing the unit information. The Formatted Value represents the numeric value formatted as a string value following the userspecific formatting settings.
Hierarchies Hierarchies can be activated for characteristics in the BEx Query Designer and offer the user the capability to navigate along a hierarchical structure.
The image shows the field explorer in Crystal Reports based on an SAP BW query with a hierarchy.
Button
Command
Create a new report from SAP BW Query Open Report Save Report Save Report as Start SAP BW Query Designer Disconnect Settings
Function
Creates a new report based on an SAP BW query that is already defined. Opens a Crystal Report file from SAP BW. Saves the current report to SAP BW. Saves the report to BW with the option to define a new name or choose a different SAP BW role. Starts the SAP BW Query Designer. Closes the current connection to SAP BW. Allows configuring settings for the connectivity to SAP BW. The settings are specific for the Crystal Reports designer installation.
As part of the settings available in the SAP toolbar the report designer can choose to use the SAP BW MDX driver for creating new reports against SAP BW.
It is highly recommended to use the BW MDX driver. The BW Query driver does not support multiple structures of a BW query and does not support display attributes.
To create a new report with the SAP toolbar 1. 2. Start Crystal Reports Designer (Start > Programs > Crystal Reports 2008 > Crystal Reports 2008). Select the menu SAP > Settings.
3. 4. 5.
Set the check box Use MDX Driver with support for Multiple structures. Click OK. Select the menu SAP > Create New Report from a Query.
6. 7.
Select the SAP server from the SAP Logon. Click OK.
8. 9.
Enter the needed details: Client, User, Password, and Language. Click OK.
The SAP standard open/save dialog will show up and offer the user to select a query from the roles or InfoAreas. 10. 11. Select the SAP BW query. Click OK.
An empty report is created and the SAP BW query is used as data source. 12. 13. 14. Select the fields for your report from the Field Explorer. Preview your report. Save the report to BusinessObjects Enterprise.
Creating Crystal Reports Using the Database Explorer Crystal Reports lists the two SAP BW query connectivity in the standard Database Explorer. To create a new report with the Database Explorer 1. 2. 3. Start Crystal Reports Designer (Start > Programs > Crystal Reports 2008 > Crystal Reports 2008). Select the menu File > New > Standard Report. Double-click on Create New Connection.
The SAP connectivity is listed as part of all available connectivity sorted alphabetically. 4. Double-click SAP BW MDX Query. The SAP BW MDX Query connectivity is the more enhanced version of the Crystal Reports connectivity towards SAP BW cubes and SAP BW queries.
5. 6.
Select the SAP server from the list of available SAP systems. Click Next.
7. 8.
9.
Click Finish.
10. 11.
Right-click the SAP server entry. Select the menu entry Options.
12. 13.
Enter the filter in the field Table name LIKE. Click OK.
14.
15. 16.
Select the SAP BW query from the list of available queries Click the right arrow to move the query to the list of selected queries.
17.
Click Next.
18.
19.
Click Next.
20. 21.
If required, define grouping by selecting the field and clicking the right arrow. Click Next.
22. 23.
24.
Click Finish.
1.
Select Start
All Programs
The SAP toolbar will appear on the left of the Start Page display.
2. 3.
In the SAP menu, select Settings. The Settings dialog appears. Select Use MDX driver with support for Multiple structures and select OK.
4.
Now you want to change the Initial Setup and show only the description of the characteristic and the key figures of the BEx query.
5.
Select the menu File > Options > Database and set the option Show Description
Now the Field Explorer will show SAP metadata instead of the technical name for the fields.
6.
In the SAP toolbar, select Create new report from a query. The SAP System dialog appears.
7. 8.
Select the system and click Next. Select Roles. Expand the folder and select the query.
Insert a Field 9. Expand the Database Fields node in the Field Explorer dialog.
10. Drag Product Group into the Details section of the Design tab. An object frame appears with the Arrow cursor as you drag the field onto the report: The object frame represents the object you have just selected for placement. The size of the object frame approximates the size of the data in the field selected. Move the object frame as far to the left as you can in the Details section. If you move the field too far to the left, the Arrow cursor turns into a Stop cursor, indicating that you cannot drag the field that far. Keep in mind that you cannot place any objects outside the page margin.
11. Drag Product (SAP Demo) into the Details section of the Design tab to the right of Product Group.
Note: To select multiple fields, use the Ctrl-click combination to select a non-continuous range of fields. Use the
Shift-click combination to select several fields from the list that are contiguous. The fields appear in the Details section of the report in the same order as in the Field Explorer dialog box.
12. Expand the Key Figures entry. Drag the Net Sales Value field to the right of Product (SAP Demo).
In the Field Explorer dialog box, the system indicates which items have been selected by placing a check mark ( ) on the fields used.
13. Click Print Preview on the Standard toolbar (or View Print tab. The Enter Values dialog appears.
Note: The first time you preview a report, you must select Print Preview to activate the Preview tab. The Preview
tab appears to the right of the Design tab. You can then switch between designing and previewing the report by clicking the corresponding tab.
14. Use the Shift-click combination to select the Bag & Outdoor, Accessories, and Office product groups in the Available Values list. Select the > button to transfer these values to the Selected Values list and select OK.
The system populates the Preview tab based on your selections. The screen should look similar to this:
Resize Fields 15. You can see that the Net Sales field is too small. Return to the Design tab to resize the field. 16. Click the Net Sales field in the Details section to select it. Press the Ctrl key and click the field heading to select both objects.
17. Move the cursor over the resizing handle on the right edge of the fields until the cursor turns into a Resizing cursor. Resize the fields to the right until they are approximately 1.5 inches in length.
18. You need to edit the (SAP Demo) information out of the headings. Select the Preview tab. Right-click on the Product Group field and select Edit Text (you can also use double-click) from the shortcut menu. Remove the extra test so that the heading contains only the Product Group text. Repeat for the Product heading.
Note: You can perform the same function in the Design tab.
The next step is to add summary information to your report. Adding summary information allows you to specify the author, title, and subject of the report, as well as any keywords or comments related to the report. When you add summary information, users can find information related to the report quickly.
19. On the File menu, click Summary Info. The Document Properties dialog box appears with the Summary tab active. 20. Enter information about your report in the text boxes provided. Be sure to complete the Author and Title fields.
Add a title
As you can see, the report looks incomplete without a title. Although you can add a title using a text object, you can also tell the program to take the title information directly from the Title text box in the Document Properties dialog box.
21. Select the Design tab. Expand Special Fields in the Field Explorer. 22. Drag and drop Report Title to the upper left corner of the Page Header section of the report. 23. Drag and drop File Author to the lower left corner of the Page Footer section of the report.
Format an Object
25. You now need to format the title. To center the title, first expand the Title field to the same width as the data in your report. To do this, select the object by clicking it. Position the cursor on the right edge of the object until the cursor turns into a Resizing cursor. Drag the right edge of the field box until it is even with the right edge of the data in the Net Sales field object. 26. You have created a large field that extends from the left edge to the right edge of the report. With the report title object still selected, click Align Center on the Formatting toolbar. 27. Right-click the object and choose Format Field from the shortcut menu. 28. When the Format Editor appears, click the Font tab. Set the report title to a larger, bolder version of the active font by selecting Bold from the Style list and 16 (or a point size suitable to the font you are using) from the Size list. 29. Change the color of the text by selecting a new color from the Color palette. Notice that the Sample box shows an example of how the text will look. Click OK when finished. 30. Drag the bottom edge of the field box down to resize the report title object vertically and accommodate the increased size of the title.
Grouping & Charting 31. Select the menu Insert > Group and select Distribution Channel as the grouping field.
32. Select the Net Sales Keyfigure and right click on the field. 33. Select Insert > Summary and select a Sum for Group #1
34. Right Click the Detail Section in the Preview or Design view and select Hide (Drill down ok).
35. Select the menu Insert > Chart 36. Place the chart to the Report Header (RH).
37. Double-click on one of the distribution channels in the chart to drill-down to the details.
38. Select Save on the SAP toolbar (or use the menu SAP > Save) to save your work. The system displays the Save a Crystal Report to BW dialog. 39. Select the role and enter your report Description. 40. Select Save. The system displays the Save to BW options dialog. Select OK to save your report to the SAP NetWeaver BI system.
1.
Select Start
All Programs
The SAP toolbar will appear on the left of the Start Page display.
2. 3.
In the SAP menu, select Settings. The Settings dialog appears. Select Use MDX driver with support for Multiple structures and select OK.
4.
Now you want to change the Initial Setup and show only the description of the characteristic and the key figures of the BEx query.
5.
Select the menu File > Options > Database and set the option Show Description
Now the Field Explorer will show SAP metadata instead of the technical name for the fields.
6.
In the SAP toolbar, select Create new report from a query. The SAP System dialog appears.
7.
Select the system and click Next. Enter your logon information and select OK. The Select Query dialog appears.
8.
The activated hierarchy from the underlying SAP BW query will result in a parent-child relationship being represented in Crystal Reports. 9. Select the menu Insert > Group.
12. Select the Customize Group Name Field option. 13. Select the description value for the hierarchy to the Medium Name from the characteristic Customer
14. Click OK. 15. Select the menu Report > Hierarchical Grouping options. 16. Select the Sort Data Hierarchically option.
18. Define the Group Indent. 19. Click OK. 20. Hide the detail section of your report. 21. Select the menu View > Print Preview. 22. Enter a date for the keydate variable (use the date of today)
23. Navigate to the Design tab. 24. Add a keyfigure to the details section of the report. 25. Right-click the added keyfigure. 26. Select the menu Insert > Summary.
27. Select Sum as the calculation option. 28. Select Group #1 for the summary location.
The option Summarize across hierarchy allows creating a group summary by adding values from the lower level of a hierarchy up to a higher aggregated level. An example would be to summarize salary figures from the lowest level of an organization hierarchy up to the top level of the hierarchy. In the case of an SAP
BW query as a data source the option Summarize across hierarchy is not necessary because the underlying SAP BW query returns the aggregated values for all hierarchy nodes to Crystal Reports. 29. Move the summary to the Group Header #1. 30. Hide the Group Footer #1 in the report design. 31. Preview the report.
Formulas for Hierarchical Reporting Crystal Reports designer offers some additional formulas and functions that allow the user to create a better report design and provide conditional formatting even in the context of a hierarchy.
Formula Hierarchy Level The first formula for hierarchical reporting is the formula HierarchyLevel(). The formula HierarchyLevel() allows retrieving the level of the hierarchical grouping. The formula needs a GroupLevel as input.
The following is an example for the formula syntax assuming Country Node ID is the grouping field in the report:
Count Hierarchical Children The second formula is CountHierarchicalChildren() which allows counting the number of children of a hierarchy level. The formula needs a GroupLevel as input.
The following is an example for the formula syntax assuming Country Node ID is the grouping field in the report: CountHierarchicalChildren ( GroupingLevel ({Country Node ID}) ) The count of children refers to the number of children in the hierarchy level.
Conditional Formatting with Hierarchy Level With the formulas the report can be conditionally formatted so that the group headings follow an indentation and the keyfigures stay aligned.
To change the formatting of the group headings 1. 2. 3. Start Crystal Reports Designer (Start > Programs > Crystal Reports 2008 > Crystal Reports 2008). Open the report from the previous activity. Navigate to the Design tab.
4.
5. 6. 7. 8.
Set the option Group Indent to 0. Click OK. Right-click the Group #1 Name field. Select the menu Size and Position.
9.
Click the icon for conditional formatting for the X-axis value.
10.
Enter the following formula: (HierarchyLevel (GroupingLevel ({Hierarchy Node ID} ) ) ) *150
Click Save and close. Click OK. Select the menu View > Print Preview.
Copyright
2008 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, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation. IBM, DB2, DB2 Universal Database, OS/2, Parallel Sysplex, MVS/ESA, AIX, S/390, AS/400, OS/390, OS/400, iSeries, pSeries, xSeries, zSeries, System i, System i5, System p, System p5, System x, System z, System z9, z/OS, AFP, Intelligent Miner, WebSphere, Netfinity, Tivoli, Informix, i5/OS, POWER, POWER5, POWER5+, OpenPower and PowerPC are trademarks or registered trademarks of IBM Corporation. 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. MaxDB is a trademark of MySQL AB, Sweden. SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, 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 in several other countries all over the world. 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. These materials are provided as is without a warranty of any kind, either express or implied, including but not limited to, the implied warranties of merchantability, fitness for a particular purpose, or non-infringement. SAP shall not be liable for damages of any kind including without limitation direct, special, indirect, or consequential damages that may result from the use of these materials. SAP does not warrant the accuracy or completeness of the information, text, graphics, links or other items contained within these materials. SAP has no control over the information that you may access through the use of hot links contained in these materials and does not endorse your use of third party web pages nor provide any warranty whatsoever relating to third party web pages. Any software coding and/or code lines/strings (Code) included in this documentation are only examples and are not intended to be used in a productive system environment. The Code is only intended better explain and visualize the syntax and phrasing rules of certain coding. SAP does not warrant the correctness and completeness of the Code given herein, and SAP shall not be liable for errors or damages caused by the usage of the Code, except if such damages were caused by SAP intentionally or grossly negligent.