Enter word you want search.

วันอาทิตย์ที่ 2 กรกฎาคม พ.ศ. 2560

Chapter 6. Using Reporting Selection Screens: Advanced Skills

Chapter 6. Using Reporting Selection Screens: Advanced Skills

In this chapter

Now that you understand how important selection screens are and how you can use them to produce multiple types of reports from a single query, you can take them a step further. This chapter covers the advanced usage of selection screens and how you can use them in query-based reporting.

Module-Specific Options on a Selection Screen

Depending on the data source (InfoSet) selected and the module for which it is designatedHuman Capital Management (HCM), Accounts Payable, Sales and Distribution, and so ondifferent options may be available. This book covers many of them, but to best familiarize yourself with the items specific to the reporting area you are interested in, you should begin with a basic list report from within your area of interest and vary your selections to view the result on your selection screen and on your report output.

Using Multiple Selection Buttons

Next to many of the fields on a selection screen is a multiple selection button (see Figure 6.1).
Figure 6.1. Each multiple selection button is a right-pointing arrow.



This button, located immediately to the right of the input field, allows you to specify multiple selections. In an example in Chapter 5, "Basics of Using Reporting Selection Screens" (refer to Figure 5.4 and Table 5.2), you input a value of 1 in the Employee Group field so that the report output would contain only associates (that have a number 1 designation in the Employee Group field) on their records. The multiple selection button gives you even more options.

Single-Value Inclusions

The first tab available in the Multiple Selection dialog box is Single Vals (indicated by two green circles), which gives you the ability to designate more than one single (nonsequential) entry. For example, if I select the multiple selection button to the right of the Employee Group field on the HCM report example from Chapter 5, I am indicating that I want to include associates from Employee Groups 1, 2, and 5 in the report, as shown in Figure 6.2.
Figure 6.2. By indicating Employee Groups 1, 2, and 5, I ensured that associates classified in those categories are included and that all others are excluded.



Range Inclusions

The second tab available in the Multiple Selection dialog box is Ranges (indicated by two green circles), which gives you the ability to designate a consecutive range of data by indicating start and end values. This data can be numeric or alphabetical; in either case, you enter the lower value in the first box (for example, A) and the higher value in the second box (for example, C). For example, if I selected the multiple selection button to the right of the Employee Group field on the HCM report example and then selected the Ranges tab, I could then indicate that I want to include associates from Employee Groups 1 through 7 in the report, as shown in Figure 6.3.
Figure 6.3. By indicating a consecutive range for the Multiple Selection option for the employee group, I ensured that associates classified in any of the Employee Groups 1, 2, 3, 4, 5, 6, and 7 are included in the report output.



Single-Value Exclusions

The third tab available in the Multiple Selection dialog box is Single Vals (indicated by two red circles), which gives you the ability to designate more than a single entry to be excluded from your report output. For example, when I click the multiple selection button to the right of the Employee Group field on the HCM report example and select the Ranges tab, I can indicate that I want to include associates from Employee Groups 1 through 5, as shown in Figure 6.3. If I then select the Single Vals (indicated by two red circles) tab and input value 3, I would be including in the report output associates in Employee Groups 1, 2, 4, and 5 and excluding Employee Group 3, as shown in Figure 6.4.
Figure 6.4. By indicating any values on the Single Vals tab (indicated by two red circles), I ensure that I will output all values except those where an employee group equals 3.


Range Exclusions

The fourth tab available in the Multiple Selection dialog box is Ranges (indicated by two red circles), which gives you the ability to designate a consecutive range of data to exclude by indicating start and end values. This data can be numeric or alphabetical, and again, you enter the lower value in the first box (for example, 1) and the higher value in the second box (for example, 3). For example, when I click the multiple selection button to the right of the Employee Group field on the sample HCM report and then select the fourth tab, I can indicate that I want to exclude associates from Employee Groups 1 through 5 in the report by indicating a starting value of 1 and an ending value of 5.
Helpful Hint
You can tell if multiple selections have been input for a field because the multiple selection button (to the right of the field) includes a green box under the existing yellow arrow. This signifies that values are input somewhere on the Multiple Selection dialog box for that field. (See the Personnel Number multiple selection button in Figure 6.7 later in this chapter.)

The Multiple Selection Dialog Box Toolbar

By now you have noticed that the Multiple Selection dialog box has a toolbar at the bottom (see Figure 6.5). The following sections describe each of these toolbar buttons.
Figure 6.5. The toolbar options present in the Multiple Selection dialog box give you even more flexibility in excluding or excluding data.


