Select-options:
It generates a selection-screen for reading ranges of input values. It is an internal
table created in the run time by SAP based on the select-option field. It contains
following structure:
a) Sign Possible values are ‘I’ (Inclusive) / ‘E’ (exclusive)
Default value is ‘I’
‘I’ considers values from lower limit to upper limit
Eg: range - 1000 to 1010
‘I’ means it considers from 1000 to 1010
‘E’ considers values before lower limit and after upper limit
Eg: range - 1000 to 1010
‘E’ means it considers values before 1000 and after 1010
b) Option Possible values are ‘BT’(between), <, >,<=,>=
Default value is ‘BT’
c) Low holds lower limit of the range
d) High holds upper limit of the range
Syntax for declaring select-option:
Select-options <variable> for <target field>.
Note: In the above syntax, if the target field is referring to dictionary
structure field, then target dictionary structure should be declared explicitly
using ‘tables’ keyword.
‘Tables’ KEYWORD will create work area with all the fields of the dictionary
structure which is a performance issue. Because of this reason, it is
recommended not to declare select-option referring to dictionary structure.
The Recommended declaration is to declare a local variable referring to
dictionary structure field and then declare the select-options referring to
local variable.
We can use the addition ‘no-extension’ as part of select-option declaration
to restrict the user to enter only single range in the run-time.
Ranges:
It is used for holding range of values. It is an internal table created in the run time
based on the field. It contains same structure as that of select-options:
a) Sign Possible values are ‘I’ (Inclusive) / ‘E’ (exclusive)
b) Option Possible values are ‘BT’(between), <, >,<=,>=
c) Low holds lower limit of the range
d) High holds upper limit of the range
Syntax for declaring Range:
Ranges <variable> for <target field>.
Order by Clause: We can use order by clause in select query to retrieve the data
in sorted order of the specified order by field. It is recommended not to user
order by clause, because it performs sorting at the time of retrieving data from
database which increases load on DB server which degrades the performance. We
can avoid by using sort statement on internal table as it gets executed on
application server.