SELECTION-SCREEN: Special Variant for Logical Databases

You may only use these variants in the INCLUDE program DBldbSEL of logical database ldb.

Variants:

1.SELECTION-SCREEN BEGIN OF VERSION vers TEXT-xxx.

2. SELECTION-SCREEN END OF VERSION vers.

3. SELECTION-SCREEN EXCLUDE ... .

4.SELECTION-SCREEN DYNAMIC SELECTIONS FOR TABLE dbtab.

5.SELECTION-SCREEN FIELD SELECTION FOR TABLE dbtab.

6.SELECTION-SCREEN DYNAMIC SELECTIONS FOR NODE node.

7.SELECTION-SCREEN FIELD SELECTION FOR NODE node.

Variant 1

SELECTION-SCREEN BEGIN OF VERSION vers TEXT-xxx.

Variant 2

SELECTION-SCREEN END OF VERSION vers.

Variant 3

SELECTION-SCREEN EXCLUDE ... .


Effect

Defines a selection screen version (three character name vers). Between BEGIN OF VERSION and END OF VERSION , you can exclude selection screen objects from version vers using SELECTION-SCREEN EXCLUDE. This allows you to reduce the database-specific part of the standard selection screen to those objects relevant to the report in question without having to sacrifice important selection criteria in other reports.

You activate a selection screen version for a report by entering it in the report attributes. If the database access program SAPDBldb itself has a selection screen version in its attributes, this applies to all reports that use the logical database and for which you have not declared a particular selection screen variant.

The function of the text symbol TEXT-xxx is to enable users to choose a selection screen variant using F4 help on the program attributes screen.

Extras:

(for SELECTION-SCREEN EXCLUDE) 1. ... PARAMETERS par 2. ... SELECT-OPTIONS sel
3. ... RADIOBUTTON GROUPS radi
4. ... BLOCKS block
5. ... IDS id

Effect

Excludes selection screen objects between SELECTION-SCREEN BEGIN and END OF VERSION. You can also exclude individual parameters, select-options, and radiobutton groups, within SELECTION-SCREEN BEGIN/END OF BLOCK blocks, and other SELECTION-SCREEN objects such as comments and underlines using the ID id addition.

Notes

You can only exclude objects of the DS:ABEN.SELECTION_SCREEN>standard selection screen 1000, not any that belong to a screen defined using SELECTION-SCREEN BEGIN OF SCREEN ... AS SUBSCREEN. If the standard selection screen includes objects from other screens ( SELECTION-SCREEN INCLUDE ... ID ...), you can use SELECTOIN-SCREEN EXCLUDE IDS ... to exclude them from the screen.

The database program SAPDBldb can use the function module RS_SELSCREEN_VERSION to use the active version of the selection screen for the current report.

Example

TABLES SPFLI.
NODES CHARLY.                  " with structure SFLIGHT

PARAMETERS PAR_1 LIKE SPFLI-CARRID FOR TABLE SPFLI.

SELECT-OPTIONS SEL_1 FOR SPFLI-CONNID.
SELECT-OPTIONS SEL_2 FOR CHARLY-FLDATE.
SELECT-OPTIONS SEL_3 FOR SPFLI-CITYFROM.

SELECTION-SCREEN COMMENT /10(20) TEXT-100 FOR TABLE SFLIGHT ID 001.
SELECTION-SCREEN COMMENT /8(30) TEXT-200 FOR NODE CHARLY ID 002.

..
SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN NO INTERVALS.
  SELECTION-SCREEN BEGIN OF BLOCK B100 WITH FRAME TITLE TEXT_001.
    PARAMETERS P100_1 TYPE SFLIGHT-SEATSMAX FOR NODE CHARLY.
  SELECTION-SCREEN END OF BLOCK B100.
SELECTION-SCREEN END OF SCREEN 100.

