36
Coy W. Yonce, III 100 Things You Should Know About Reporting with SAP ® Crystal Reports ® Bonn Boston

100 Things You Should Know About Reporting with SAP ... · 100 Things You Should Know About Reporting with SAP ... tells SAP Crystal Reports to use the typeface’s default value

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: 100 Things You Should Know About Reporting with SAP ... · 100 Things You Should Know About Reporting with SAP ... tells SAP Crystal Reports to use the typeface’s default value

Coy W. Yonce, III

100 Things You Should Know About

Reporting with SAP® Crystal Reports®

Bonn � Boston

390_book.indb 3 10/4/11 1:29:31 PM

Page 2: 100 Things You Should Know About Reporting with SAP ... · 100 Things You Should Know About Reporting with SAP ... tells SAP Crystal Reports to use the typeface’s default value

Contents at a Glance

Report Layout1 ........................................................................... 13

Field Formatting2 ....................................................................... 57

Types of Reports and Forms3 ..................................................... 97

Guided Analysis4 ........................................................................ 127

Using Web Technology with Reports5 ....................................... 159

Charting6 .................................................................................... 181

Creating Reusable and Accessible Report Designs7 .................. 203

Using Parameters8 ..................................................................... 235

Distributing Reports9 ................................................................ 257

Extending the Design Experience10 ............................................ 285

Monitoring and Improving Report Performance11 ...................... 313

390_book.indb 5 10/4/11 1:29:31 PM

Page 3: 100 Things You Should Know About Reporting with SAP ... · 100 Things You Should Know About Reporting with SAP ... tells SAP Crystal Reports to use the typeface’s default value

7

Contents

Acknowledgments .............................................................................................. 11

Report LayoutPART 1 .................................................................................... 13

Creating Reports with Different Page Headers1 ...................................... 14Repeating Group Headers across Pages2 ................................................ 17Adding Watermarks to Reports3 ............................................................ 19Setting Up Unlinked Subreports4 ........................................................... 22Setting Up Linked Subreports5 .............................................................. 25Using Subreports as Templates6 for Headers and Footers ....................... 28Using On Demand or In Place7 .............................................................. 31Passing Data between Subreports and Main Reports8 ............................ 34Suppressing and Hiding Sections9 .......................................................... 38Suppressing a Blank Subreport or a Section with a Blank Subreport10 ...... 41Creating Side-by-Side Reports11 .............................................................. 44Suppressing Duplicate Rows12 ................................................................ 47Displaying Records Horizontally13 ........................................................... 50Displaying a Checkbox in a Report14 ....................................................... 52Designing a Cover Page for Reports15 ..................................................... 54

Field FormattingPART 2 ................................................................................ 57

Printing Vertical Text Fields Alongside Horizontal Text Fields16 ............... 58Concatenating Strings with Different Formats17 ...................................... 61Aligning the Vertical Alignment of Text in a Field18 ................................. 65Inserting Leading Zeroes for a Field19 ..................................................... 69Formatting Parts of a String20 ................................................................. 72Forcing a Header or Footer to Grow Automatically or Remain a 21 Specific Size ......................................................................................... 74Displaying Values in a Field That’s Based on a Parameter22 ..................... 77Creating a Running Total with Values Derived from a Formula Field23 ..... 81Creating a Formula to Calculate an Average while Ignoring 24 Zero Values ......................................................................................... 85Creating a Formula to Calculate a Minimum while Ignoring 25 Zero Values ......................................................................................... 87Performing Data Type Conversions26 ....................................................... 90Checking for the Existence of Text27 ....................................................... 93

390_book.indb 7 10/4/11 1:29:32 PM

Page 4: 100 Things You Should Know About Reporting with SAP ... · 100 Things You Should Know About Reporting with SAP ... tells SAP Crystal Reports to use the typeface’s default value

8

Contents

Types of Reports and FormsPART 3 ............................................................... 97

Creating Reports for Immediate Decision Making28 ................................ 98Creating Reports to Support Front Line Managers29 ................................ 102Creating Reports for Upper-Level Management30 .................................... 105Creating Mailing Labels31 ....................................................................... 109Creating an Earnings Statement for a Paycheck32 .................................... 112Creating a Table of Contents for a Report33 ............................................. 115Creating Calendars from an Excel Spreadsheet34 ..................................... 119Laying Out Form Fields35 ........................................................................ 124

Guided AnalysisPART 4 ................................................................................. 127

Highlighting Information36 ..................................................................... 128Showing Visual Indicators37 .................................................................... 131Creating Tool Tips38 ................................................................................ 133Enabling Drill-Down Reporting39 ............................................................ 136Creating a Gradual Drill-Down in a Report40 ........................................... 138Sorting and Ranking within a Group41 .................................................... 141Displaying Top N Records in a Report Based on a Parameter42 ................ 144Applying and Formatting a Sort or Rank in a Crosstab43 .......................... 147Applying Color Banding to a Report44 ..................................................... 149Creating and Using Parameters in a Report45 .......................................... 152Creating Dynamic Cascading Parameters46 .............................................. 156

Using Web Technology with ReportsPART 5 ................................................. 159

Creating Reports from HTML47 Content .................................................. 160Creating Hyperlinks in a Report48 ........................................................... 163Formatting Reports Using Cascading Style Sheets49 ................................. 166Creating Reports from Local XML Documents50 ...................................... 170Using Web Services as a Data Source for a Report51 ................................ 172Creating XML Documents Using SAP Crystal Reports52 ........................... 175Publishing Reports as a Web Service53 .................................................... 178

ChartingPART 6 ............................................................................................. 181

Inserting Bar Charts in Report Details54 .................................................. 182Creating a Combo Chart that Contains a Bar and Line Visualization55 ...... 185Using Overlays with Complex Charting 56 ............................................... 188Removing Decimals57 in the X- and Y-Axis .............................................. 191Formatting Dates in a Chart58 ................................................................. 195Creating Visualizations with Negative Values59 ....................................... 199

390_book.indb 8 10/4/11 1:29:32 PM

