Inserting a Color Icon in an SAP Query Using Multiple Conditions with Two Operators


As discussed in Chapter 10, you can use a calculated field to evaluate multiple conditions to produce output.

To use local fields to perform complex calculations, 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.

3.

Select Edit, Short Names, Switch On/Off. Start by giving the Airfare field the short name FARE.

4.

Select Edit, Local Field, Create. Because your cursor was on the Airfare field, a custom field is added to its field group (Flight Demo). 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, POINT) and input a field description (for example, Price point), which will be the heading for the column in the report.

6.

Define the attributes for the field. To output an icon, select the Icon option.

7.

Click the Complex Calculation button to bring up the Define Field: Complex Calculation dialog box, which allows you to input multiple conditions. You input the conditions, as shown in Figure 11.11, very similarly to the way you enter them for a basic calculation; however, in this case, you enter more than one condition.

Figure 11.11. The Define Field: Complex Calculation dialog box lets you enter three conditions, although you are not required to use them all.


8.

Type a condition in the Condition line (for example, FARE < 1000) and type the desired output if the condition is met in the Formula line (for example, ICON_INCOMING_OBJECT).

9.

Proceed to the next Condition line and insert your second condition, using multiple operators (for example, FARE > 1000 AND FARE < 5000) and type the desired output if the condition is met in the Formula line (for example, ICON_OUTGOING_OBJECT).

10.

To check that you have typed correctly, click the Code Check button, shown in Figure 11.11 (or press Shift+F4). Code Check then checks your syntax to ensure that there are no typos.

11.

Click the green check mark Enter button on the Field Attributes dialog box to return to the SAP query.

12.

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 Price Point field at the bottom of the Flight Demo field group should be selected.

13.

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.

14.

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.12).



Figure 11.12. The added icon appears as a down-pointing arrow for rows where the airfare is less than 1,000 and as an up-pointing arrow for those over 1,000 but under 5,000.





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