Читайте также: |
|
ENDSELECT. ENDIF.
CLEAR wa_flight.
LessonSummary
You should now be able to:
• Describe the attributes and benefits of ABAP lists
• Implement list and column headers
• Implement multi-level lists
• Implement interactive lists
Lesson:
231
Selection Screen
Lesson Duration: 80 Minutes
Lesson Overview
In this lesson you will learn about the advantages of using the selection screen. In addition to the previous PARAMETERS definitions, you will also learn about the SELECT-OPTIONS restriction option with which the user can specify significantly more complex restrictions for the data selection.
Following that you will learn how to use the ABAP events AT
SELECTION-SCREENfor implementing an input or authorization check with a
possible error dialog using the selection screen.
LessonObjectives
After completing this lesson, you will be able to:
• List the properties and benefits of selection screens
• Implement the options for restricting selections on the selection screen
• Implement the input and authorization check with an error dialog using the selection screen
Participants should already be familiar with some of the elements dealt with in the following lesson (such as PARAMETERS). Such topics are meant as recaps and should be dealt with quickly. The focus of this lesson is on the SELECT-OPTIONS and error dialog on the selections screen by using the AT
SELECTIO-SCREEN. The exercise should be carried out at the end of this lesson.
Business Example
The selection screen of your program should allow users to specify much more complex restrictions for the data selection than is possible for simple PARAMETERS definitions. If the result of the input or authorization check is negative, the selection screen should be displayed with a corresponding error message so the user can make another entry.
Advantages of Selection Screens
Figure 142: Architecture and Purpose of Selection Screen
In general, selection screens are used for entering selection criteria for data selection. For example, if the program creates a list of data from a very large database table, it often makes sense for the user to select the data records he actually requires and only reading those from the database. Apart from reducing the memory requirement, this also reduces the network load.
The selection screen has the following standard functions:
• Texts on the selection screen (selection texts) can be maintained in several languages. At runtime the texts are automatically displayed in the user’s logon language. (Automatic language)
• The system checks types automatically: If the user enters something that does not correspond to the type of the input field, the SAP GUI will ignore it, so it won’t even appear on the selection screen.
• In addition to single value entries (PARAMETERS), you can also implement complex selections (SELECT-OPTIONS) on the selection screen. The user can then enter intervals, comparative conditions or even patterns as restrictions.
• If the input field is defined using a Dictionary element (e.g. data element), then the field documentation (documentation of the data element) can be displayed on the input field, using the F1 (input help) function key.
The data element’s search help for displaying possible inputs can be called up using the F4 (input help) function key.
• You can easily save completed selection screens as variants for reuse or use in background operation.
The above graphic illustrates the use of selection options, which enable complex entries. Every selection screen contains an information icon (also known as a “Help on Screen” icon). Choose this icon to display additional information.
You will learn more about defining selection options using the SELECT-OPTIONS
statement later in this lesson.
If an input field is typed with a data element, the following additional semantic information is available on the selection screen:
• The long field label of the data element can be copied to describe the input field on the selection screen (selection text). (See next graphic)
• The documentation of the data element is automatically available as an
input help (F1 help).
• If a search help is linked to the data element, it is available as an input help (F4 help).
(A search help is an independent dictionary object that displays a list of possible input values to the user (possibly with additional information), from which he can then select one for input.)
If the input field is typed with a structure field which is in turn defined using a data element, then the above-described semantic information of the data element is available on the selection screen. If the structure field is also copied to a search help, then this “overwrites” the search help of the data element.
For more information, refer to the online documentation for the ABAP Dictionary.
On the selection screen, the names of the input fields appear as their description by default. However, you can replace these with corresponding selection texts, which you can then translate into any further languages you require. At runtime, the selection texts are then displayed in the logon language of the user (automatic language).
Just like the list headers and text symbols, selection texts belong to the text elements of the program. From the ABAP Editor, choose the menu GoTo → Text Elements → Selection Texts to maintain them. You can implement your translation using the menu GoTo → Translation.
If the input field is typed directly or indirectly with a data element, you can copy the long field name from one of the texts stored in the Dictionary (“dictionary reference”). This provides you with an easy option for standardizing the texts.
The completed selection screens are the variants of the program. After the program has been started, the user can load variants to the respective selection screen to facilitate repeated identical or almost identical inputs. You have to include a variant when you schedule an ABAP program in the background
run, if the program has a selection screen, as user inputs are not possible in the
background.
You define program-specific variants by starting the program, completing the selection screen and saving it (disc pushbutton). You can also define different attributes for the variant.
If variants have already been defined for a program, then an additional pushbutton appears on the selection screen with the text flag “get variant...”. This push button lists the defined variants for selection.
In order to be able to define his own variants, the user must have the corresponding authorization (in the production system). But you can also define variants in the development system and then have them transported to the production system. Variants with the name prefix ’CUS&’ are system variants. They are transported like ordinary repository objects and are not client-specific. All other variants are client-specific and must be transported separately. From the ABAP Editor, choose the menu GoTo → Variants to go to the variant management of your program, where you can perform follow-up maintenance for your variants with regards to values and attributes. There, choose the menu Tools → Transport Request to specify the variants to be transported as well as a request. The transport happens when the request is released.
For more information on variants, choose the pushbutton Information on Variant
Attributes on the screen in order to maintain your variant attributes.
Input Options on the Selection Screen
Figure 148: Single-Value Input (PARAMETERS Statement)
The above graphic shows the usage and the runtime behavior of an input variable defined using a PARAMETERS statement. Once again, the definition of such an input variable creates a variable in the system and implicitly generates a selection screen with a corresponding input option.
An input variable is defined in the same way as an ordinary variable. The only difference is that the PARAMETERS keyword is used instead of DATA.
You have to consider three particularities:
• The name of the input variable may be up to 8 characters long.
• It may not be typed with the standard types F, STRING and XSTRING.
• The assignment of a default value is not implemented with the VALUE
addition but with the DEFAULTaddition.
A default value assignment by means of the DEFAULT addition or value assignment before displaying the selection screen (INITIALIZATION) is displayed on the selection screen as a default value that can be overwritten.
If the user enters a value and chooses Execute, the input values are transferred to the internal value and, for example, can be used to restrict the database selection.
Selection options are defined when you use the
Дата добавления: 2015-11-16; просмотров: 78 | Нарушение авторских прав
<== предыдущая страница | | | следующая страница ==> |
Wa-percentage, ’%’. | | | SELECT-OPTIONSname FORdata_object. |