Page 5: 100 Things You Should Know About Reporting with SAP ... · 100 Things You Should Know About Reporting with SAP ... tells SAP Crystal Reports to use the typeface’s default value

9

Contents

Creating Reusable and Accessible Report DesignsPART 7 ............................ 203

Creating Effective Report Templates60 ..................................................... 204Providing Default Formatting for a Field61 .............................................. 208Using Chart Styles to Eliminate Unnecessary Report Elements62 .............. 211Creating Reusable Formulas63 ................................................................. 215Setting Default Formatting Options64 ..................................................... 218Using Color Effectively65 ......................................................................... 221Making Text Legible66 ............................................................................ 224Ordering Report Objects for Screen Readers67 ........................................ 227Making Tables Accessible for Screen Readers68 ....................................... 230Naming Formula Fields for Ease of Use69 ................................................ 232

Using ParametersPART 8 ............................................................................... 235

Displaying Parameter Values in a Report70 .............................................. 236Creating a Parameter That Provides an ALL Value71 ................................. 239Allowing Wildcards as a Parameter Value72 ............................................. 241Providing Users with Groupings as a Parameter Value73 .......................... 243Controlling Values Entered into Parameters74 ......................................... 246Finding and Deleting Stubborn Parameters from a Report75 .................... 250Prompting the User for the N Value to Use for Top N Reports76 .............. 253

Distributing ReportsPART 9 .......................................................................... 257

Scheduling Timely Reports77 ................................................................... 258Running Reports Based on Events or Triggers78 ....................................... 261Designing Reports for Effective Excel Exports79 ....................................... 264Choosing the Right Excel Export Option80 .............................................. 267Analyzing Report Data with SAP BusinessObjects Explorer81 ................... 270Sharing Reports on the Web82 ................................................................ 273Embedding Dynamic Reports in Microsoft Office Documents83 .............. 275Exporting Reports to XML84 ................................................................... 279Creating Read-Only Reports85 ................................................................ 281

Extending the Design ExperiencePART 10 ...................................................... 285

Working with Files within a Report86 ...................................................... 286Sending Emails from a Report87 .............................................................. 289Exporting Data to CSV While Processing a Report88 ................................ 292Exporting Data to XML While Processing a Report89 ............................... 295Creating Barcodes in Your Reports90 ....................................................... 298Creating QR Codes in Reports91 .............................................................. 300Looking Up Text in an External File92 ...................................................... 303Creating a Report Index from an Existing Report93 .................................. 305

390_book.indb 9 10/4/11 1:29:32 PM

Page 6: 100 Things You Should Know About Reporting with SAP ... · 100 Things You Should Know About Reporting with SAP ... tells SAP Crystal Reports to use the typeface’s default value

10

Contents

Using Templates to Create Labels94 ......................................................... 307Accessing Windows Functionality from a Report95 .................................. 310

Monitoring and Improving Report PerformancePART 11 ................................ 313

Using a Built-in Dialogue to Monitor Report Performance96 .................... 314Using Selection Formulas to Restrict Report Queries97 ............................ 317Hiding Unnecessary Data98 ..................................................................... 320Offloading the Processing of Report Functions 99 .................................... 322Using SQL Expressions100 ......................................................................... 325

The Author ......................................................................................................... 329Index ................................................................................................................. 331

390_book.indb 10 10/4/11 1:29:32 PM

Page 7: 100 Things You Should Know About Reporting with SAP ... · 100 Things You Should Know About Reporting with SAP ... tells SAP Crystal Reports to use the typeface’s default value

181

Inserting charts into your reports provides your users with a visual way to under-stand relationships and patterns in the information being displayed. If the charts are designed well, they’ll also allow users to make decisions faster. The tips in this section will help you learn the most efficient and effective ways to utilize charts in SAP Crystal Reports.

Part 6

Charting

Things You‘ll Learn in this SectionInserting Bar Charts in Report Details 54 ..................................... 182Creating a Combo Chart that Contains a Bar and Line 55 Visualization ........................................................................... 185Using Overlays with Complex Charting 56 .................................. 188Removing Decimals in the X- and Y-Axis 57 ................................. 191Formatting Dates in a Chart 58 .................................................... 195Creating Visualizations with Negative Values 59 .......................... 199

390_book.indb 181 10/4/11 1:30:04 PM

Page 8: 100 Things You Should Know About Reporting with SAP ... · 100 Things You Should Know About Reporting with SAP ... tells SAP Crystal Reports to use the typeface’s default value

182

Tip 54

Inserting Bar Charts in Report DetailsYou can provide your users with data visualizations directly beside the detailed text in a report. This allows users to see how the detailed item they’re viewing compares to other items in the report.

When viewing a report that has a significant amount of text in the detail, you should provide your users with some context regarding how the detailed level of data that they’re viewing fits into the overall picture. Without a visual representa-tion of how one report element relates to another, viewers must rely on pure text to make this comparison, which will slow down their analysis. However, inserting a bar chart alongside the specific items listed in the detail section of your report is not easy using the existing insert chart feature provided by SAP Crystal Reports 2011. So when you want to display a visual representation of how one value in your detail section relates to another value in your detail section, you must use special characters and formulas to create the proper visualization.

And Here’s How ... For this solution, we’ll will start with a listing report and use a formula to build an in-line bar chart alongside each value in the detail section. As you can see in Figure 1, the initial report displays the list of product categories and their associ-ated sales revenue.

390_book.indb 182 10/4/11 1:30:05 PM

Page 9: 100 Things You Should Know About Reporting with SAP ... · 100 Things You Should Know About Reporting with SAP ... tells SAP Crystal Reports to use the typeface’s default value

Charting Part 6

183

First, create a formula that will calculate the percentage of total sales that are rep-resented by each category. To do this, create a new formula fi eld by right-clicking on Formula Fields and selecting New. Once the Formula Workshop dialogue is displayed, enter the following formula:

{Category_Sales_for_1995.CategorySales} % Sum({Category_Sales_for_1995.CategorySales})

Now that you have the fi eld that calculates the percentage of total sales, you can create another formula fi eld to build the bar chart. Use the following formula for this purpose:

