Inserting Black-and-White Symbols in an SAP Query by Using a Simple Condition


You have inserted a picture in every row, which can be helpful if the picture is representative of all the data in the report. For this next example, however, let's use a condition to determine whether the picture should be output in each row.

In some cases, you might want to output a picture only if a certain condition exists. For an example using the SAP query you just worked with, you can create a local field that contains a symbol that appears if the passenger is listed as flying in first class. Best practice is to include the output of a symbol or icon in either the first or last position of your report data to call attention to that record.

To output a symbol 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 CLASS for the Flight Class field in the Flight Booking field group.

3.

Place your cursor on the field name that you will base your calculated field on (for example, the Flight Class field).

4.

Select Edit, Local Field, Create. Because your cursor was on the Flight Class field, a custom field is added to its field group (Flight Booking Table). 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, FCLASS) and input a field description (for example, First Class Indicator).

6.

Define the attributes for the field. Indicate that the field will be a symbol.

7.

Click the Symbols button at the bottom of the Field Definition box to bring up a list of symbols and their names (refer to Figure 11.1). Note the name of the symbol you want to use, because you will need to type it in in the next step. For example, you could select SYM_RIGHT_HAND, a symbol representing a hand pointing to the right.

8.

Although the Symbols in Lists dialog box has a button labeled Choose, you actually have to click the green check mark Choose button to return to the Field Definition dialog box and type your symbol name in the Calculation field (see Figure 11.6).

Figure 11.6. You can add a symbol to report based on a condition.


9.

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 CLASS = 'F'. This translates to output the symbol if the class is first class. Press Enter to return to the SAP query.

10.

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 First Class Indicator field at the bottom of the Flight Booking field group should be selected.

11.

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.

12.

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 new symbol for any line that contains data for a first-class passenger (see Figure 11.7).

Figure 11.7. The newly added column contains a symbol for any record that meets the indicated condition.


Note

Depending on your printer settings, symbols may appear slightly different in the printed document than onscreen. Symbols 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