Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

at selection screen output

Former Member
0 Likes
3,830

Hi all,

The 'screen' has many components like group1, group2, input, output, intensified, invisible, length.

Could anyone explains each of these with a sample program for 'AT SELECTION-SCREEN OUTPUT' event with the above components?.

Regards,

Shanthi.

Hi all,

The 'screen' has many components like group1, group2, input, output, intensified, invisible, length.

Could anyone explains each of these with a sample program for 'AT SELECTION-SCREEN OUTPUT' event with the above components?.

Regards,

Shanthi.

2 REPLIES 2
Read only

Former Member
0 Likes
1,275

Hi,

at selection screen------when user enters the values in the feilds of the selection screen and clicks on execution button,this event gets triggered.this event is basically for checking the value entered by the user for the feild of the selection screen i.e data validity checking.this event is for entire selection screen.

at selection screen output-----

This event is executed at PBO of the selection screen every time the user presses

ENTER - in contrast to INITIALIZATION . Therefore, this event is not suitable for setting selection screen default values.

Also, since AT SELECTION-SCREEN OUTPUT is first executed after the variant is imported (if a variant is used)

and after adopting any values specified under SUBMIT in the WITH clause, changing the report parameters

or the selection options in AT SELECTION-SCREEN OUTPUT would destroy the specified values.

Here, however, you can use LOOP AT SCREEN or MODIFY SCREEN to change the input/output attributes of selection screen fields.

Example

Output all fields of the SELECT-OPTION NAME highlighted:

******************************************************

SELECT-OPTIONS NAME FOR SY-REPID MODIF ID XYZ.

....

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

CHECK SCREEN-GROUP1 = 'XYZ'.

SCREEN-INTENSIFIED = '1'.

MODIFY SCREEN.

ENDLOOP.

The addition MODIF ID XYZ to the key word SELECT-OPTIONS

assigns all fields of the selection option NAME to a group you can read in the field SCREEN-GROUP1 .

At PBO of the selection screen, all these fields are then set to highlighted.

***************************************************

AT SELECTION_SCREEN OUTPUT

LOOP AT SCREEN.

if VIEW = 'X' " View radio button selects

IF SCREEN-NAME = 'PR1'.

screen-INPUT = 0.

modify screen.

ENDIF.

IF SCREEN-NAME = 'PR2'.

screen-INPUT = 0.

modify screen.

ENDIF.

ENDLOOP.

AT SELECTION-SCREEN.

*val....1 Variant check

Once the user has entered variant, check about its existence

PERFORM CHECK_PVAR. "Using FM REUSE_ALV_VARIANT_EXISTENCE

*val....2 Sd do not exists

SELECT SINGLE VBELN INTO WA_HEADER-VBELN FROM VBAK WHERE VBELN IN

S_VBELN.

IF SY-SUBRC 0.

MESSAGE E010 WITH TEXT-010.

ENDIF.

*val.....3 Date of creation check

LOOP AT S_DOC.

IF S_DOC-LOW > SY-DATUM OR S_DOC-HIGH > SY-DATUM.

MESSAGE E011 WITH TEXT-011.

ENDIF.

ENDLOOP.

*VAL....4

if P_DOWN = 'X' AND P_PATH is initial.

MESSAGE E011 WITH TEXT-011.

endif.

if P_DW_RP = 'X' AND P_path is initial.

MESSAGE E011 WITH TEXT-011.

endif.

***********************************************

at selection-screen output.

if c1 = 'X'.

LOOP AT SCREEN.

CASE SCREEN-NAME.

WHEN 'P1'.

SCREEN-ACTIVE = '0'. 'HERE I AM DISABLING FIRST PARAMETER (P1 IS A PARAMETER NAME)

MODIFY SCREEN.

ENDCASE.

ENDLOOP.

if c2 = 'X'.

LOOP AT SCREEN.

CASE SCREEN-NAME.

WHEN 'P2'.

SCREEN-ACTIVE = '0'.'HERE I AM DISABLING SECOND PARAMETER

MODIFY SCREEN.

ENDCASE.

ENDLOOP.

***************************************************************

REPORT DEMO.

PARAMETERS: TEST1(10) MODIF ID SC1,

TEST2(10) MODIF ID SC2,

TEST3(10) MODIF ID SC1,

TEST4(10) MODIF ID SC2.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF SCREEN-GROUP1 = 'SC1'.

SCREEN-INTENSIFIED = '1'.

MODIFY SCREEN.

CONTINUE.

ENDIF.

IF SCREEN-GROUP1 = 'SC2'.

SCREEN-INTENSIFIED = '0'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

At selection-screen output is used to change the properties of selection screen fields...

Loop at screen - where screen is a default structure maintained by SAP...which contains many fields like the below field...each serves a purpose using which we can change the properties of selection screen fields.....

NAME

GROUP1

GROUP2

GROUP3