PARAMETERS PAR_2 LIKE SY-SUBRC FOR TABLE SFLIGHT.
PARAMETERS PAR_3 LIKE CHARLY-PLANETYPE FOR NODE CHARLY.
...
SELECTION-SCREEN BEGIN OF VERSION ABC TEXT-008.
  SELECTION-SCREEN EXCLUDE PARAMETERS: PAR_1, PAR_3.
  SELECTION-SCREEN EXCLUDE SELECT-OPTIONS SEL_2.
  SELECTION-SCREEN EXCLUDE IDS 001.
SELECTION-SCREEN END   OF VERSION ABC.

SELECTION-SCREEN BEGIN OF VERSION XYZ TEXT-XYZ.
  SELECTION-SCREEN EXCLUDE IDS 100.
SELECTION-SCREEN END OF VERSION XYZ.

If the report attributes (or the attributes of database program SAPDBldb) contain the selection screen version ABC, the parameters PAR_1 and PAR_3, the select-option SEL_2 and the comment with text number 100 (ID 001) do not appear on the selection screen. Text symbol 008 of SAPDBldb is displayed if you choose F4 help for the 'Selection screen version' field.

If the program attributes (or the attributes of the database program SAPDBldb) contain the selection screen version XYZ, the block B100 containing the parameter P100_1 does not appear on the standard selection screen 1000, but it does appear on the subscreen 100..

Variant 4

SELECTION-SCREEN DYNAMIC SELECTIONS FOR TABLE dbtab.

Variant 6

SELECTION-SCREEN DYNAMIC SELECTIONS FOR NODE

node.


Extras:

... ID id

Effect

This statement returns the tables or nodes of the logical database for which additional selections are supported. If one of these tables or nodes is active in the report (declared using TABLES or NODES, or in the path from the database hierarchy root to a table declared using TABLES or NODES), the 'Free selections' pushbutton appears on the selection screen. If the user chooses this function, the system branches to a dialog in which the user can enter selections for the relevant fields of the appropriate tables. There are two ways to set the fields for which users can make free selections:

  1. Using a selection view created for that purpose:
    You maintain selection views within logical database maintenance. They consist of a set of fields from tables in the logical database that are divided into groups. You can also preselect fields here. Customers may overlay the selection view (that is, the system searches first for a customer-specific selection view. Only if one does not exist will the system display the SAP selection view).
    If you have already made a preselection in the selection view, the user sees the selection screen for the preselected fields on which to enter his or her selections. If no fields have been preselected, the user must first select some.

  2. Using all fields of all tables
    In this case, the user must choose the table and then the fields for which he or she wants to define additional selections. Having selected these, he or she then passes to the selection screen for entering the free selections.

The database access program SAPDBldb takes on the form of a complex data object DYN_SEL consisting of WHERE clauses generated by the user input for dynamic database access.

Note

You cannot use free selections for nodes with type C (complex data objects).

Note

The precise definition of the object DYN_SEL is stored in TYPE-POOL RSDS and reads:


TYPES: BEGIN OF RSDS_WHERE,
         TABLENAME LIKE RSDSTABS-PRIM_TAB,
         WHERE_TAB LIKE RSDSWHERE OCCURS 5,
       END OF RSDS_WHERE.
  ...
TYPES: BEGIN OF RSDS_TYPE,
         CLAUSES TYPE RSDS_WHERE OCCURS 5,
         TEXPR   TYPE RSDS_TEXPR,
         TRANGE  TYPE RSDS_TRANGE,
       END   OF RSDS_TYPE.

DATA DYN_SEL TYPE RSDS_TYPE.

The object DYN_SEL contains (amongst other elements) a component (CLAUSES), which is an internal table. Each line in the internal table contains a table name (TABLENAME) and a further internal table (WHERE_TAB), that contains the WHERE clauses for table (TABLENAME).
The structure of the two other components is contained in type pool RSDS.
TEXPR contains the selections in a storeable format that you can use for the 'freely callable' function modules used to enter free selections ( FREE_SELECTIONS_INIT, FREE_SELECTIONS_DIALOG). TRANGE contains the selections in the form of RANGES tables , that you can use with the IN operator in the SELECT, CHECK and IF statements.

