Inserting a Color Icon in an SAP Query by Using a Simple Condition


There are many instances in which you might want to insert a color icon in a query report. The most popular use of icons is to identify certain records to make them stand out in electronic and printed reports. For example, you could easily insert a warning icon to indicate a line item in a report that requires special attention.

In this next example, you will insert an icon of a small car for any flight arriving in New York to indicate that those flights require shuttle transfers (via car) from the plane. To use local fields to insert an icon based on a single condition, follow these steps:

1.

Navigate to the main screen of the SAP Query tool, using transaction code SQ01. Select the query you want to work with (for example, DLS_QUERY_11) and then click the Change button.

2.

Navigate to the Select Fields screen by using the white forward Next button on the Application toolbar. If the short names are not already displayed, select Edit, Short Names, Switch On/Off. This allows you to create short names for your existing query fields so that you can easily refer to them in calculations. Enter the short name ACITY for the Arrival City field in the Flight Schedule field group.

3.

Click the field name that you will base your calculated field on (for example, the ACITY field).

4.

Select Edit, Local Field, Create. Because your cursor was on the Arrival City field, a custom field is added to its field group (Flight Schedule). The Field Definition dialog box appears.

5.

In the Field Definition dialog box, input a short name for your newly created local field (for example, SHUTTLE) and input a field description (for example, Shuttle).

6.

Define the attributes for the field. Indicate that the field will be an icon.

7.

Click the Icons button at the bottom right of the Field Definition dialog box to bring up a list of icons and their names (see Figure 11.8). Use your cursor to select the name of the symbol you want to use. For example, you could select ICON_CAR, an icon representing a small car. Then click the Choose button. The Field Definition dialog box appears, with the icon name in the Calculation field (see Figure 11.9).

Figure 11.8. Icons, unlike symbols, are in color and are often larger.




Figure 11.9. As with a symbol, the addition of an icon to a report can be based on a condition.


8.

At the bottom of the Field Definition dialog, position your cursor in the text box to the right of the radio button labeled Condition and then type the condition ACITY = 'NEW YORK'. This translates to output the icon if the arrival city is New York. Press Enter to return to the SAP query.

9.

To add the newly created field to your report output, confirm that the field is selected on the Select Field screen. In other words, the small box to the left of the Shuttle field at the bottom of the Flight Schedule field group should be selected.

10.

Navigate to the Basic List Line Structure screen by clicking the Basic List button on the Application toolbar. You should see your newly created field listed there. Add the new local field to your report output on the Basic List screen of the SAP Query tool by using the skills you learned in Chapter 3 (indicating a line and sequence number). Click the Save button on your SAP query.

11.

Execute your report by clicking the F8 Execute button; you are presented with the SAP query's standard selection screen. Click the F8 Execute button again to see your updated SAP query, which now contains your newly added symbol (see Figure 11.10).

Figure 11.10. The newly added column contains an icon of a car for any record that meets the indicated condition.


Note

A color icon appears in an SAP List View (ALV) or in an ABAP list. Depending on your printer settings, icons may appear slightly different in a printed document than onscreen. Icons do not transfer to Microsoft applications.





SAP Query Reporting
SAP Query Reporting
ISBN: 0672329026
EAN: 2147483647
Year: 2006
Pages: 161

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net