Creating a Ranked List by Using the SAP Query Tool


In this section you will create a ranked list report by using the SAP Query tool, and you will base the ranked list on a calculated field. So this exercise will allow you to practice two skills. The exercises in this chapter use the SAP IDES Test Flight Scheduling system. You will begin by creating an SAP ranked list that ranks the airlines that have the greatest number of available seats left on their current flights. To do so, follow these steps:

1.

Navigate to the main screen of the SAP Query tool by using transaction code SQ01, select the query you want to work with (for example, DLS_QUERY_14, where DLS is my initials), and click the Change button.

2.

Navigate to the Select Field Groups screen and select the field group names that contain the fields you want to include in your report. (In my example, I selected all three.) Click the Next Screen button on the Application toolbar to access the Select Fields screen.

3.

Select the fields you want to include in your report: Airline Carrier ID, Flight Date, Maximum Capacity, and Total of Current Bookings.

4.

If the short names are not already displayed, select Edit, Short Names, Switch on/off to turn them on. Enter the short name MAX for the Maximum Capacity field and the short name OCC for the Occupied Seats field.

5.

Create a calculated field that determines how many seats are free on each flight by taking the number of available seats (Maximum Capacity field) and subtracting the number of seats taken (Occupied Seats field). Position your cursor in the Occupied Seats field to base your calculated field on it.

6.

Select Edit, Local Field, Create. Because your cursor was on the Occupied Seats field, a custom field is added to its field group (Flight Demo Table).

7.

Select Edit, Local Field, Create. The Define Field dialog box appears. Input Free as the short name for your newly created local field, and input the field description Free Seats, which will be the heading for the column in the report.

8.

Define the attributes for the new field. It should have the same attributes as the Occupied Seats field (OCC).

9.

Select the Calculation Formula option button at the bottom of the dialog box (it should be selected by default) and then enter the basic mathematical formula MAX OCC in the box to the right of it (see Figure 14.1). This formula will start with the total maximum capacity for the flight and will subtract the number of seats currently occupied to yield the number of available or free seats left over.

Figure 14.1. The basic mathematical formula is performed to populate the Free Seats column of the report.


10.

Click the Continue button to close the Define Field dialog box and return to the Select Field Groups screen.

11.

Navigate to the Ranked List Structure screen by clicking the Ranked List button on the Application toolbar. The Ranked List Structure screen appears, allowing you to define your report output. Name your compressed list report Ranked_List_1.

12.

Use the Ranked List Structure screen to dictate how you want your report to appear, including rank number specifications. Assign a sequence number to each field that appears in the ranked list to determine the sequence in which they are output. Review the nine options available on this screen (see Table 14.2).

Note

When you define a ranked list, the data is summarized; that is, several data records are processed to determine one line. With numeric fields, the total is always output. Every ranked list must contain at least one numeric field.

Table 14.2. The Options on the Ranked List Structure Screen

Option

Description

Title

This entry field allows you to enter a name for your first list. This title is used as the list header.

Field

All fields selected during the report creation process are listed here.

No

You use these boxes to define the sequence of fields within a ranked list. You can assign sequence numbers between 1 and 98.

Crit

If you select this option button, the field specified on the left is included in the ranked list, and the ranked list is sorted by the ranked list criterion.

Asc

If you select this check box, the fields are sorted in ascending order (low numeric value to high); if you do not select the box, the fields are sorted in descending order (high numeric value to low).

Len

You can choose an output length other than the standard output length. You can make a specification here to improve the layout of your list. Be aware that if the output length you choose is shorter than the standard output length, the field values output in the list will be incomplete.

Rnd

You select this option to specify the number of decimal places to be used when rounding. For example, if you specify 3, the resulting amounts have three places before the decimal point (that is, rounding to the nearest thousand).

Unit

This field appears for any field tied to a unit of measurement (for example, a currency or weight).

Text

If you select this check box, the values of the field specified on the left are used to generate the texts for SAP Business Graphics. If you select several fields, their values are used in the sequence in which they occur. SAP Business Graphics processes up to 30 characters of text per value.


13.

Assign the sequence numbers, starting with 1 and in ascending order, without breaks. Indicate that you want to output the fields Airline Carrier ID, Flight Date, Free Seats, and Maximum Capacity. Specify the sequence in which you want to output the fields, and state whether you want them to be sorted in ascending or descending order, as shown in Figure 14.2.

Figure 14.2. All ranked lists contain lead columns that are determined by the query itself. When you scroll horizontally, these fields always remain visible onscreen.


14.

Indicate that you want to rank on free seats (refer to Figure 14.2).

15.

To execute the report and view the selection screen, press F8.

16.

Press F8 to display your finished report. Your report output should appear similar to that in Figure 14.3, but keep in mind that the actual values vary by organization.



Figure 14.3. This ranked list displays the flights and carrier IDs of the five flights that have the greatest number of available seats.


Helpful Hint

On the Ranked List screen, you can click the Next Ranked List button on the Application toolbar if you want to define another ranked list.





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