Note

Neither the TYPE-POOL RSDS nor the declaration of DYN_SEL need to be written into the database program: both are automatically included by the system.

In the database program SAPDBldb, an access to a table XXXX might look like this:


FORM PUT_XXXX.
  DATA L_DS_CLAUSES TYPE RSDS_WHERE.

  MOVE 'XXXX' TO L_DS_CLAUSES-TABLENAME.
  READ TABLE DYN_SEL-CLAUSES WITH KEY L_DS_CLAUSES-TABLENAME
                             INTO L_DS_CLAUSES.

  SELECT * FROM XXXX
           WHERE field1 IN ...
           AND   field2 ....
              ...
           AND (L_DS_CLAUSES-WHERE_TAB).
      PUT XXXX.
  ENDSELECT.
ENDFORM.

Note

If the table L_DS_CLAUSES-WHERE_TAB is empty (in other words, there are no free selections for table XXXX), the system ignores the addition ... AND (L_DS_CLAUSES-WHERE_TAB) in the SELECT statement.

Variant 5

SELECTION-SCREEN FIELD SELECTION FOR TABLE dbtab.

Variant 7

SELECTION-SCREEN FIELD SELECTION FOR NODE node.



Extras:

... ID id

Effect

This statement returns the tables and nodes of the logical database for which field selections are supported.
If required by the report, not all fields of these tables and nodes are filled from the database, but only those that the report needs. You declare these fields in the report using GET dbtab FIELDS f1 ... fn or GET dbtab LATE FIELDS f1 ... fn (the field list is then completed by the system, using the key fields of table dbtab).
You can improve performance considerably by restricting the fields used to those that are really necessary.

The database access program SAPDBldb receives the fields for the dynamic field selection in the form of an internal table SELECT_FIELDS.

Note

You cannot use this addition for nodes with type C (complex data objects).

Note

The exact definition of the object SELECT_FIELDS is stored in TYPE-POOL RSFS and reads:


TYPES: BEGIN OF RSFS_TAB_FIELDS,
         TABLENAME LIKE RSDSTABS-PRIM_TAB,
         FIELDS LIKE RSFS_STRUC OCCURS 10,
       END OF RSFS_TAB_FIELDS.

  ...

TYPES: RSFS_FIELDS TYPE RSFS_TAB_FIELDS OCCURS 10.

DATA SELECT_FIELDS TYPE RSFS_FIELDS.

SELECT_FIELDS is an internal table. Each line of the internal table contains a table name (TABLENAME) and a further internal table (FIELDS) containing the fields of table (TABLENAME).

Note

You do not need to declare the TYPE-POOL RSFS or SELECT_FIELDS in the database program, since both are included automatically by the system. Unlike the objects linked using the DYNAMIC SELECTIONS addition, SELECT_FIELDS is also available in the report.

In the database program SAPDBldb, an access to table XXXX might look like this:


FORM PUT_XXXX.

  DATA L_TAB_FIELDS TYPE RSFS_TAB_FIELDS.

  MOVE 'XXXX' TO L_TAB_FIELDS-TABLENAME.
  READ TABLE SELECT_FIELDS WITH KEY L_TAB_FIELDS-TABLENAME
                           INTO L_TAB_FIELDS.

  SELECT (L_TAB_FIELDS-FIELDS)
             INTO CORRESPONDING FIELDS OF XXXX
             FROM XXXX
         WHERE field1 IN ...
         AND   field2 ....
              ...
      PUT XXXX.
  ENDSELECT.
ENDFORM.

Notes

  1. If table L_TAB_FIELDS is empty (in other words, the report for table XXXX does not require any field selection), SELECT (L_TAB_FIELDS) ... behaves like SELECT * ..., that is, all fields of table XXXX are filled.

  2. The internal table SELECT_FIELDS is filled when the INIT routine runs in the database program or when the INITIALIZATION runs in the report. The program can access it if the logical database requires extra fields.

Additional help

Processing Selections