Execute
The first button on the Multiple Selection dialog box toolbar is the Execute button. This button functions the same as the Enter key: When you click it, any selections on the dialog box are transferred to the selection screen.
Check
The second button on the Multiple Selection dialog box toolbar is the Check button. This button functions as the validation key that checks your selections for validity and applicability.
Selection Options
The third button on the Multiple Selection dialog box toolbar is the Selection Options button. This button gives you even greater flexibility in selection, including options for equal to, greater than or equal to, less than, not equal to, and so on. This button was available in earlier versions of SAP, before the multiple selection button was enhanced.
Insert Lines and Delete Lines
Two buttons, Insert Lines and Delete Lines, allow you to insert and delete lines in a dialog box so you can insert or remove indicated values.
Delete
The sixth button on the Multiple Selection dialog box toolbar is the Delete button. This button deletes any entry or selections in any area of the dialog boxnot just the displayed tab.
Help
The next button on the Multiple Selection dialog box toolbar is the Help on Screen button. This button is available on almost all dialog boxes, and it serves as a specific item help reference.
Multiple Selection
The Multiple Selection button serves the same function as the multiple selection arrow button that appears next to a field. Clicking this button brings up a list of all available options that are valid for the selected field.
Import from Text File
The Import from Text File button on the Multiple Selection dialog box toolbar allows you to restrict your report output based on a pasted-in or imported set of values. This button is covered in the next section.

Restricting Values in a Report Based on an Existing List of Values

The Import from Text File button on the Multiple Selection dialog box toolbar is the button you are likely to use most often when reporting. It serves a couple different purposes. This button allows you to specify the precise list of data you want in your report output by using a pasted-in or imported list of values from any source.
For example, in my job, I am often provided with data from third-party solutions, such as a large Excel file that contains a list of associates' Social Security numbers. Let's pretend that this list of associates is from my benefits vendor, which is alerting me that the list of associates contains associates who can expect to have a benefits coverage change. I would like to easily identify these associates so that I can send each of them a personalized letter, informing them of the change. In the old days, I could use a Microsoft Access database to compare data from two sources and merge similar data (which is discussed in Chapter 23, "SAP Reporting with Microsoft Access"), or I could use Excel's VLook-Up function to compare two data sources. However, by clicking the Import from Text File button, I can paste or upload the data I want directly into the selection screen to restrict my SAP query report output to contain only the records that match those included in the third-party file. For example, if my SAP HCM database contained 15,000 associate records, and my vendor sent me a list of 1,000 Social Security numbers, I could look up each one manually to find the correct name and address, use a Microsoft solution, or leverage the functionality of the Import from Text File button and simply reference the third-party values in one of the two ways described in the following sections.
Pasting in Third-Party Values
The first way to restrict values in a report is by pasting third-party values. To reference third-party values, you can either design a new SAP query report or use an existing one. In my third-party values example, upon execution of the query, when the selection screen is presented, I can go to the field that contains a value from the third party. In my list of Social Security numbers, I would simply make sure that the Social Security Number field is available on the selection screen. (For a quick refresher on how to add fields in a query to a selection screen, see the section "The Selections Screen" in Chapter 3, "Creating Basic Reports with the SAP Query Tool.") When I am viewing the query's selection screen, I minimize the SAP environment and navigate to the third-party file. Its format is relatively unimportant, so it is best to open it in a known application, such as Notepad or Excel. Then I select the datain this example, all 1,000 Social Security numbers contained in the fileand then press Ctrl+C to copy this list to the Windows Clipboard. Next, I navigate to the SAP query report and the selection screen for the report and click the multiple selection button followed by the Import from Text File button. A second dialog box appears. When I click the Paste button, the list of 1,000 Social Security numbers is pasted from the Windows Clipboard memory to the value selection for the dialog box. When the SAP Query tool is executed, it will not contain all 15,000 records in the database; instead, it will contain detailed data for only the 1,000 values specified on the selection screen.
Transferring Text From a Text File
Instead of copying and pasting, you can restrict values in a report by transferring data directly from a file by clicking the Transfer button instead of the Paste button in the Import from a Local file dialog box and indicating the navigation path where the source file can be found (for example, c:\My Documents\source file.txt). When I use this methodology when the SAP Query tool is executed, the report will not contain all 15,000 records in the database; instead, it will contain detailed data from SAP for only the 1,000 values specified in the source file that have been transferred to the selection screen.

Using Variants

