Start of Content Area

Filling the Selection Screen of a Called Program  Locate the document in its SAP Library structure

When you start an executable program, the standard selection screen normally appears, containing the selection criteria and parameters of both the logical database connected to the program and of the program itself (see Direct Execution - Reports). When you start an executable program using SUBMIT, there are various additions that you can use to fill the input fields on the selection screen:

SUBMIT... [VIA SELECTION-SCREEN]
           [USING SELECTION-SET <var>]
           [WITH <sel> <criterion>]
           [WITH FREE SELECTIONS <freesel>]
           [WITH SELECTION-TABLE <rspar>].

These additions have the following effects:

        VIA SELECTION-SCREEN

The selection screen of the called executable program (report) appears. If you transfer values to the program using one or more of the other options, the corresponding input fields in the selections screen are filled. The user can change these values. By default, the system does not display a selection screen after SUBMIT.

        USING SELECTION-SET <var>

This option tells the system to start the called program with the variant <var>.

        WITH <sel> <criterion>

Use this option to fill individual elements <sel> of the selection screen (selection tables and parameters). Use one of the elements <criterion>:

         <op> <f> [SIGN <s>], for single value selection

If <sel> is a selection criterion, use <op> to fill the OPTION field, <f> to fill the LOW field, and <s> to fill the SIGN field of the selection table <sel> in the called program.

If <sel> is a parameter, you can use any operator for <op>. The parameter <sel> is always filled with <f>.

         [NOT] BETWEEN <f1> AND <f2> [SIGN <s>], for interval selection

<f1> is transferred into the LOW field, <f2> into the HIGH field, and <s> into the SIGN field of the selection table <sel> in the called program. If you omit the NOT option, the system places the value BT into the OPTION field; if you use NOT, the system fills OPTION with NB.

         IN <seltab>, transferring a selection table

This addition fills the selection table <sel> in the called program with the values of the table <seltab> in the calling program. Table <seltab> must have the structure of a selection table. Use the RANGES statement to create selection tables.

        WITH FREE SELECTION <freesel>, user dialog for dynamic selections

To use this option, the called program must be connected to a logical database that supports dynamic selections. In the calling program, use the function modules FREE_SELECTIONS_INIT and FREE_SELECTIONS_DIALOG. They allow the user to enter dynamic selections on a selection screen. One export parameter of these function modules has structure RSDS_TEXPR from the RSDS type group. Transfer the values of this export parameter by means of the internal table <freesel> of the same structure to the called report.

        WITH SELECTION-TABLE <rspar>, dynamic transfer of values

You need an internal table <rspar> with the Dictionary structure RSPARAMS. The table then consists of the following six fields:

         SELNAME (type C, length 8) for the name of the selection criterion or parameter

         KIND (type C, length 1) for the selection type (S for selection criterion, P for parameter)

         SIGN, OPTION, LOW, HIGH as in a normal selection table, except that LOW and HIGH both have type C and length 45.

This table can be filled dynamically in the calling program with all of the required values for the selection screen of the called program. If the name of a selection criterion appears more than once, the system creates a multiple-line selection table for that criterion in the called program. If the name of a parameter appears more than once, the system uses the last value. Note that LOW and HIGH have type C, so that the system executes type conversions to the criteria of the called program. This is important for date fields, for example. Before your program is used in a live context, you should check it using the VIA SELECTION-SCREEN addition.

Except for WITH SELECTION-TABLE, you can use any of the above options several times and in any combination within a SUBMIT statement. In particular, you can use the WITH <sel> option several times for one single criterion <sel>. In the called program, the system appends the corresponding lines to the selection tables used. For parameters, it uses the last value specified. The only combination possible for the WITH SELECTION-TABLE option is USING SELECTION-SET.

If the input fields on the selection screen are linked to SPA/GPA parameters, you can also use this technique to pass values to the selection screen (see Passing Data Between Programs).

Example

The following executable program (report) creates a selection screen containing the parameter PARAMET and the selection criterion SELECTO:

REPORT  demo_program_submit_rep1.

DATA number TYPE i.
PARAMETERS      paramet(14) TYPE c.
SELECT-OPTIONS  selecto FOR number.

The program DEMO_PROGRAM_SUBMIT_REP1 is called by the following program using various parameters:

REPORT demo_program_submit_sel_screen NO STANDARD PAGE HEADING.

DATA: int TYPE i,
      rspar TYPE TABLE OF rsparams,
      wa_rspar LIKE LINE OF rspar.

RANGES seltab FOR int.

WRITE: 'Select a Selection!',
     / '--------------------'.

SKIP.

FORMAT HOTSPOT COLOR 5 INVERSE ON.
WRITE: 'Selection 1',
     / 'Selection 2'.

AT LINE-SELECTION.
  CASE sy-lilli.
    WHEN 4.
      seltab-sign = 'I'. seltab-option = 'BT'.

      seltab-low  = 1.   seltab-high   = 5.
      APPEND seltab.

      SUBMIT demo_program_submit_rep1 VIA SELECTION-SCREEN
                      WITH paramet eq 'Selection 1'
                      WITH selecto IN seltab
                      WITH selecto ne 3
                      AND RETURN.

    WHEN 5.
      wa_rspar-selname = 'SELECTO'. wa_rspar-kind = 'S'.

      wa_rspar-sign = 'E'. wa_rspar-option = 'BT'.
      wa_rspar-low  = 14.  wa_rspar-high = 17.
      APPEND wa_rspar TO rspar.

      wa_rspar-selname = 'PARAMET'. wa_rspar-kind = 'P'.
      wa_rspar-low  = 'Selection 2'.
      APPEND wa_rspar TO rspar.
      wa_rspar-selname = 'SELECTO'. wa_rspar-kind = 'S'.
      wa_rspar-sign = 'I'. wa_rspar-option = 'GT'.
      wa_rspar-low  = 10.
      APPEND wa_rspar TO rspar.

      SUBMIT demo_program_submit_rep1 VIA SELECTION-SCREEN
                      WITH SELECTION-TABLE rspar
                      AND RETURN.

  ENDCASE.

After you start the program, a basic list appears and clicking the hotspots displays the selection screen of REP1 filled with different values.

For both calls of DEMO_PROGRAM_SUBMIT_REP1, the system transfers values that lead to two-line selection tables SELECTO. The second line appears in the respective dialog box Multiple Selection for SELECTO. Without the VIA SELECTION-SCREEN option of the SUBMIT statement, PARAMET and SELECTO would be filled accordingly in DEMO_PROGRAM_SUBMIT_REP1, but they would not be displayed.

 

 

End of Content Area