GROUP4

REQUIRED

INPUT

OUTPUT

INTENSIFIED

INVISIBLE

LENGTH

ACTIVE

DISPLAY_3D

VALUE_HELP

REQUEST

VALUES_IN_COMBO

COLOR

Regards,

Raj.

Read only

Former Member
0 Likes
1,275

hi shanthi...

for the input invisible(mostly used in the pass word cases).

check this..

REPORT ZDATEDIFF.

SELECTION-SCREEN BEGIN OF SCREEN 500 AS WINDOW TITLE title.

Parameters: p_name like sy-uname,

p_pas like sy-uname lower case.

SELECTION-SCREEN skip 1.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 2(70) text-001.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END OF SCREEN 500.

CALL SELECTION-SCREEN '0500' STARTING AT 10 10 ending at 70 14.

data: begin of it_user occurs 0,

name like sy-uname,

password like sy-uname,

end of it_user.

it_user-name = 'venkat'.

it_user-password = 'venkat'.

append it_user.

it_user-name = 'srinivas'.

it_user-password = 'srinivas'.

append it_user.

it_user-name = 'preethi'.

it_user-password = 'preethi'.

append it_user.

it_user-name = 'vidya'.

it_user-password = 'vidya'.

append it_user.

AT SELECTION-SCREEN OUTPUT.

loop at screen.

check screen-name eq 'P_PAS'.

move: 1 to screen-invisible.

modify screen.

endloop.

start-of-selection.

if p_pas = 'venkat'.

write:/ 'this is working'.

endif.

in some cases there is a need to disable some elements and enable some fields in this case group , input , output can be used

this is an example for group .

ztest .

PARAMETERS:p_matnr(18) TYPE c MODIF ID mid.

DATA:BEGIN OF itab OCCURS 0,

matnr TYPE matnr,

END OF itab.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN .

IF screen-group1 EQ 'MID'.

screen-input = '0'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_matnr.

LOOP AT SCREEN .

IF screen-group1 EQ 'MID'.

screen-input = '1'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

IF itab IS INITIAL.

itab-matnr = 'ABC123456788'.

APPEND itab.

itab-matnr = 'BCS123456788'.

APPEND itab.

itab-matnr = 'DFC123456788'.

APPEND itab.

itab-matnr = 'ASW123456788'.

APPEND itab.

ENDIF.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'MATNR'

dynpprog = sy-repid

dynpnr = sy-dynnr

dynprofield = 'P_MATNR'

value_org = 'S'

TABLES

value_tab = itab.

LOOP AT SCREEN .

IF screen-group1 EQ 'MID'.

screen-input = '0'.

MODIFY SCREEN.

ENDIF.

endloop.

this is an example for input output..

&----


*& Report ZVENKATTEST0

*&

&----


*&

*&

&----


REPORT ZVENKATTEST0.

TABLES:MARA.

SELECT-OPTIONS:S_TEST1 FOR MARA-MATNR MODIF ID M1 ,

S_TEST2 FOR MARA-MEINS MODIF ID M2 .

PARAMETERS:P_RAD1 RADIOBUTTON GROUP G1 USER-COMMAND UC1 DEFAULT 'X',

P_RAD2 RADIOBUTTON GROUP G1 ,

P_RAD3 RADIOBUTTON GROUP G1 .

AT SELECTION-SCREEN OUTPUT .

LOOP AT SCREEN.

IF P_RAD1 = 'X'.

IF SCREEN-NAME = 'S_TEST1-LOW' .

SCREEN-INPUT = '0'.

MODIFY SCREEN.

ENDIF.

IF SCREEN-NAME = 'S_TEST1-HIGH' .

SCREEN-INPUT = '0'.

MODIFY SCREEN.

ENDIF.

IF SCREEN-NAME = 'S_TEST2-LOW' .

SCREEN-INPUT = '0'.

MODIFY SCREEN.

ENDIF.

IF SCREEN-NAME = 'S_TEST2-HIGH' .

SCREEN-INPUT = '0'.

MODIFY SCREEN.

ENDIF.

ENDIF.

IF P_RAD2 = 'X'.

IF SCREEN-NAME = 'S_TEST1-LOW' .

SCREEN-INPUT = '0'.

MODIFY SCREEN.

ENDIF.

IF SCREEN-NAME = 'S_TEST1-HIGH' .

SCREEN-INPUT = '0'.

MODIFY SCREEN.

ENDIF.

ENDIF.

IF P_RAD3 = 'X'.

IF SCREEN-NAME = 'S_TEST2-LOW' .

SCREEN-INPUT = '0'.

MODIFY SCREEN.

ENDIF.

IF SCREEN-NAME = 'S_TEST2-HIGH' .

SCREEN-INPUT = '0'.

MODIFY SCREEN.

ENDIF.

ENDIF.

ENDLOOP.

regards,

venkat