ReplicateString (ChrW(9608), Round ({@Percentage of Total Sales}, 0))

Let’s dissect this formula so that you can understand what’s being done:

The EE ReplicateString function repeats a string that’s identifi ed in the fi rst argu-ment the number of times that’s specifi ed in the second argument.

ChrW(9608)EE is an ASCII character that looks like a solid black box.

The EE Round function calculates the number of times the solid black box needs to be repeated by rounding the percentage formula created above to zero decimal places.

Based on this formula, if we have a percentage amount of 23.1%, then the solid block box represented by ChrW(9608) will be repeated 23 times.

After creating the formula above for displaying the bar chart, insert the percentage formula fi eld and the bar chart formula fi eld into the report by dragging them from the Field Explorer into the design canvas. This should give you a report that looks similar to the screen shown in Figure 2.

Figure 1  « Initial Report with Product Category and Sales

390_book.indb 183 10/4/11 1:30:05 PM

Page 10: 100 Things You Should Know About Reporting with SAP ... · 100 Things You Should Know About Reporting with SAP ... tells SAP Crystal Reports to use the typeface’s default value

184

Tip 54 Inserting Bar Charts in Report Details

  Figure 2  Report with In-Line Bar Chart

Next, reduce the scale of the font used for building the bar chart so that you don’t see spaces between the blocks. Access the Format Editor by right-clicking on the fi eld and choosing Format Field. On the Font tab, you can specify a value for how many spaces should be between each character. The default value is zero. This tells SAP Crystal Reports to use the typeface’s default value for spaces between characters.

We’re going to reduce the number of spaces by inserting a value. For our purposes we’ll use a value of 5, but you can insert other values to determine the best one for your report. The end result will look similar to the screen shown in Figure 3.

  Figure 3  Final Report

390_book.indb 184 10/4/11 1:30:05 PM

Page 11: 100 Things You Should Know About Reporting with SAP ... · 100 Things You Should Know About Reporting with SAP ... tells SAP Crystal Reports to use the typeface’s default value

185

Tip 55

Creating a Combo Chart that Contains a Bar and Line VisualizationBy combining a bar chart with a line chart, you can show variations in values while also displaying a goal line of the value you want to achieve.

When creating reports that contain visualizations, one of the most frequent needs is to display a bar chart that represents a comparison of a measure (e.g., revenue) over a period of time or across a specific context (e.g., product). While displaying how a dimension is tracking over time, it’s also important to compare these values to a baseline or a goal. You can do this by inserting a line across the bar chart that represents the goal for each measure. Unfortunately, this is not straightforward using SAP Crystal Reports, and requires changing one of the series in the bar chart to a line.

And Here’s How ... Let’s create a report that has a single chart to display the change in revenue across a list of product categories. We’ll insert a line across this bar chart that displays a goal line for revenue across each of the product categories.

Figure 1 shows an initial chart available in the report that displays the sales revenue for each product category.

390_book.indb 185 10/4/11 1:30:05 PM

Page 12: 100 Things You Should Know About Reporting with SAP ... · 100 Things You Should Know About Reporting with SAP ... tells SAP Crystal Reports to use the typeface’s default value

186

Tip 55 Creating a Combo Chart that Contains a Bar and Line Visualization

  Figure 1  Initial Visualization Using a Bar Chart

Now we need to create the line that will run along the bars to display how close we have come to hitting the revenue goal for each product category. Since this data is contained within another data source, we need to add this data source to our report. To do this, choose Database • Database Expert. Select the data source where the goal data is contained and insert the relevant tables into the selected tables on the right side of the Database Expert. Click on OK, and the fi elds from the new data source will be added to the Field Explorer.

Now that the data is available, add this data into the current bar chart as another series. Right-click on the chart and choose Chart Expert. In the Chart Expertdialogue, navigate to the Data tab and insert the Revenue Goal fi eld under the Show Value(s) heading by selecting the Revenue Goal fi eld under Report Fieldsand clicking on the greater than (>) sign next to the Show Values(s) heading. Click on OK and you’ll see that a new bar is inserted alongside the previous bar. This new bar represents the revenue goal.

To change this bar into a line visualization, right-click on the bar and select Series Options . With the Series Options dialogue open, select Line for the Show Select Series As option. Click on OK and you’ll see that the revenue goal is now displayed as a line across the bars that represent the actual revenue for each product category. After a bit of formatting, your chart can look something like the one shown in Figure 2.

390_book.indb 186 10/4/11 1:30:05 PM

Page 13: 100 Things You Should Know About Reporting with SAP ... · 100 Things You Should Know About Reporting with SAP ... tells SAP Crystal Reports to use the typeface’s default value

Charting Part 6

187

  Figure 2  Final Visualization

390_book.indb 187 10/4/11 1:30:06 PM

Page 14: 100 Things You Should Know About Reporting with SAP ... · 100 Things You Should Know About Reporting with SAP ... tells SAP Crystal Reports to use the typeface’s default value

188

Tip 56

Using Overlays with Complex Charting Building charts that can sit on top of one another in layers provide your users with more context about their data.

There may be times when the charting capabilities don’t allow you to build the visualization you require to display information to your users. For example, SAP Crystal Reports does allow you to build a combo chart that shows a line chart on top of a bar chart, but if you want to display the bar chart horizontally, then it’s not possible to include a line as one of your series. In this tip, we’ll show you how to bypass this issue and create this type of combo chart by using two charts, with one sitting on top of the other.

And Here’s How ... Figure 1 displays a visualization that uses a horizontal bar chart for showing the total sales revenue for each product category. We want to create a line chart that represents the total revenue goal for each product category and overlay this line chart on top of the bar chart.

Now, create the line chart that will display vertically across the top of the bar chart. The first thing to do is to insert a new report header section beneath the existing one.

Right-click on the existing report header section and select Insert Section Below. This inserts a new report header called RHb. Now, insert a line chart into this new report header section. This opens the Chart Expert. On the Type tab of the Chart Expert, ensure that you’re creating a line chart, and then set the chart to display

