LESSON 8 USER DIALOGS AND SELECTION SCREEN
Selection screens allow users to enter selection criteria required by the program.
For  example, if you create a list containing data from a very large  database table, you can use a selection screen to restrict the amount of  data that is selected. At runtime, the user can enter intervals for one  of the key fields, and only data in this interval is read from the  database and displayed in the list. This considerably reduces the load  on the network.
Selection  screens are designed to present users with an input template allowing  them to enter selections, which reduce the amount of data that has to be  read from the database. The following possibilities are available to  the user:
 Entries to single fields
 Complex entries: Intervals, operations, patterns
 Saving selections fields filled with values as variants
 Input help and search helps are available by choosing the F4 function key or the possible entries pushbutton 
You can translate selection texts into other languages so that they are then displayed in the language in which the user is logged on.
The  system checks types automatically. If you enter a value with an  incorrect type, the system displays an error message and makes the field  ready to accept your corrected entry.
Selection  screens allow you to enter complex selections as well as single -value  selections. Functions of selection options programming include:
Setting selection options
Entering multiple values or intervals
Defining a set of exclusionary criteria for data selection
Every selection screen contains an information icon. Choose this icon to display additional. information.
If  you refer an input field to an ABAP Dictionary object to which a search  help is assigned, the system automatically provides the corresponding  possible values help.
You can adapt the possible values help to meet your own requirements by defining a search help in the ABAP Dictionary.
On  the selection screen, the names of the variables appear next to the  input fields. However, you can replace these with selection texts, which  you can then translate into any further languages you require.  Selection texts are displayed in the user's logon language.
You  can define and store variants for any selection screen. You do this by  starting the program and choosing Variants -> Save as variant.
Variants allow you to make selection screens easier to use by end users by:
Pre-assigning values to input fields
Hiding input fields
Saving these settings for reuse
A single variant can refer to more than one selection screen.
Variants are client specific.
If you choose the information icon (on any selection screen), the system will display more
information about variants. You can also find out more in course BC405 Techniques of List
Processing. 
In an executable program, a single PARAMETERS statement is sufficient to generate a standard selection screen.
The PARAMETERS  TYPE  statement and the PARAMETERS  LIKE  statement both generate a simple input field on the selection screen, and a data object  with the type you have specified.
If the user enters a value and chooses 'Execute', that value is placed in the internal data object  in the program. The system will only permit entries with the appropriate type.
Once the INITIALIZATION event  block has been processed, the selection screen is sent to the  presentation server. The runtime system transports the data object  values that are defined using PARAMETERS to the selection screen input fields of the same name.
The  user can then change the values in the input fields. If the user then  clicks on the 'Execute' function, the input field values are transported  to the program data objects with the same name and can be evaluated in  the ABAP processing blocks.
If you have used the PARAMETERS statement to program an input field as a key field for a database table, you can use a WHERE clause at the SELECT statement to limit data selection to this value.
The statement SELECT-OPTIONS  FOR  defines a selection option:
This  places two input fields on the selection screen, with the same type  that you have defined in the reference. This enables users to enter a  value range or complex selections. The statement also declares an  internal table  within the program, with the following four columns:
sign: This field designates whether the value or interval should be included in or excluded from the selection.
option: This contains the operator: For a list of possible operators, see the keyword
documentation for the SELECT-OPTIONS statement.
low: This field contains the lower limit of a range, or a single value.
high: This field contains the upper limit of a range.
Selection table  always  refers to a data object that has already been declared. This data  object serves as a target field during database selection, the selection  table as a pool of possible values. A special version of the WHERE clause  exists for database selection. It determines whether or not the  database contains the corresponding field within its pool of possible values. 
If  the user enters several values or intervals for a selection option and  chooses 'Execute', the system places them in the internal table.
Conditions in an internal table declared using SELECT-OPTIONS are interpreted as follows:
If the internal table is empty, the condition  IN  is always true.
If the internal table only contains simple inclusive conditions i1, ..., in, the result is the composite condition ( i1 OR ... OR in ).
If the internal table only contains simple exclusive conditions e1, ..., em, the result is the
composite condition ( NOT e1 ) AND ... AND ( NOT em ).
If the internal table contains both the simple inclusive conditions i1, ..., in and the simple exclusive conditions e1, ..., em, the result is the composite condition ( i1 OR ... OR in ) AND ( NOT e1 ) AND ... AND ( NOT em ).
In  an executable program, the ABAP runtime system generates a standard  selection screen as long as you have written at least one PARAMETERS or SELECT-OPTIONS statement. The selection screen belongs to the event block AT SELECTION-SCREEN.
The selection screen is displayed after the event block INITIALIZATION.
Each  time the user presses Enter, a pushbutton, a function key, or chooses a  menu function, the system carries out a type check. If the entries do  not have the correct type, the system displays an error message, and  makes the fields ready for input again. When the data types have been  corrected, the system triggers the AT SELECTION-SCREEN event.
Subsequent program flow depends on the user action:
 If the user chose F8 or 'Execute', the next event block is called: In this case, START-OFSELECTION. 
 If the user chose any other function, the selection screen is redisplayed.
Use the event block AT SELECTION-SCREEN whenever you want to program additional input checks for a standard selection screen.
The event block AT SELECTION-SCREEN is  triggered by each user action. If an error dialog is triggered, the  system jumps back to the selection screen and automatically resets all  input fields to ready for input and displays a message in the status  line.
For more detailed information on the MESSAGE statement, refer to the keyword documentation as well.
No comments:
Post a Comment