As mentioned throughout this chapter and Chapter 5, you can use a single SAP query report to satisfy multiple reporting needs simply by changing the values entered on the report's selection screen. To spare a user from having to enter the values each time a report is executed, you can save entries on a selection screen as a variant. A report can have an unlimited number of variants associated with it.
As discussed in Chapter 5, which introduces the concept of selection screens, one basic report (for example, a list of all associates at Mama Tricarico's Restaurant) can be run with three different variations on the selection screen to produce three different reports. The following sections describe how to make a saved version of a selection screen for an SAP query report.

How to Create a Variant for an SAP Query

You can create a variant in several different ways. The following instructions work for any version of SAP, beginning with version 4.0:
1.
Begin at the main screen of the SAP Query tool, which you reach by using transaction code SQ01. Select the query for which you would like to create a variant by selecting (highlighting) the gray bar to the left of the table or by typing the query name in the box at the top of the screen. (The example used here uses a test HCM query. To follow along, you can use an existing query of your own from any application module.)
2.
Select Goto, Maintain Variants. The screen ABAP Variants - Initial Screen, shown in Figure 6.6, appears.

Figure 6.6. You use the screen ABAP Variants - Initial Screen to create variants for SAP queries.

3.
Type a name for your variant (for example, DLS_Variant01, where you replace DLS with your initials) and then click the Create button. You are presented with the selection screen for the report for which you decided to create a variant in step 1. This screen gives you the opportunity to input selections that will be saved as a variant (see Figure 6.7).



Figure 6.7. This selection screen lets you input selections that will be saved as a variant.

4.
Input values on the selection screen that you want to save. Which specific values you input for the example are unimportant, but for the sake of this example, input the Period field as of today and enter the value 1 in the Employee Group field. After inputting any values you want to save, click the Save button on the Application toolbar. The first time you save the variant, the Save Attributes screen, shown in Figure 6.8, appears. When you modify an existing variant, you can click the Variant Attributes button to access this screen.

Figure 6.8. The Save Attributes screen looks the same for all reporting variants.

5.
The only required field for entry on the Save Attributes screen is the Description field. Enter a description for your variant in this field and then click the Save button to complete the variant creation process. It is a good idea to use a description that describes the variant (refer to Figure 6.8).
6.
Click the green Back button to return to the Maintain Variants screen.
7.
Click the green Back button again to return to the main SAP Query tool screen.
To see that the variant you created is now available for the report, you need to execute the report that has the variant, as described in the following section.
Executing a Report with a Variant (Execute with Variant)
Upon report execution, you can select a variant for use in your report. By using variants, you can use a single report for multiple things, based on the information entered on the selection screen. Multiple variants can exist for a report, and you can decide which one to use prior to report execution by following these steps:
1.
Begin at the main screen of the SAP Query tool, which you reach by using transaction code SQ01. Select your report and then click the Execute with Variant button on the Application toolbar. A dialog box that contains a drop-down field of all the variants for the selected report appears.
2.
Select the variant you want to use and then press Enter.
3.
Click the Execute button. The report executes, displaying the saved variant.
Executing a Report with a Variant (Execute)
You call also select the variant of your choice from a report's selection screen. Multiple variants can exist for a report, and you can decide which one to use upon report execution by following these steps:
1.
Begin at the main screen of the SAP Query tool, which you reach by using transaction code SQ01. Select your report and then press F8 or click the Execute button. The report's selection screen appears.
2.
On the Selection screen's Application toolbar, click the Get Variant button (immediately to the right of the Execute button). A dialog box containing a drop-down field of all variants for the selected report appears.
3.
Select the variant you want to use and then press Enter.
4.
Click the Execute button. The report executes, displaying the selected variant.
Saving an SAP Query with a Variant
In addition to selecting a variant prior to or upon report execution, you can save a variant with a query as a default, such that when the report is executed, that variant is automatically used to populate the report's selection screen.
1.
Begin at the main screen of the SAP Query tool, which you reach by using transaction code SQ01. Select your report and then click the Change button. The Title, Format screen of the SAP Query tool appears.
2.
In the Special Attributes section of the Title, Format screen, select the Variant drop-down box to see a list of all variants that exist for the selected report.
3.
Select the variant you want to use and then press Enter.
4.
Check the Execute Only with Variant check box.
5.
Click the Save button and then press F8 or click Execute.
6.
Click the Execute button. The report executes, displaying the saved variant. Because it was saved with the query, every time it is executed, the saved default variant will be used. The variant can be overwritten with new values, or a new variant can be selected after execution; however, it will always be presented as the default.
Editing a Variant for SAP Query (Directly on the Selection Screen)
After a variant is created, you can modify it on the selection screen by following these steps:
1.
On the selection screen, change the values as desired and then click the Save button on the Application toolbar. A confirmation box appears, asking if you want to overwrite the existing variant.
2.
Click Yes. The changes to your variant are saved.
Editing a Variant for SAP Query (on the Maintain Variants Screen)
After a variant is created, you can modify it on the Maintain Variants screen by following these steps:
1.
Begin at the main screen of the SAP Query tool, which you reach by using transaction code SQ01. Select the query for which you would like to modify the variant by selecting (highlighting) the gray bar to the left of the table or by typing the query name in the box at the top of the screen.
2.
Select Goto, Maintain Variants. The screen ABAP Variants - Initial Screen appears.
3.
Select your variant from the drop-down box and then click the Change button. You are presented with the selection screen for the report.
4.
Modify the values on the selection screen as you like and then click the Save button on the Application toolbar.
5.
To modify the attributes, click the Variant Attributes button and make the desired changes.
6.
Make any other modifications desired on this screen and then click the Save button to complete the variant modification process.

Advanced Functions for Variants

To see what options are available on the Variant Attributes screen, follow these steps:
1.
Begin at the main screen of the SAP Query tool, which you reach by using transaction code SQ01. Select the query for which you would like to modify the variant by selecting (highlighting) the gray bar to the left of the table or by typing the query name in the box at the top of the screen.
2.
Select Goto, Maintain Variants. The screen ABAP Variants - Initial Screen appears.
3.
Select your variant from the drop-down box and then click the Change button. You are presented with the selection screen for the report.
4.
Click the Variant Attributes button to view the available options on the Save Attributes screen (refer to Figure 6.8).
The Save Attributes screen has dozens of available options. Table 6.1 describes the general options available.
Table 6.1. General Functions Available on the Save Attributes Screen
Option
Description
Variant Name
This field contains the name of the variant that is input on the Maintain Variants screen during the creation process.
Description
This field contains the required description field that users must populate with a description of the variant.
Created for Selection Screens
This field displays the number of the R/3 dynpro (screen) that is displayed at runtime. It may also be recorded in trace or logging information.
Only for Background Processing
If you select this check box, the variant can be executed only in the background. If you do not select it, it can be run both in the background and online.
Protect Variant
If you select this check box, the variant can only be changed by the person who created it or who last changed it.
Only Display in Catalog
If you select this check box, the variant name appears in the directory but not in the general input help.
System Variant (Automatic Transport)
This system variant is transported automatically.

The Field Attribute options listed in Table 6.2 can be indicated for any of the fields by placing a check mark in the bog next to each.
Table 6.2. Field Attributes Available on the Save Attributes Screen
Option
Description
Required Field
This attribute indicates that the designated field requires entry on the selection screen prior to report execution.
Switch GPA Off
The field contents are ignored when the variant is imported.
Save Field Without Values
If you select this field, the value of the corresponding field on the selection screen is not affected when you start the program by using a variant.
Selection Variable
If you select this field, the field on the selection screen is assigned a value from a variant variable.
Hide Field 'BIS'
If you are using BIS, if you select this option, the corresponding field is not displayed when the user starts the program using this variant. However, you can still assign a value to the field in the variant.
Hide Field
If you select this option, the corresponding field is not displayed when the user starts the program using this variant. However, you can still assign a value to the field in the variant.
Protect Field
If you select this option, the user cannot overwrite the value in the field on the selection screen.

Note that the bottom section of the Save Attributes screen lists every field available on the selection screen. Each is classified with a type. The field type indicates whether the field is a parameter (P) or selection option (S).
Helpful Hint
The selection screens designated for the program are displayed one after the other. Because a parameter or selection option can occur on more than one screen, the attribute fields for that field accept input only the first time they appear.

Things to Remember

  • The Multiple Selection dialog box has four key tabs.
  • The Import from Text File button allows you to restrict your report output to data contained in a third-party list or data source.
  • You can create a virtually unlimited number of variants for a single SAP query report.
  • You have multiple options when executing a report with a variant, including saving the variant in the SAP Query tool as a default for a specific query.
  • You can prevent users from modifying entries on a report's selection screen by using the Protect option.

วันพุธที่ 4 พฤศจิกายน พ.ศ. 2552

Chapter 5. Creating QuickViews by Using QuickViewer



Understanding QuickViewer

Unlike the SAP Query tool, which is a complete reporting solution tool, the SAP QuickViewer tool, delivered with SAP version 4.6 and above, is a WYSIWYG (what you see is what you get) utility for quickly collecting data from an R/3 system. To define a report by using the QuickViewer, you simply enter texts (titles) and select fields and options to define the QuickView. With this tool, you create QuickViews, not reports. Users cannot share QuickViews as they can reports, but they can convert QuickViews to reports to use them with the SAP Query tool.

Like the other Query tools, the QuickViewer allows you to define reports without having any technical or programming knowledge. The QuickViewer is especially useful for new users and occasional system users. The QuickViewer is basically a single-screen version of the SAP Query tool. Although QuickViews are user dependent, you can convert a QuickView into a SAP Query report to make the information available to others.

QuickViews have the same functional attributes as queries. However, there are a number of differences between QuickViews and queries created using the SAP Query tool:
  • Basic lists QuickViews can define only basic lists, as opposed to the multiple-line queries and ranked or statistical lists that the SAP Query tool can create.
  • Security Security initial setup is simpler in the QuickViewer than in the SAP Query tool because no query group assignment is necessary with QuickViews.
  • User dependency Each user has his or her own personal list of QuickViews, and unless they are converted to SAP queries, QuickViews cannot be shared or exchanged among users.
  • Data source Unlike with the SAP Query tool, with the QuickViewer, you are not required to use an InfoSet. When you define a QuickView, you can specify its data source dynamically. You can use tables, database views, table joins, logical databases, and even InfoSets as the data sources for QuickViews.
  • Modes A similarity between the SAP Query tool and the QuickViewer is that each provides two modes for designing reports: a standard mode (called Basis mode) and a graphical mode (called Layout mode).
The QuickViewer emulates the SAP Query reporting tool on a single screen. It is divided into three major sections:
  • The top left lists the tables and data fields contained in the data source.
  • The bottom left is the Help application.
  • The right side of the screen is the QuickViewer main screen, where you design a QuickView. The main screen section has three tabbed sections that you use to specify a QuickView.
Creating a QuickView by Using QuickViewer

Creating a QuickView by using the QuickViewer tool is simple. You just follow these steps:

1. Navigate to the main screen of the SAP R/3 QuickViewer by using transaction SQVI (see Figure 5.1). (You can also open the QuickViewer's main screen by clicking the QuickViewer button on the main screen of the SAP Query tool or by choosing an application-specific role from the Easy Access menu.)


Figure 5.1. The main screen of the QuickViewer reporting tool looks very similar to the main screen of the SAP Query tool.


2. On the main screen, enter a name for your QuickView (for example, QUICKVIEW_1) and then click the Create button. A dialog box appears, asking you to select your data source (see Figure 5.2).


Figure 5.2. The selection of a data source at design time mirrors the process of creating a data source during configuration.


3. On the Create QuickView: Choose Data Source dialog box, insert a title (for example, Sample QuickView) and, if desired, insert comments (for example, the date it was created).

4. Identify where your data is coming from by selecting an option in the Data Source field (for example, a logical database). When you select a data source, the bottom of the screen changes to show suboptions specific to the data source (for example, a specific logical database). For this example, enter the logical database Flight Scheduling System (f1S).

5. At the bottom of the dialog box, choose to create the QuickView in Basis mode. When you are done making entries and selections in this dialog, click the green arrow Enter button.

6. Select the first tab on the main screen, the List Fld. Select tab, which lists the output fields. Select any fields on the right side of the screen, listed in the Available Fields grouping, by selecting the gray keys to the left of the field names, and then click the left-pointing single-arrow button between the two groupings. To move all fields in the data source so that they will be included in your report output, click the left-pointing double-arrow button (see Figure 5.3).


Figure 5.3. You indicate what fields you want to be output in your QuickView by using the Fields in List column section of the main screen.


7. Select the second tab, Sort Sequence, to dictate the sort order for the selected fields (see Figure 5.4). Indicate a desired order by selecting fields on the right side of the screen, in the Available Fields grouping, and then click the left-pointing single-arrow button between the two groupings. The selected fields appear in the Fields in List column, in the order in which they were selected. Use the radio buttons to the left of the fields to specify that you want the field to be sorted in ascending or descending order.

Figure 5.4. You can sort in ascending or descending order.


8. Select the third tab, Selection Fields, to indicate what fields to include on the QuickView's selection screen upon execution (see Figure 5.5). (Note that some fields already exist, as indicated by a lock icon, based on designations in the logical databasef1S in this caseselected for the QuickView.) Select fields on the right side of the screen, in the Available Fields grouping, and then click the left-pointing single-arrow button between the two groupings. The selected fields appear in the Selection Fields column. For example, Figure 5.5 shows that the Flight Class field has been added.

Figure 5.5. You can add fields to the selection screen to specify particular data upon execution.

9. Select the fourth tab, Data Source, to confirm that the QuickViewer is using the correct data source for this QuickView (see Figure 5.6).

Figure 5.6. You can display the details of your data source by clicking the Display button.


10. Note in the middle of the screen that you have different export options for the QuickView. SAP List Viewer is the default, but you can select a different option from the Export As drop-down box.
11. Click the Execute button on the Application toolbar to view the report's selection screen. If needed, further specify your selections on the selection screen.

12. Click the Execute button to see your completed QuickView, which should look similar to the QuickView shown in Figure 5.7.


Figure 5.7. The QuickView output looks similar to the output of an SAP query.


Modifying a QuickView

After you create a QuickView, only you have access to it, because it is user-dependent (unless you convert it to an SAP query). However, you can return to an existing QuickView and make changes by following these steps:

1. Navigate to the main screen of the SAP R/3 QuickViewer by using transaction SQVI. (You can also open the QuickViewer's main screen by clicking the QuickViewer button on the main screen of the SAP Query tool or by choosing an application-specific role from the Easy Access menu.)

2. Select an existing QuickView from the list (or type in its name) and then click the Change button. The QuickViewer: Initial screen appears.
3. Make any required changes to the QuickView.

4. Save your changes by clicking the Save button on the Application toolbar.


Using QuickViewer in Layout Mode

As mentioned earlier in this chapter, you can use the QuickViewer in Basis or Layout mode. Layout mode provides a graphical representation of the QuickView. To see a QuickView in Layout mode, follow these steps:
1. Navigate to the main screen of the SAP R/3 QuickViewer by using transaction SQVI. (You can also open the QuickViewer's main screen by clicking the QuickViewer button on the main screen of the SAP Query tool or by choosing an application-specific role from the Easy Access menu.)
2. Select an existing QuickView from the list (or type in its name) and then click the Change button. The QuickView main screen appears.

3. Select Goto, Layout Mode (or press F5). The screen displays graphically, as shown in Figure 5.8.


Figure 5.8. The QuickView output looks similar to the output of the SAP Query tool when displayed in Layout mode.


Converting a QuickView to a SAP Query
As mentioned earlier in this chapter, QuickViews are user-dependent, and other users cannot use them. If you have created a QuickView and you want to share it with others or add to it functionality that is not supported by QuickView, you can convert the QuickView to an SAP query. To do so, follow these steps:

1. Navigate to the main screen of the SAP R/3 Query tool by using transaction SQ01.

2. Select Query, Convert QuickView. A Convert QuickView dialog box, like the one shown in Figure5.9, appears. The very first alphabetical QuickView you have created appears in this dialog, as does your username.


Figure 5.9. All the QuickViews you have created are listed in the QuickView drop-down box.


3. Click the green check mark Enter button. New fields appear on the dialog box (see Figure 5.10). Enter a name for your SAP query. Your assigned query group is listed here as the default query group.

Figure 5.10. You must input a name for your converted QuickView and declare an InfoSet.


4. If the QuickView you want to convert was created using a logical database, a table, or a table join, input your choice for the InfoSet. The InfoSet is then generated automatically. Recall from Chapter 2 that the SAP Query tool's functionality is based on InfoSets. To be able to proceed in the SAP Query tool, you must define an InfoSet (data source) for this query.

5. Click the green check mark Enter button. Your QuickView is now in your list of SAP queries.

วันจันทร์ที่ 2 พฤศจิกายน พ.ศ. 2552

Chapter 4. The Fundamentals of Reporting with the SAP Query Tool



SAP Query Reporting in the Real World


Your First Official Report Request

For this example, you need to prepare a report that answers the question, "In your SAP solution, how many flights with Plane Type A319 are scheduled for arrival in the city of Frankfurt on the flight date June 1995?" (Although your SAP system may contain different information than this example, the report format should be the same.) This type of request is common in the sense that it asks for an answer based on multiple criteria.

The example presented in this chapter shows how you can use a single report multiple times to satisfy multiple needs without having to change the core report. To answer the question posed earlier, you execute a basic list SAP query report (which you should call DLS_Query_02, where DLS is your initials) that includes the fields you need for output in addition to some other fields. Figure 4.1 shows the output of this report.


Figure 4.1. The report output screen of the SAP Query tool, listing the fields used in the report to answer the question in this example.


When you review the report output, you can easily answer the question posed earlier. The answer in this example is 1. (Your answer may be different, depending on your system output.)


Best Naming Conventions for SAP Query Reporting

Because it is so easy to create reports, many companies end up with a library of thousands of reports, many of which are duplicates. To ensure that your organization is utilizing the reporting functionality in the most efficient manner possible, it is a good idea to set some guidelines. Following three rules will ensure a clean library and SAP environment, assist you in custom report identification, and help with upgrades, where applicable, because you can easily identify key reports and report creators:

1. When you create custom reports that you intend to reuse for yourself, use a naming convention such as DLS_ReportName, replacing DLS with your initials.

2. When you create custom reports that you do not intend to reuse (designed for single-inquiry lookup), use a naming convention such as DELETE_DLS01, replacing DLS with your initials. Routinely delete reports whose names have the prefix DELETE_ to ensure that your library remains clean and efficient.

3. When you create custom reports that are standards for your organization (and that will be used by multiple users), use a common prefix to identify them as major reports that can be used by anyone. For example, you could follow the convention ABC_Report04, where ABC is an abbreviation of your company's name.


SAP Query Maintenance Functions

Copying Existing SAP Queries (Same Client, Same Query Group)

Follow these steps to copy a query:

1. Navigate to the main screen of the SAP Query tool by using transaction code SQ01 and select from the list the query you want to copy (or type the query's name in the Query box at the top of the screen).

2. Click the white copy button on the Application toolbar. A dialog box like the one shown in Figure 4.2 appears.


Figure 4.2. The Copy a Query dialog box allows you to enter a new name for your copied query.


3. Type in a new name for your copied SAP query in the To Query Name box and then press Enter. Be sure to follow the naming rules discussed earlier in this chapter when naming the copied query.

4. When your copied SAP query appears in the same user group as the original, change the long report title (description) of the copied query to distinguish it from the original.


Copying or Moving Existing SAP Queries (Same Client, Different Query Group)

Follow these steps to copy a query to a new query group:

1. Navigate to the main screen of the SAP Query tool by using transaction code SQ01 and select from the list the query you want to copy (or type the query's name in the Query box at the top of the screen).

2. On a scrap of paper, write the name of the query and the name of the query group in which it currently resides.

3. Press Shift+F7 to view a list of all query groups to which you are assigned.

4. Double-click the query group you want to move the query to. You are now on the main screen of the SAP Query tool, and the query group is listed on the top left of the screen.

5. Click the white Copy button on the Application toolbar.

6. When a dialog box like the one shown in Figure 4.2 appears, take a look at your scrap of paper and type the query and query group names into the form.

7. Type a new name for your copied SAP query in the To Query Name box, ensuring that the Query (User) Group lists the new query group name to which you are moving the query.

8. Press Enter. Your copied SAP query, with its new name, appears in the new query group, along with the original query group.

9. Be sure to change the long report title (description) of the copied query to distinguish it from the original (as needed), and be sure to follow the naming rules discussed earlier in this chapter when naming the copied query

10. If you want to move and not copy a query, return to the original query group by pressing Shift+F7 and then delete the copied query as described in the following section.


Deleting SAP Queries

To delete an SAP query, follow these steps:

1. Navigate to the main screen of the SAP Query tool by using transaction code SQ01 and select from the list the query you want to delete (or type the query's name in the Query box at the top of the screen).

2. Select the trash can Delete button on the Application toolbar (see Figure 4.3).
Figure 4.3. The Delete Query dialog box allows you to delete existing queries.


3. When a Delete Query dialog box like the one shown in Figure 4.3 appears, confirm that you want to delete the query by pressing Enter. A message appears in the bottom left of the screen, letting you know that the query has been successfully deleted.


Working on Your Existing

Now that you have learned how easy it is to create queries, copy them, and delete them, you need some real-world practice with editing and making changes to a query that already exists. Here is your opportunity to practice receiving report requests, performing maintenance, and editing them.
As your first exercise, create an SAP query from scratch and name it DLS_Query_03 (replacing DLS with your initials). The query should contain the following output: flight class, airline carrier ID, arrival city, maximum capacity, plane type, and airfare. Your finished output should be similar to what is shown in Figure 4.4.
Figure 4.4. Your report output will vary from what is shown here, based on your system's data, but the column format should appear the same.


Navigating Through an Existing SAP Query


After a query is created, quite often you need to return to it and make modifications. You have a couple options for editing existing queries and the related navigation:
  • You can navigate to the main screen of the SAP Query tool by using transaction code SQ01 and select from the list the query you want to copy (or type the query's name in the Query box at the top of the screen).
  • You can click the Change button to open your existing SAP query for editing. You are then presented with the first of the five basic screens of the SAP Query tool.
  • You can navigate between the screens of the SAP Query tool by using the directional arrows at the top left of the screen and by clicking the Basic List button on the Application toolbar to get to the last screen.
  • You can navigate between the five basic screens of the SAP Query tool by using menu paths. From any screen in the SAP Query tool, you can select Goto, Field Selection, and then select one of the first four screens to jump directly to it. You can access the last screen, the Basic List screen, by selecting Goto, Basic


Modifying an Existing Query: Adding Fields

Now that you have mastered navigating an existing query, you can move on to the next exercise: Modify the SAP query you created in the preceding exercise (refer to Figure 4.4) by implementing the following changes: Add a Weight of Luggage field between the Plane Type and Airfare fields. Also add the Flight Date and Destination Airport fields at the end of the report. Your finished output should appear similar to Figure 4.5.

Figure 4.5. Your revised report output will vary from what is shown here, based on your system's data.


Now that you have finished editing your query, you can move on to your next exercise: Modify your query by removing the output of the Flight Class, Airline Carrier ID, and Arrival City fields, but continue to indicate that you want to sort on the Flight Class field (see Figure 4.6). Your finished output should look similar to what is shown in Figure 4.7.


Figure 4.6. You use the Basic List screen of the SAP Query tool to define the report output.


Figure 4.7. My sample report output when displayed in the SAP List Viewer auto-sizes each column to fit its contents.


To test all the skills you have learned in this chapter, you can try one final exercise: Make a copy of your existing SAP query and name it DLS_Query_04 (replacing DLS with your initials). Change the title of the query on the first screen of the SAP Query tool to reflect that it is SAP Query 4. In this copied version, add the following fields: Text:Maximum Capacity (as the first field in the report output), Text:Flight Class (to the right of the Flight Date field), and Smoker and Text:Smoker (as the last two fields in the report). Add totals to appear in the report for the Maximum Capacity and Weight of Luggage fields. Your finished output should look similar to what is shown in Figure 4.8.


Figure 4.8. In this example, some of my column data is blank; this will vary based on what is stored in the database.

วันศุกร์ที่ 30 ตุลาคม พ.ศ. 2552

Chapter 3. Creating Basic Reports with the SAP Query Tool


Creating a Basic List Query by Using the SAP Query Tool

To create a basic list query by using the SAP Query tool, follow these steps:

1. Log in to your SAP client where your query reports will be created. (Best practice dictates that they be maintained in your live Production client.)

2. Navigate to the Maintain Queries Initial screen by using the transaction code /nSQ01. Beginning with R/3 release 4.6A, SAP offers a graphical version of the SAP Query tool, called the Graphical Query Painter; if you have not used the SAP Query tool, the Graphical Query Painter is set as your default. To turn off the Graphical Query Painter and learn to create easy step-by-step reports by using the SAP Query tool, select Settings, Settings and then deselect the Graphical Query Painter check box.

3. The title bar lists the query group you are currently in. For example, your title bar might read Query from User Group ZTEST: Initial Screen. If you are assigned to multiple query groups, press F7 to see a list of all of them.

4. As discussed in Chapter 1, "Getting Started with the SAP R/3 Query Reporting Tools," it is recommended that you create your queries in the standard query area. Ensure that you are in the standard query area by selecting Environment, Query Areas and then selecting Standard Area.

5. In the Query field, type DLS_QUERY_01 where DLS is your initials) as the name for the query you are creating, and then click the Create button (see Figure 3.1).


Figure 3.1. The main screen of the SAP Query tool lists all the queries available in the designated query group.


6. The InfoSets of User Group ZTEST window appears, listing all the available InfoSets (that is, data sources) for your query group. Because you created only one (in my example, I called it ZTEST), in Chapter 2, "One-Time Configuration for Query Tool Use," it will be the only one listed. Select the InfoSet you created (ZTEST, in my example) and then click the green check mark button.

7. The Create Query Title Format screen appears. This screen allows you to save the basic formatting specifications for your query, including the name (title) and any notes you want to store for the query. The only required field is the Title (long report description). For this example, fill in only the Title field, as shown in Figure 3.2, and then click Save. (For my example, I used the title (DLS) SAP Query Exercise #01.)


Figure 3.2. The Application toolbar for the SAP Query tool contains navigational arrows that permit you to navigate between the screens of the query.


8. Navigate to the next screen in the SAP query creation process by selecting the Next Screen (white navigational arrow) button from the Application toolbar. (You can use the navigational arrows to navigate between the different screens of the SAP Query tool.) The Select Field Group screen appears, listing all the Field groups available within your InfoSet. Figure 3.3 shows this screen with the field groups Flight Schedule [SPFLI], Flight Demo Table [SFLIGHT], and Flight Booking [SBOOK] listed.


Figure 3.3. All the field groups listed at the top right of the InfoSet screen during configuration of the InfoSet are listed on this screen.


9. Place a check mark next to each field group from which you want to include fields in your report. Navigate to the next screen in the SAP query creation process by selecting the Next Screen (white navigational arrow) button on the Application toolbar. The Select Field screen appears, showing a list of all the available fields in the selected field groups.

10. Place a check mark next to each field that you want to include in your report. You can use the Page Up and Page Down keys to navigate between all the fields (see Figure 3.4). Select the Next Screen (white navigational arrow) button from the Application toolbar to open the Selections screen, which lists all the fields you have selected.


Figure 3.4. All the fields listed in the field groups at the top right of the InfoSet screen during configuration are listed here.


11. If desired, add any of the fields to the selection screen that will be presented when you execute your report. You can add a field to the Selections screen by placing a check mark next to each one (see Figure 3.5).



Figure 3.5. Having fields available on the report's selection screen gives you the ability to specify your report output upon execution.


12. Click the Basic List button from the Application toolbar to create an SAP basic list query. The Basic List Line Structure screen appears, showing a list of the fields you selected to include in your report.

13. For each field, specify the line and sequence number as you want them to appear on your report. Also use this screen to indicate sort order, totals, and counts, if needed. Start by entering the line and sequence numbers, like the ones shown in Figure 3.6.


Figure 3.6. Basic output options are defined on the SAP Query tool Basic List Line Structure screen.

Note

You can use Figure 3.6 as follows:
  • Line column The values in this column correspond to the line numbers the fields will appear on in the report.
  • Sequence column The numbers in this column determine the order of the fields for the line.
  • Sort column This column dictates the order in which the data will be sorted.
  • Line Structure box After you click the Save button, a preview of the format appears in the Line Structure box at the bottom of the screen.
14. For this example, proceed directly to the report by pressing F8, which causes the report to execute.

15. As with almost all other reports in SAP, when you execute this report, you see the report's selection screen. Specify any criteria for the output of your report. Notice that any fields indicated on the Selections screen are included on your selection screen, under the heading Program Selections (see Figure 3.7).

Figure 3.7. Selection screens enable you to further specify
output.


16. Select the F8 Execute button on your Application toolbar (it looks like a clock) to display your finished report. Your report output appears; it should look similar to what is shown in Figure 3.8. (Keep in mind that the actual values vary by organization: The output of the report corresponds to the specification entered on the Basic List Line Structure screen.)

Figure 3.8. In SAP 4.6 and higher, by default, your report displays in the SAP List Viewer.


Reviewing the Options on Each of the Five Basic Screens

The Title, Format Screen

The Title, Format screen, shown in Figure 3.9, is where you insert the basic data about your report, including its title and the format in which you want it displayed. The Title, Format screen stores the basic report processing options for your report. For organizational purposes, it is a good idea to enter the name of the user who created the report in the Notes section of this screen. The following sections describe the options available on this screen.

Figure 3.9. The Title, Format screen.


Select Field Group Screen

In the Select Field Group screen, shown in Figure 3.10, a list of all the available field groups is populated during the creation of the InfoSet. (See Chapter 2 for more information.) This example has only three field groups; however, some logical databases contain hundreds. You place a check mark next to any field group that contains fields you want to include in your SAP query.

Figure 3.10. All the field groups listed at the top right of your InfoSet screen during configuration of the InfoSet are listed on this screen.


The Select Field Screen

In the Select Field screen, shown in Figure 3.11, a list of all the available field groups populated during the creation of the InfoSet is expanded to display all the fields contained within them. You place a check mark next to any field you want to include in your SAP query.
Figure 3.11. All the fields listed in the field groups at the top right of your InfoSet screen during configuration are listed here. This screen is also used for advanced functions covered later in this book.


The Selections Screen

In the Selections screen, shown in Figure 3.12, a list of all the previously selected fields appears. You place a check mark next to any field that you want to include on the Selections screen that appears upon report execution. This gives you the option to specify particular data.


Figure 3.12. Having fields available on your report's selection screen gives you the ability to specify your report output by varying your input prior to report execution.

For example, in Figure 3.12, I selected that I wanted the Airfare, Maximum Capacity, and Weight of Luggage fields to appear on my report's Selections screen. This means that when I execute my report and see the Selections screen, those three fields will be listed there, under the heading Program Selections. Having them there allows me to run the report based on specific airfares, maximum capacity, or weight of luggage. (For example, I could run a report that contains a list of flights between $50 and $200.)


The Basic List Line Structure Screen

By default, only the first few selected fields of your report appear on the Basic List Line Structure screen, shown in Figure 3.13. They are all there, but with the default view, they are not all visible. You can use the Page Up and Page Down buttons on the right side of the screen to navigate between them, or you can select the Without Explanation button (at the bottom left of the screen) to view more fields on a single screen. The Basic List Line Structure screen lists all the fields you want to include in your output. You can have fields listed here for sorting purposes but not included in the output by simply leaving the Line and Sequence fields blank.


Figure 3.13. This is the screen where you dictate how you want your report to appear, including sequence and sorting specifications.