390_book.indb 188 10/4/11 1:30:06 PM

Page 15: 100 Things You Should Know About Reporting with SAP ... · 100 Things You Should Know About Reporting with SAP ... tells SAP Crystal Reports to use the typeface’s default value

Charting Part 6

189

horizontally. Setting the chart to display horizontally forces the X-axis to become the vertical axis, thus displaying the line chart in the same orientation as the bar chart.

  Figure 1  Initial Visualization with a Bar Chart

Navigate to the Data tab and use the Category Name fi eld for the On Changeof option and the Revenue Goal fi eld for the Show Value(s) option. After a bit of formatting to remove unnecessary elements from the chart, you should have something similar to Figure 2.

  Figure 2  Line Chart with Ornamentation Removed

The background color for the line chart needs to be set to transparent to allow the bars on the bar chart to show through the background of the line chart. To do this,

390_book.indb 189 10/4/11 1:30:06 PM

Page 16: 100 Things You Should Know About Reporting with SAP ... · 100 Things You Should Know About Reporting with SAP ... tells SAP Crystal Reports to use the typeface’s default value

190

Tip 56 Using Overlays with Complex Charting

right-click on the line chart and select Format Background. Set the foreground color to transparent rather than white and click on OK.

The last step is to overlay the line chart on top of the bar chart to create the fi nal visualization. Right-click on the RHa section (i.e., the one with the bar chart) and choose Section Expert. On the Common tab, select the Underlay Following Sections option. This forces the bar chart to display under the line chart. After a bit of formatting, you should have something similar to Figure 3.

  Figure 3  Final Visualization Showing a Bar Chart and Line Chart Together

390_book.indb 190 10/4/11 1:30:06 PM

Page 17: 100 Things You Should Know About Reporting with SAP ... · 100 Things You Should Know About Reporting with SAP ... tells SAP Crystal Reports to use the typeface’s default value

191

Tip 57

Removing Decimals in the X- and Y-AxisYou can help users better understand numeric values by removing unnecessary decimal places.

Sometimes the numeric data coming from your database is stored with additional decimal places, even when there is no value after the decimal. When including these numeric values in the X- and/or Y-axis of a chart, showing values after the decimal adds nothing to the interpretation of the visualization and can be confus-ing for users. SAP Crystal Reports makes it possible to remove these decimal places easily for the Y-axis, but not as easily for the X-axis.

And Here’s How ... The numeric values in the following chart that are coming from the database have values after the decimal; however, there’s no need to display them, as they’re always zeroes. So we’re going to format the values to remove those decimal places shown in the X-axis in Figure 1.

There are two ways to change the format of the X-axis and, unfortunately, neither of them are exposed via the Format Editor. You cannot format a numeric value in the X-axis using the normal field-formatting capabilities.

390_book.indb 191 10/4/11 1:30:06 PM

Page 18: 100 Things You Should Know About Reporting with SAP ... · 100 Things You Should Know About Reporting with SAP ... tells SAP Crystal Reports to use the typeface’s default value

192

Tip 57 Removing Decimals in the X- and Y-Axis

  Figure 1  Initial Visualization with Decimals in the X-axis

Default Numeric FormattingIn the fi rst option, change the default numeric formatting style. The X-axis of a chart uses the default styles for formatting the values. If you don’t mind impacting the global formatting of all numeric values displayed in SAP Crystal Reports to use no decimal places by default, then you can use this option.

Click on File • Options, which brings up the Options dialogue , where you can navigate to the Fields tab. On this tab, you’ll see various buttons that allow you to modify the default formatting options for the String , Number , Currency , Date , Time , Date and Time , and Boolean fi elds. For our purposes, we want to modify the default numeric value , so click on the Number button. This brings up the For-mat Editor. Navigate to the Number tab and can select an option with no decimal places under the Style dropdown menu, such as the one shown in Figure 2.

Click on OK to close the various dialogues and then refresh your report. You should see that the decimal places are removed from the numeric values in the X-axis.

390_book.indb 192 10/4/11 1:30:07 PM

Page 19: 100 Things You Should Know About Reporting with SAP ... · 100 Things You Should Know About Reporting with SAP ... tells SAP Crystal Reports to use the typeface’s default value

Charting Part 6

193

FormulaIf you don’t want to affect the global style for all numeric values, then you can use the second option: Create a formula that turns the number into a string. To do this, create a new formula fi eld by right-clicking on Formula Fields and selecting New. In the Formula Workshop dialogue, enter the following formula:

ToText ({auto_mpg_txt.mpg_continuous},0)

This formula will convert the MPG fi eld into a string and force the formatting to set the number of decimal places to zero.

Next, replace the database fi eld displayed in the chart with your new formula fi eld. To do this, use the Chart Expert, which you access by right-clicking on the chart and selecting the Chart Expert command. In the Chart Expert dialogue, remove the current fi eld in the On Change Of section of the chart by selecting the fi eld under the On Change Of heading and clicking the less than (<) sign. Insert the formula fi eld into the On Change Of section by selecting the formula fi eld and clicking the greater than (>) sign as shown in Figure 3.

Figure 2  « Changing the Default Numeric Style

390_book.indb 193 10/4/11 1:30:07 PM

Page 20: 100 Things You Should Know About Reporting with SAP ... · 100 Things You Should Know About Reporting with SAP ... tells SAP Crystal Reports to use the typeface’s default value

194

Tip 57 Removing Decimals in the X- and Y-Axis

  Figure 3  Replacing a Numeric Field with a Text Field in the Chart Expert

390_book.indb 194 10/4/11 1:30:07 PM

Page 21: 100 Things You Should Know About Reporting with SAP ... · 100 Things You Should Know About Reporting with SAP ... tells SAP Crystal Reports to use the typeface’s default value

195

Tip 58

Formatting Dates in a ChartYou can help your readers understand reports more easily by ensuring that the dates displayed in your report follow the formats typically used by your organization.

