Selection-Screen (SAP ABAP Keyword) Syntax & Examples



INTRODUCTION:


- PARAMETERS statement/keyword is used for single field entries in the selection screen.

- SELECT-OPTIONS statement/keyword is used for complex selections.

- SELECTION-SCREEN statement/keyword is used for formatting the selection screen.

- Programmer gets a great deal of control on how to present the User Interface / Selection Screen to the user. Using the options available with the SELECTION-SCREEN statement, the look of the screen can be formatted as per the requirement.

- SELECTION-SCREEN is used to form blocks by combining several PARAMETERS, SELECT-OPTIONS, comments etc. on one line.

- The standard selection screen of executable programs is predefined and has screen number 1000.

- A SELECTION-SCREEN block can contain keywords like PARAMETERS, SELECT-OPTIONS, COMMENT, PUSH-BUTTON etc.


SYNTAX:

1)

SELECTION-SCREEN BEGIN OF LINE.
...........
...........
SELECTION-SCREEN END OF LINE.

This option is used to have several elements in a single line. It places multiple fields immediately adacent to one another. 

SELECT-OPTIONS cannot be used between SELECTION-SCREEN BEGIN OF LINE and SELECTION-SCREEN END OF LINE


2)

SELECTION-SCREEN BEGIN OF BLOCK <block>
[ WITH FRAME [ TITLE <title> ] ] [ NOINTERVALS ].
......................
......................
SELECTION-SCREEN END OF BLOCK.

This option is used to have a block of elements.

The objects in the blocks can have SELECT-OPTIONS, PARAMETERS, COMMENTS, UNDERSCORES.

3)

SELECTION-SCREEN SKIP [ <n> ]

This option is used to create n number of blank lines on the screen.

4)

SELECTION-SCREEN ULINE [ [ / ] <pos (len)> ] [ MODIF ID <key> ].

This option is used to create under lines.. It places an underline on the screen at a location and length specified.

5)

SELECTION-SCREEN COMMENT [ / ] <pos (len)> <comm>
[ FOR FIELD <f> ] [ MODIF ID <key> ].

This option is used to place a comment which will be a user defined message on the screen at a location and length specified.

6)

SELECTION-SCREEN BEGIN OF SCREEN <numb> [ TITLE <title> ] [ AS WINDOW ].
.........................
.........................
SELECTION-SCREEN END OF SCREEN <numb>.

This option is used to define user defined selection screen.

7)

SELECTION-SCREEN PUSHBUTTON [ / ] <pos ( len ) > <push>
USER-COMMAND <ucomm> [ MODIF ID <key> ].

This option is used to create pushbuttons on the selection screen. When the user clicks the pushbutton on the selection screen, <ucomm> is entered in the UCOMM of the SSCRFIELDS structure..

The contents of the SSCRFIELDS-UCOMM field can be processed during the AT SELCTION-SCREEN event.

The structue SSCRFIELDS must be mentioned in the TABLES statement.


8)

SELECTION-SCREEN FUNCTION KEY <n>.

This option is used to create pushbuttons on the application toolbar of the selection screen.

<n> must be between 1 and 5. Hence it is not possible to create more than 5 pushbuttons using this method.

SSCRFIELDS structure is associated with these pushbuttons.  Also SSCRFIELDS structure must be declared with the TABLES statement.

When the user clicks on one of the pushbuttons, FC0<n> is placed into the SSCRFIELDS-UCOMM field and the AT SELECTION-SCREEN event is triggered.

The text for the pushbutton is placed in SSCRFIELDS-FUNCTXT_<n>.



EXAMPLES WITH SCREENSHOTS:

1) Subscreen

SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN.
PARAMETERS: x(10) TYPE c ,
y(10) TYPE c ,
z(10) TYPE c .
SELECTION-SCREEN END OF SCREEN 100.

SELECTION-SCREEN BEGIN OF SCREEN 200 AS SUBSCREEN.
PARAMETERS: a(10) TYPE c ,
b(10) TYPE c,
c(10) TYPE c .
SELECTION-SCREEN END OF SCREEN 200.

SELECTION-SCREEN: BEGIN OF TABBED BLOCK tabbed FOR 5 LINES,
TAB (10) text-001 USER-COMMAND push1
DEFAULT SCREEN 100,
TAB (10) text-002 USER-COMMAND push2
DEFAULT SCREEN 200,
END OF BLOCK tabbed.



















2) 

SELECTION-SCREEN BEGIN OF BLOCK part1 WITH FRAME TITLE text-001.
PARAMETERS : s_plant LIKE lips-werks OBLIGATORY.
SELECT-OPTIONS: s_deldt FOR likp-erdat DEFAULT '20110101' TO '20110202' OBLIGATORY .

SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN ULINE.
SELECTION-SCREEN SKIP 1.

PARAMETERS : s_plant1 LIKE lips-werks OBLIGATORY.
SELECT-OPTIONS: s_deldt1 FOR likp-erdat DEFAULT '20110105' TO '20110210' OBLIGATORY .
SELECTION-SCREEN END OF BLOCK part1.











3)

SELECTION-SCREEN BEGIN OF BLOCK part1 WITH FRAME TITLE text-001.
PARAMETERS : s_plant LIKE lips-werks OBLIGATORY.
SELECT-OPTIONS: s_deldt FOR likp-erdat DEFAULT '20110101' TO '20110202' OBLIGATORY .

SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN ULINE /1(10).
SELECTION-SCREEN ULINE POS_LOW(12).
SELECTION-SCREEN ULINE POS_HIGH(12).

SELECTION-SCREEN SKIP 1.

PARAMETERS : s_plant1 LIKE lips-werks OBLIGATORY.
SELECT-OPTIONS: s_deldt1 FOR likp-erdat DEFAULT '20110105' TO '20110210' OBLIGATORY .
SELECTION-SCREEN END OF BLOCK part1.











4)

SELECTION-SCREEN BEGIN OF BLOCK part1 WITH FRAME TITLE text-001.
PARAMETERS : s_plant LIKE lips-werks OBLIGATORY.
SELECT-OPTIONS: s_deldt FOR likp-erdat DEFAULT '20110101' TO '20110202' OBLIGATORY .
SELECTION-SCREEN END OF BLOCK part1.
SELECTION-SCREEN COMMENT /1(50) text.


AT SELECTION-SCREEN OUTPUT.
text = 'Please Note:Enter the details successfully'.








5)

SELECTION-SCREEN BEGIN OF BLOCK part1 WITH FRAME TITLE text-001.
PARAMETERS : s_plant LIKE lips-werks OBLIGATORY.
SELECT-OPTIONS: s_deldt FOR likp-erdat DEFAULT '20110101' TO '20110202' OBLIGATORY .
SELECTION-SCREEN END OF BLOCK part1.
SELECTION-SCREEN COMMENT /1(50) text-002.









6)

* TEXT-001 - Please Enter The Details.
* TEXT-002 - Fill The Details Carefully After studying carefully the requirements.
SELECTION-SCREEN BEGIN OF BLOCK part1 WITH FRAME TITLE text-001.
PARAMETERS : s_plant LIKE lips-werks OBLIGATORY.
SELECT-OPTIONS: s_deldt FOR likp-erdat DEFAULT '20110101' TO '20110202' OBLIGATORY .
SELECTION-SCREEN END OF BLOCK part1.
SELECTION-SCREEN COMMENT /1(80) text-002 visible length 40.








7) Push Button In Selection Screen.

SELECTION-SCREEN: BEGIN OF LINE,
PUSHBUTTON 1(8) text-001 USER-COMMAND fcode,
POSITION 12.
PARAMETERS para TYPE char20.
SELECTION-SCREEN: COMMENT 34(80) text-002,
END OF LINE.





8)

SELECTION-SCREEN BEGIN OF BLOCK part1 WITH FRAME TITLE text-001 NO INTERVALS.
PARAMETERS : s_plant LIKE lips-werks OBLIGATORY.
SELECT-OPTIONS: s_deldt FOR likp-erdat OBLIGATORY.
SELECT-OPTIONS: s_delno FOR likp-vbeln.
SELECTION-SCREEN END OF BLOCK part1.










9) Radio Button In Selection Screen

SELECTION-SCREEN BEGIN OF BLOCK rad1
WITH FRAME TITLE text-001.
PARAMETERS: r1 RADIOBUTTON GROUP gr1,
r2 RADIOBUTTON GROUP gr1,
r3 RADIOBUTTON GROUP gr1.
SELECTION-SCREEN END OF BLOCK rad1.









ALSO READ:

- ELEMENTARY DATA TYPES - Initial Values, Syntax & Properties.

- FIELD SYMBOLS - Introduction, Syntax & Examples.

- PARAMETERS - Introduction, Syntax & Examples.

- SELECT-OPTIONS - Introduction, Syntax & Examples.

- SELECTION-SCREEN - Introduction, Syntax & Examples.

- SSCRFIELDS - The Screen Fields Table.



Your suggestions and comments are welcome in this section.

Please mail all your contributions to administrator@abapmadeeasy.com We request you to mention your Name, Designation, Experience & Organization you are working for. Your posts will be verified and posted in this site with your name.

No comments:

Post a Comment