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 users
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 wont 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 elements 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 learnmore about defining selection options using the SELECT-OPTIONS
statement later in this lesson.
Figure 197: Semantic Information on Global Types on the Selection Screen
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)
Thedocumentation of the data element is automatically available as an
input help (F1 help).
Ifasearch 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.
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 DEFAULT addition.
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
SELECT-OPTIONS name FOR data_object.
statement, where name is the name of the select option and data_object is an
already defined variable. Such a definition creates an internal table of the specified
name within the program (here so_car) and generates a selection screen with an
input option for limiting the specified variable (here: wa_spfli-carrid).
User entries are transported to the automatically generated internal table when
Execute is chosen. This table always has four columns: sign, option, low, and
high. The above graphic shows, which entries are created for which user input:
If LH is entered, a row is generated with the values I (inclusive), EQ
(equal), LH and Space.
If the interval AA to DL is entered, a row is generated with the values
I (inclusive), BT (between), AA and DL.
If BA is entered as the single value to be excluded, a row is generated with
the values E (exclusive), EQ (equal), BA and Space.
The internal table filled with the entered selection criteria can be used for the
database selection, as illustrated in the graphic. The table content is interpreted as
follows:
If I_1, ... , I_n and E_1, ... , E_m are the inclusive/exclusive
conditions of the internal table, then the following composite condition is used to
limit the data selection:
( I_1 OR ... OR I_n ) AND ( NOT E_1 ) AND ... AND (
NOT E_m )
If the table is empty because there are no restrictions, the WHERE conditions
always applies to the respective field.
Hint: The IN operator can also be used in logical expressions:
IF wa_spfli-carrid IN so_car.
For defining a selection option, the same three particularities apply as for the
PARAMETERS statement (see above).
If the internal table of the selection option is filled using the DEFAULT addition or
APPEND statement before the selection screen is displayed (INITIALIZATION,
then its content is displayed on the selection screen as suggested conditions that
can be overwritten.
For further details, refer to the keyword documentation for SELECT-OPTIONS.
On the selection screen the AT SELECTION-SCREEN event is triggered both
by choosing Enter as well as Execute (F8). After the corresponding processing
block has been processed, the following START-OF-SELECTION event is
triggered and the relevant processing started, if Execute was used. However, if
Enter was chosen, the selection screen is displayed again.
Immediately before processing the AT SELECTION-SCREEN block, the user
entries are automatically transferred to the corresponding variables in the program.
Hence, it makes sense to implement required input and authorization checks in
this processing block. If the check result is negative, you can simply send out an
error message to the user and have the selection screen displayed again. The user
then has then option of making new entries.
In contrast, an error message in the START-OF-SELECTION block would be
displayed under program termination.
The following graphic illustrates a simple example program with authorization
check and error dialog on the selection screen.
Additional information can be found in the keyword documentation for AT
SELECTION-SCREEN.
Texts on the selection screen (selection texts) can be maintained in several
languages. At runtime the texts are automatically displayed in the users
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 wont 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 elements 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 learnmore about defining selection options using the SELECT-OPTIONS
statement later in this lesson.
Figure 197: Semantic Information on Global Types on the Selection Screen
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)
Thedocumentation of the data element is automatically available as an
input help (F1 help).
Ifasearch 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.
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 DEFAULT addition.
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
SELECT-OPTIONS name FOR data_object.
statement, where name is the name of the select option and data_object is an
already defined variable. Such a definition creates an internal table of the specified
name within the program (here so_car) and generates a selection screen with an
input option for limiting the specified variable (here: wa_spfli-carrid).
User entries are transported to the automatically generated internal table when
Execute is chosen. This table always has four columns: sign, option, low, and
high. The above graphic shows, which entries are created for which user input:
If LH is entered, a row is generated with the values I (inclusive), EQ
(equal), LH and Space.
If the interval AA to DL is entered, a row is generated with the values
I (inclusive), BT (between), AA and DL.
If BA is entered as the single value to be excluded, a row is generated with
the values E (exclusive), EQ (equal), BA and Space.
The internal table filled with the entered selection criteria can be used for the
database selection, as illustrated in the graphic. The table content is interpreted as
follows:
If I_1, ... , I_n and E_1, ... , E_m are the inclusive/exclusive
conditions of the internal table, then the following composite condition is used to
limit the data selection:
( I_1 OR ... OR I_n ) AND ( NOT E_1 ) AND ... AND (
NOT E_m )
If the table is empty because there are no restrictions, the WHERE conditions
always applies to the respective field.
Hint: The IN operator can also be used in logical expressions:
IF wa_spfli-carrid IN so_car.
For defining a selection option, the same three particularities apply as for the
PARAMETERS statement (see above).
If the internal table of the selection option is filled using the DEFAULT addition or
APPEND statement before the selection screen is displayed (INITIALIZATION,
then its content is displayed on the selection screen as suggested conditions that
can be overwritten.
For further details, refer to the keyword documentation for SELECT-OPTIONS.
On the selection screen the AT SELECTION-SCREEN event is triggered both
by choosing Enter as well as Execute (F8). After the corresponding processing
block has been processed, the following START-OF-SELECTION event is
triggered and the relevant processing started, if Execute was used. However, if
Enter was chosen, the selection screen is displayed again.
Immediately before processing the AT SELECTION-SCREEN block, the user
entries are automatically transferred to the corresponding variables in the program.
Hence, it makes sense to implement required input and authorization checks in
this processing block. If the check result is negative, you can simply send out an
error message to the user and have the selection screen displayed again. The user
then has then option of making new entries.
In contrast, an error message in the START-OF-SELECTION block would be
displayed under program termination.
The following graphic illustrates a simple example program with authorization
check and error dialog on the selection screen.
Additional information can be found in the keyword documentation for AT
SELECTION-SCREEN.
Hiç yorum yok:
Yorum Gönder