Often when you return data in a report, it isn’t in the format you want to display. This is often the case with date fi elds, as they can be stored in a variety of formats depending upon the database or the application that inserted the data. If you dis-play date formats with which your users aren’t familiar, it creates confusion and potentially incorrect analysis of information. With SAP Crystal Reports 2011, it’s possible to format the dates in a chart to be displayed based on specifi c require-ments for each report. In this tip, we’ll show you multiple ways to change the format of a date fi eld in a chart.

And Here’s How ... Let’s look at a chart that displays the list of store open dates for a retail store and provides a count of the number of stores opened for each time period. As you can see from Figure 1, the report currently shows the date in a format of 1/1/2011.

Figure 1  « Initial Chart with Default Date Format

390_book.indb 195 10/4/11 1:30:07 PM

Page 22: 100 Things You Should Know About Reporting with SAP ... · 100 Things You Should Know About Reporting with SAP ... tells SAP Crystal Reports to use the typeface’s default value

196

Tip 58 Formatting Dates in a Chart

Default Date Format

The fi rst method to format the dates is to modify the default date format. You can do this by changing the default format for all dates that are displayed in any report built using SAP Crystal Reports. If this is an option, access the Options menu and then click on File • Options.

In the Options dialogue , click on the Date button and then navigate to the Date tab. From here, you can modify the default date format. After changing the default date format, refresh your report to ensure that the new format is shown in your chart.

Numeric Axis Chart If changing the default date format for all reports is not an option and you’re using a bar, line, or area chart for your visualization, then you can use a numeric axis chart instead.

To do this, open the Chart Expert by right-clicking on the chart and selecting Chart Expert. In the Chart Expert, navigate to the Type tab and select Numeric Axis. Be sure to select a date axis chart and then click on OK. This changes the chart type. You can now format the axis label by right-clicking on it in the chart and selecting Format Axis Label. As shown in Figure 2, you can navigate to the Number tab and change the Date format.

Figure 2  « Date Format Options for Numeric Axis Chart

390_book.indb 196 10/4/11 1:30:07 PM

Page 23: 100 Things You Should Know About Reporting with SAP ... · 100 Things You Should Know About Reporting with SAP ... tells SAP Crystal Reports to use the typeface’s default value

Charting Part 6

197

Base Chart off of GroupAnother method is to base the chart off of a group. First, insert a group into the report based on the date fi eld you want to use in your report. Then insert a sum-mary fi eld for the measure you want to visualize. When inserting the summary (in our case, a count of the number of stores), be sure to select the Add to all Group Levels option before clicking on OK.

You can now launch the Chart Expert and navigate to the Data tab. From here, click on the Group button as shown in Figure 3, and specify the group fi eld and summary fi eld to use for the chart. Format the date fi eld in the group with the date format you want to use to display the date.

  Figure 3  Chart Based Off of a Group and Summary Field

Base Chart off of Crosstab Your fi nal option is to base the chart off of a crosstab rather than a group. To do this, you fi rst need to insert a crosstab into your report with the values you want to use for your visualization. Once you’ve inserted the crosstab, access the Chart Expert and navigate to the Data tab. As shown in Figure 4, select the fi elds you want to use for your chart. You have the additional option of subdividing your chart , based on the rows in the crosstab. You can then format the date fi eld in the crosstab to affect the format of the date fi eld in the chart.

390_book.indb 197 10/4/11 1:30:08 PM

Page 24: 100 Things You Should Know About Reporting with SAP ... · 100 Things You Should Know About Reporting with SAP ... tells SAP Crystal Reports to use the typeface’s default value

198

Tip 58 Formatting Dates in a Chart

  Figure 4  Chart Based Off of a Crosstab

390_book.indb 198 10/4/11 1:30:08 PM

Page 25: 100 Things You Should Know About Reporting with SAP ... · 100 Things You Should Know About Reporting with SAP ... tells SAP Crystal Reports to use the typeface’s default value

199

Tip 59

Creating Visualizations with Negative ValuesWhen you create reports for analytical purposes, you may need to create charts that effec-tively display negative values. You can do this by modifying the scale of the report.

When creating visualizations that report off of numeric values, you need to include the potential to visually display negative numbers. This is helpful when creating visualizations that show inventory levels where there are backorders or negative profit margins. Including negative values in your visualizations properly takes some understanding of the available options in the Chart Expert. With SAP Crystal Reports, you can create these types of visualizations by modifying the scale of the chart, which we’ll explain in this tip.

And Here’s How ... For this solution, we’ll create a report that contains a bar chart for displaying the change in the Consumer Price Index (CPI) for Atlanta, Georgia, from 2001 to 2011. The dataset currently has values for the year, the month within each year, and the CPI for each month. It doesn’t contain a value representing a change in the CPI. The first thing to do is create a formula field to calculate the change. Your formula should look like the following:

{Pivot_.CPI} - Previous({Pivot_.CPI})

With this formula field created, you can now create your visualization. For our purposes, we’ll create a group on the year and then insert a chart into a secondary group header, as you can see in Figure 1.

390_book.indb 199 10/4/11 1:30:08 PM

Page 26: 100 Things You Should Know About Reporting with SAP ... · 100 Things You Should Know About Reporting with SAP ... tells SAP Crystal Reports to use the typeface’s default value

200

Tip 59 Creating Visualizations with Negative Values

  Figure 1  Initial Chart Missing Values

As you can see, we’re missing several values from the formula fi eld. One of the reasons for this is that the CPI can only be tracked for each month in the dataset. The other reason is because the bar chart only shows positive values.

To ensure that the chart shows negative values, you need to change the ranges for the axis. Right-click on the chart and choose Chart Expert. Once the Chart Expert dialogue is open, navigate to the Axes tab . As shown in Figure 2, turn off the Auto Range option and set a manual range. Select the Min and Max ranges that are appropriate for your data. For example, if your possible lowest value is -10, then you should set the Min to a value of -10.

  Figure 2 Modifying the Data Range in the Chart Expert

390_book.indb 200 10/4/11 1:30:09 PM

Page 27: 100 Things You Should Know About Reporting with SAP ... · 100 Things You Should Know About Reporting with SAP ... tells SAP Crystal Reports to use the typeface’s default value

