Register Login

Selection Screen- Important Points

Some important points related to Selection screen are:

1. Using select options to select records

SELECT-OPTIONS: S_CPUDT FOR BKPF-CPUDT DEFAULT SY-DATUM,
S_USNAM FOR BKPF-USNAM.

SELECT * FROM BKPF
WHERE CPUDT IN S_CPUDT AND
USNAM IN S_USNAM.

2. Select options with more than one default value or range

If you want to use more than one default value or default range, you add the values to the internal table selection table.

Note: You don't have to declare the table, it is created automatically. The table has the same name as the select variable ( In the example below s_hkont ).

SELECT-OPTIONS: S_HKONT FOR ZTSAPSPEC-HKONT.

INITIALIZATION.
MOVE: 'I' to s_hkont-sign,
'BT' TO S_HKONT-OPTION,
'87111100' TO S_HKONT-LOW,
'87111124' TO S_HKONT-HIGH.
APPEND S_HKONT.
MOVE: 'I' to s_hkont-sign,
'EQ' TO S_HKONT-OPTION,

'87111300' TO S_HKONT-LOW,
APPEND S_HKONT.

3. Making a frame around groups of fields on the selection screen.

SELECTION-SCREEN BEGIN OF BLOCK 1 WITH FRAME TITLE TEXT-001.

SELECT-OPTIONS: S_CPUDT FOR BKPF-CPUDT OBLIGATORY
DEFAULT SY-DATUM.
SELECTION-SCREEN END OF BLOCK 1.

You can add further blocks (block2.......)

4. making a checkbox

parameters: x_afstem as checkbox default 'X'.

5. Making a radiobutton group

PARAMETERS: <name of button> RADIOBUTTON GROUP<name of group>,<name of button> RADIOBUTTON GROUP<name of group>.

Example:

PARAMETERS: BUTTON1 RADIOBUTTON GROUP RAPT,

BUTTON2 RADIOBUTTON GROUP RAPT.

In the program you test for the radiobuttons like this:

if button1 = 'X' then.
< Here comes some code>
elseif button2 = 'X' then.
< Here comes some code>
endif.

6. How to add an option after the user has finished the selection screen

Use the at selection-screen event to add options as showed above in example 2.

7. Selection screen events

Initialization Before processing the selection screen

at selection-screen output Before the contents of selections screen is displayed

at selection-screen on p/s Processed after the suer has specified the Parameter p or Select option s

at selection-screen After the user has specified all selection criteria

8. Making an option invisible

If you don't want the user to be able to see the option you want to add, define it as No-DISPLAY.

SELECT-OPTIONS: S_HKONT FOR ZTSAPSPEC-HKONT NO-DISPLAY, S_BUKRS FOR ZTSAPSPEC-BUKRS,

9. Selection screen - Parameters on a single line

SELECTION-SCREEN BEGIN OF LINE.
* The system does not output selection texts for parameters.
* Set your own
SELECTION-SCREEN COMMENT 1(15) text-001.
* Parameters

PARAMETERS: p1(3) TYPE c,
p2(5) TYPE c.
SELECTION-SCREEN COMMENT 55(10) p_wmunit.

SELECTION-SCREEN END OF LINE.

INITIALIZATION.
MOVE 'Unit' TO p_wmunit.

10. Setting the title text of a selection screen dynamically

Define GUI titles for the report. In this example the GUI titles COLLILABEL and PALLETLABEL has been defined. In the INITIALIZATION event, dynamically set which GUI title to show with the SET TITELBAR statement.

INITIALIZATION.
IF p_colli = 'X'.
SET TITLEBAR 'COLLILABEL'.
ELSEIF p_pallet = 'X'.
SET TITLEBAR 'PALLETLABEL'.
ENDIF.

11. Using a custom toolbar in a selection screen

When you use your own custom toolbar in a selection screen, the flow of the report changes. Below is an example of how to use the events in such a report.

Important! To be abel to submit your report, the submit button on the custom

toolbar of the selection screen must be named  'ONLI' (= Execute) or 'PRIN' (= Execute and Print).

INITIALIZATION.
* Your custom toolbar for the selection screen
SET PF-STATUS '0002'.

AT SELECTION-SCREEN.
* Handle sy-ucomm from your custom toolbar on the selection screen. Note
that it is not necessary explicitly to handle 'ONLI' or 'PRIN'
CASE sy-ucomm.
WHEN 'GETDATA'.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.

START-OF-SELECTION.
..... retreieve data for the ereport.....

END-OF-SELECTION.
* PF status for the report
SET PF-STATUS '0001'.

..... write report ......

Henrik Frank

12. Skip line on selection screen

Selection-screen skip 1.

13. Using a matchcode

Parameters:
matnr like mara-matnr matchcode object mat1.

Note: Matchcode objects can be found in SE11


Comments

  • 06 Feb 2014 8:23 am allwyn mascarenhas

    SELECT-OPTIONS: S_HKONT FOR ZTSAPSPEC-HKONT.

    INITIALIZATION.
    MOVE: 'I' to s_hkont-sign,
    'BT' TO S_HKONT-OPTION,
    '87111100' TO S_HKONT-LOW,
    '87111124' TO S_HKONT-HIGH.
    APPEND S_HKONT.

    In the second eg. what's the point of the code below?? All values have been set above already!


    MOVE: 'I' to s_hkont-sign,
    'EQ' TO S_HKONT-OPTION,

    '87111300' TO S_HKONT-LOW,
    APPEND S_HKONT. - See more at: https://www.stechies.com/selection-screen/#.dpuf


×