Charting Part 6

201

After clicking on OK to close the Chart Expert dialogue, you’ll notice that your bar chart displays a zero line with bars going above and below the zero line.

The next step is to apply a color change to the bars based on whether the value is above or below zero. Reopen the Chart Expert dialogue, but choose the Color Highlight tab. Click New to create a new condition and select the CPI Changefi eld as the fi eld to evaluate. Set the evaluation to be less than a value of 0.00 and set Format Color to Red, as shown in Figure 3.

  Figure 3  Color Highlighting in the Chart Expert

The condition you just created will change the color of the bar to red if the visual-ized value is less than 0. You can now create a new condition to evaluate the same fi eld for a value greater than zero. After creating both conditions and exiting the Chart Expert, you’ll see that you have green and red lines based on the value of the CPI change fi eld.

Clean up the bar chart by turning off the gridlines; right-click on the Y-axis label and select Data (Y) Axis Options . In the Data (Y) Axis Settings dialogue, navigate to the Gridlines tab and turn off the Show Major Gridlines option. To clean the bar chart even further, set the chart frame border to be transparent so that only the zero line, X-axis line, and Y-axis line are displayed, as shown in Figure 4.

390_book.indb 201 10/4/11 1:30:09 PM

Page 28: 100 Things You Should Know About Reporting with SAP ... · 100 Things You Should Know About Reporting with SAP ... tells SAP Crystal Reports to use the typeface’s default value

202

Tip 59 Creating Visualizations with Negative Values

  Figure 4  Final Visualization

390_book.indb 202 10/4/11 1:30:09 PM

Page 29: 100 Things You Should Know About Reporting with SAP ... · 100 Things You Should Know About Reporting with SAP ... tells SAP Crystal Reports to use the typeface’s default value

331

?ALL, 242, 245

A

Accounts Receivable statements, 124Add custom value, 243Additional functions, 286, 292, 310a href, 162, 164Allow custom values, 253Allow multiple values, 237ALL value in parameter, 239Alternating page headers, 14Analysis, 127Appearance and personalization, 299Array, 95, 245asmx, 172, 179, 180ASP.NET web site, 167, 179Attributes, 162Auto Range option, 200Average, 323Average calculation, 86Axes tab, 200AZTN, 301

B

B, 162Background color, 168Bar chart, 182, 185, 186, 211Bar chart and line chart, 190Barcodes, 298, 301Base chart off crosstab, 197Base chart off group, 197BIG, 162BI inbox, 260BI launch pad, 104BODY, 162Boolean, 52, 192Bottom N, 107, 144, 148, 253Bottom percentage, 107

BR, 162Build website, 180Business processes, 102

C

Calendar, 119, 123, 259Cascading Style Sheets, 166CDate, 91CDateTime, 91CENTER, 162Change group options, 18Change subreport links, 26, 35, 45, 123, 251Character spacing exactly, 59Chart, 105, 107, 181, 211Chart Expert, 106, 186, 193, 199, 212Chart styles, 211Checkbox, 52, 53Checking for null values, 94Checking for numeric values, 93Checking for the existence of a partial text

string, 94Checking for the existence of text, 93Checkmark, 132Chelsea Technologies, 286, 289, 292, 295CodeType, 302Color-banded rows, 150Color banding, 149Color highlighting, 201Color Highlight tab, 201COM and .NET UFLs, 286, 289, 292, 295Combo chart, 185Comparison of a measure, 185Complex charting, 188Composite information view, 44Concatenate, 61Concatenating

Strings with different formats, 61Conditional format, 130, 132Conditional formulas, 129Conditionally hiding subreports, 41

Index

390_book.indb 331 10/4/11 1:30:32 PM

Page 30: 100 Things You Should Know About Reporting with SAP ... · 100 Things You Should Know About Reporting with SAP ... tells SAP Crystal Reports to use the typeface’s default value

332

IndexIndex

Conditional page header, 14Confidential, 20

data, 19text object, 20

Consumer Price Index (CPI), 199Controlling values, 246Conversions, 90Count, 95Cover page, 54CR.COM, 273Create custom value, 240Create new parameter, 152, 156, 157Create parameter, 154Create reports from local XML documents, 170Create running total field, 87Creating operational reports, 98Crosstab, 147CrossTab Expert, 147Crosstab top N, 148CRUFLContents, 305CRUFLFileManagement, 286CRUFLFileManagement.dll, 286CRUFLGrid, 292CRUFLIndex, 305CRUFLXML, 295CrystalKiwi, 305Crystal Reports, 275, 276CrystalReports.com, 273, 274Crystal Reports read only, 281CrystalReportViewer, 168CSS, 168CSV, 279, 292Currency, 192CurrentLocale, 304Custom functions, 215Customize group name, 119cViewMail, 289

D

Data, 302Database, 326Database Expert, 160, 174Database files, 171Data labels, 106Data range, 200

Data type conversions, 90Data (Y) axis options, 201Data (Y) axis settings, 201Date, 91, 192Date and time, 192DateDiff, 288DatePart, 120, 122DateTime, 91DayOfWeek, 120, 122Default.aspx, 168Default date format, 195Default formatting options, 218Default numeric style, 193Define, 261Destination, 260Detail, 137, 156

section, 149Directed analysis, 127Display parameter values, 236Display string, 52Display user values, 238Distinct count, 323DIV, 162dlSoft, 300DLU2Dbars, 301Double, 91DrillDownGroupLevel, 139, 140Drilling, 105, 136, 321Drill-through reporting, 136Duplicate records, 47Dynamic cascading parameters, 156Dynamic cascading prompt, 158Dynamic list of values, 237Dynamic reports, 275

E

Earnings Statement, 112, 114Edit Mask option, 247Edit parameter, 240Edit Parameter dialogue, 237, 244Effective Excel exports, 264Email, 260, 289Enterprise, 258Enterprise reporting, 97Evaluation time, 217

390_book.indb 332 10/4/11 1:30:32 PM

Page 31: 100 Things You Should Know About Reporting with SAP ... · 100 Things You Should Know About Reporting with SAP ... tells SAP Crystal Reports to use the typeface’s default value

333

Index Index

Events, 261Events to trigger upon completion, 263Events to wait for, 263Excel, 264, 267, 269

export, 267Explorer in the cloud, 271Export, 264, 267, 279, 281, 295

report, 280Export data to XML, 295Exporting data to CSV, 292Extending the design experience, 285

F

Field Explorer, 29, 174, 236Field formatting, 57Field interpreted as HTML, 161Fields, 207, 208FileManagementFileCopy, 287, 288FileManagementFileDelete, 288FileManagementFileExists, 287File system, 260Filters, 127Find and delete parameters, 250Find in formulas, 250Fit section, 265FONT, 162Fonts, 207Footers, 28Form, 126Format, 259

Best practices, 264Format background, 190Format Editor, 134, 218Format field, 52, 160, 164Format graphic, 132, 301Format subreport, 31, 32Formatting dates, 195Formatting the chart, 106Formula, 136

field, 136workshop, 134, 149

Formula field, 293, 301, 323Formulas, 90, 325Formula Workshop, 66, 115, 176, 183, 215,

240, 242, 304Free-form text, 246

Front line managers, 102Front line personnel, 98FTP, 260Funds Transfer Forms, 124

G

Global, 95, 115, 217Goal line, 185Gradual drill-down, 138Graphic location, 302GridCellClear, 293GridCellLoadRawValue, 293GridCellSave, 294Gridlines, 106Grids, 265Grid UFL, 293Group, 103Group by, 120Group Expert, 138Group footer, 89, 142, 176Group header, 17, 39, 89, 100, 101, 103,

117, 120, 130, 136, 141, 156, 176GroupName, 130Group Report Expert, 147Group Sort Expert, 142, 143, 146, 254Guided analysis, 127Guidelines, 265

H

H1, 162Headers, 28Hide, 38, 137, 140

drill-down OK, 40report sections, 15, 38

Hide (drill-down OK), 137Hide (drill-down okay), 321Hierarchy, 17, 156Highlighting, 129

information, 128Highlighting Expert, 128, 129HL7, 279Horizontal alignment, 219Horizontal bar chart, 188

390_book.indb 333 10/4/11 1:30:33 PM

Page 32: 100 Things You Should Know About Reporting with SAP ... · 100 Things You Should Know About Reporting with SAP ... tells SAP Crystal Reports to use the typeface’s default value

334

IndexIndex

Horizontal records, 50HTML, 160, 162, 279HTML anchor tag, 164HTML tags, 160, 162Hyperlinks, 163Hyperlinks inserted into report, 165

I

IDAutomation, 298IDAutomation_SUni_XL, 299IDAutomation_Uni_C128C, 299Ignoring zero values, 87Import XML transform, 279Improving report performance, 313Inbox, 260Include negative values, 199Index, 306IndexEntryClear, 306IndexEntrySave, 306IndexEntryStore, 306Indexes, 323Informative text, 133INI, 310In-line bar chart, 182, 184In place, 31Insert subreport, 22, 25, 34, 45InStr, 94InStrRev, 94Interactive analysis, 275Interactive report elements, 127Interpret text as HTML, 163Invoice, 124IsNull, 94, 176

J

Join, 238JXDM, 279

K

Keep group together, 18

L

Labels, 58, 109, 111, 307Landscape, 119Languages, 260Latest report changes, 315Layout, 264Leading zeroes, 69Left, 63Line chart, 185, 188, 189Linked subreports, 25Listing, 115List of values, 99, 125, 241LiveOffice, 275, 277

add-on, 275Live Office Insert Wizard, 276Load template, 213Local, 115, 288Locales, 304LocalLookup, 303Long-term strategic reports, 105Long-term trends, 105Look up, 303, 304Look up text, 303

M

Mailing Label Report Wizard, 109, 110, 307Main report, 44

with two subreports side-by-side, 46Main report preview, 167MakeArray, 245Manage XML exporting, 279

formats, 279, 280Map Fields dialogue, 308Match type, 309Max, 200Median, 136Metrics, 102, 105Microsoft Excel, 270

(97 – 2003), 267(97 – 2003) Data-only, 268Workbook data-only, 259, 269

Microsoft Office documents, 275Microsoft Word, 109, 275Min, 200

390_book.indb 334 10/4/11 1:30:33 PM

Page 33: 100 Things You Should Know About Reporting with SAP ... · 100 Things You Should Know About Reporting with SAP ... tells SAP Crystal Reports to use the typeface’s default value

335

Index Index

Minimum, 87Modify the default numeric value, 192Monitoring report performance, 313Month, 122More data sources, 288Multiple context, 105Multiple page headers, 14

N

Negative values, 199New page after, 55Non-zero values, 86Nth day of the month, 259Number, 192Number converted to words, 92Number of records, 317Numbers to text, 92Number to date conversion, 91Numeric axis chart, 196Numeric fields, 69NumericText, 93

O

Object properties, 278Object size and position, 265Office 2007, 269Offload, 322On-demand, 31

subreport, 32Open from repository, 278Operational report, 98, 99Options, 218Options dialogue, 192, 196Orientation, 105Outlook, 311Outlook.exe, 312Overlays, 188

P

Page, 55Page footer, 177Page header, 14, 19, 125, 177Page number, 15Paragraph, 161

Parameter, 99, 127, 144, 152, 157, 235field, 101, 125, 144, 152, 156, 235,

236, 240, 247panel, 247value, 243value masks, 246

Parameter edit mask options, 248Passing data between subreports, 34Paycheck, 112PDF, 114Performance Information dialogue, 314Performance timing, 314Perform grouping on server, 322, 326Picture, 131, 301Precisely formatted, 97Printing, 14Print state, 217Processing, 315Prompt group text, 125Prompts, 259Publish report as a web service, 178, 179Purchase orders, 124

Q

QR code, 300image, 301

R

Rank, 141, 147Rank in a crosstab, 147Ranking, 144, 253

parameter, 145Read only, 281Read-only reports, 281RecordNumber, 293Record Selection Formula, 101, 104, 122Record Selection Formula Editor, 154Recurrence, 259Reducing the amount of information, 128Refresh all objects, 278Refresh object, 277Removing decimals, 191Repeating group headers, 17

390_book.indb 335 10/4/11 1:30:33 PM

Page 34: 100 Things You Should Know About Reporting with SAP ... · 100 Things You Should Know About Reporting with SAP ... tells SAP Crystal Reports to use the typeface’s default value

336

IndexIndex

ReplicateString, 183Report custom function, 215Report definition, 252, 315Report footer, 177Report header, 105, 177Report header template, 29Report index, 305, 306Report layout, 13Report options, 323Report preview, 167Report Wizard, 23Reposition images, 132Repository, 257Request for disability forms, 124Reset page number after, 55Right, 63Round, 183rptr, 281Rulers, 265Running totals, 87, 323

S

SAP BusinessObjects, 104SAP BusinessObjects BI, 258

platform, 258, 274, 276SAP BusinessObjects BI launch pad, 258SAP BusinessObjects Central Management

Console, 261SAP BusinessObjects Edge, 258SAP BusinessObjects Explorer, 270SAP BusinessObjects LiveOffice, 275, 277SAP BusinessObjects OnDemand, 270SAP Crystal Reports

for Visual Studio 2010, 166standalone viewer, 271template, 167viewer, 270

SAP Crystal Server, 258Save as, 273Save as template, 213Saved data, 315Save to repository, 278Schedule, 259, 261, 263Scheduling, 258

Schema, 171Section Expert, 15, 20, 38, 40, 55, 111, 137,

139, 149, 190, 321Select data in subreport based on field, 27Select distinct records, 48Select Expert, 125Selection formulas, 101, 104, 122, 154, 207,

245, 317, 318SendMailUFL, 289Separated values (CSV), 269Series, 106Series options, 186SetClipboardText, 312Set CSS class, 168Set datasource location, 307

dialogue, 307Set the text interpretation, 161Setup, 119Shared, 217Sharing data between reports, 25ShellExecute, 311, 312Short-term strategic objectives, 102Short-term strategic reports, 102Show major gridlines, 201Side-by-side reports, 44Single value selection, 243Size and position, 265SMALL, 162Smart tag, 168SMTPMsgBody, 290SMTPMsgClear, 290SMTPMsgSaveOutbox, 290SMTPMsgSendOutbox, 291Solution Explorer, 168Sort, 147Sorted and ranked crosstab, 148Sorted group header, 142Sort Expert, 148Sorting, 141Sorts, 127SPAN, 162Span a single section, 58Span multiple sections, 60Special fields, 54Split, 114SQL, 323

390_book.indb 336 10/4/11 1:30:33 PM

Page 35: 100 Things You Should Know About Reporting with SAP ... · 100 Things You Should Know About Reporting with SAP ... tells SAP Crystal Reports to use the typeface’s default value

337

Index Index

expressions, 325, 326Standard Report Creation Wizard, 23, 206STRIKE, 162String, 192Strings with different formats, 61StringVar, 117, 288, 290, 311Style, 168

of the report, 166Sub-divide chart, 197Subreport, 107, 108

options, 42Subreports, 22, 25, 26, 28, 29, 31, 44

as templates, 28Sum, 126, 130Summary, 141Supported HTML attributes, 162Supported HTML tags, 162Suppress, 38, 48, 105, 118, 119, 132, 137,

139, 140blank subreport, 41duplicate rows, 47no drill-down, 51page header, 15report sections, 38

Switch to fields, 276System events, 262

T

Table of Contents, 115, 118, 306Tags, 162Template Expert, 206, 210Templates, 109, 204, 208, 307Text interpretation, 165Text object, 124Text to numbers, 92Time, 91, 192ToNumber, 92Toolbox, 168Tool tip, 133

text, 134Top N, 107, 143, 144, 148, 253, 323

reports, 253Top percentage, 107ToText, 63, 116, 135, 193, 312

ToWords, 92TR, 162Tracking over time, 185Triggers, 261Type conversions, 90Types of reports, 97

U

U21win32, 310UBound, 66, 95UFL, 285, 289, 292, 295, 298, 300, 303,

305, 310, 311Underlay following sections, 20, 60Universe query, 275Unlinked subreports, 22Update, 308UpperCase, 62Use a formula, 89Use editor, 216Use export options defined in the report,

260Use extractor, 215Use formula as group name, 119Use indexes or server for speed, 323User-filtered values, 236User function libraries, 217User function libraries (UFL), 285, 310User parameters, 239Use web service data source, 173

V

Value options, 247, 253Variable, 66Variations in values, 185Vertical alignment, 65Vertical field spanning multiple sections, 60Vertical text fields, 58, 59View in browser, 180Visual indicators, 131Visual information, 105Visualizations, 211Visual Studio, 168

390_book.indb 337 10/4/11 1:30:34 PM

Page 36: 100 Things You Should Know About Reporting with SAP ... · 100 Things You Should Know About Reporting with SAP ... tells SAP Crystal Reports to use the typeface’s default value

338

IndexIndex

W

Watermarks, 19Web-based data formats, 159Web-based viewer, 274Web-enabled data structures, 159Web Service Definition Language, 172Web services, 170, 172, 173, 174, 178Web technology, 159WhilePrintingRecords, 293, 296Wildcards as a parameter value, 241Windows variables, 310World Label, 307WSDL, 172, 173

X

X-axis, 192, 201XBRL, 279xlsx, 269

XML, 170, 171, 172, 175, 176, 177, 279, 295, 296, 304export options, 280transform (XSL), 279

XML and web services, 172data source, 173

XMLFileCloseheader, 297XMLFileCreateheader, 296XMLFileEndGroup, 296XMLFileStartGroup, 296XMLFileWriteTag, 296XSL, 279Xunit, 302

Y

Y-axis, 201Year, 62, 122

390_book.indb 338 10/4/11 1:30:34 PM