At Selection Screen Output
At Selection Screen Output
We can change selection screen dynamically by the event AT-SELECTION SCREEN OUTPUT. Now SCREEN contains the following fields which hold screen information at run time. We can customize the screen information by looping the screen and modify the screen as required. All screen modifications should be done under the event AT-SELECTION SCREEN OUTPUT.
Component
|
Length
|
Type
|
Attribute
|
Description
|
name
|
132
|
c
|
Name
|
Name
|
group1
|
3
|
c
|
Group1
|
Modification group
|
group2
|
3
|
c
|
Group2
|
Modification group
|
group3
|
3
|
c
|
Group3
|
Modification group
|
group4
|
3
|
c
|
Group4
|
Modification group
|
required
|
1
|
c
|
Required-entry field
|
Mandatory field
|
input
|
1
|
c
|
Input
|
input-enabled field
|
output
|
1
|
c
|
Output
|
display field
|
intensified
|
1
|
c
|
Intensified
|
intensified field
|
invisible
|
1
|
c
|
Invisible
|
invisible element
|
length
|
1
|
x
|
Visible Length
|
Field length
|
active
|
1
|
c
|
Input/Output/Invisible
|
active field
|
display_3d
|
1
|
c
|
Two-dimensional
|
Box
|
value_help
|
1
|
c
|
Input help
|
Input help key
|
request
|
1
|
c
|
-
|
Input exists
|
values_in_combo
|
1
|
c
|
Dropdown listbox
|
Value help exists
|
In the following example we have called a selection screen where two radio buttons (PO & Item) have been mentioned. PO is selected by default. Now the screen contains four parameters (purchase order, company code, item & material). Now for default selection of PO button the purchase order & company fields are appeared. If we select item button then purchase order, item & material input fields will be displayed.
REPORT zsr_test.
PARAMETERS: po RADIOBUTTON GROUP rad1 DEFAULT 'X' USER-COMMAND test,
item RADIOBUTTON GROUP rad1,
p_ebeln TYPE ekko-ebeln,
p_bukrs TYPE ekko-bukrs,
p_ebelp TYPE ekpo-ebelp,
p_matnr TYPE ekpo-matnr.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
"If item is selected then Item field appears
IF screen-name CP '*P_EBELP*'.
IF item IS NOT INITIAL.
screen-active = 1.
ELSE.
screen-active = 0.
ENDIF.
MODIFY SCREEN.
ENDIF.
"If item is selected then Material field appears
IF screen-name CP '*P_MATNR*'.
IF item IS NOT INITIAL.
screen-active = 1.
ELSE.
screen-active = 0.
ENDIF.
MODIFY SCREEN.
ENDIF.
"If item is selected then Company field disappears
IF screen-name CP '*P_BUKRS*'.
IF item IS NOT INITIAL.
screen-active = 0.
ELSE.
screen-active = 1.
ENDIF.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
PARAMETERS: po RADIOBUTTON GROUP rad1 DEFAULT 'X' USER-COMMAND test,
item RADIOBUTTON GROUP rad1,
p_ebeln TYPE ekko-ebeln,
p_bukrs TYPE ekko-bukrs,
p_ebelp TYPE ekpo-ebelp,
p_matnr TYPE ekpo-matnr.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
"If item is selected then Item field appears
IF screen-name CP '*P_EBELP*'.
IF item IS NOT INITIAL.
screen-active = 1.
ELSE.
screen-active = 0.
ENDIF.
MODIFY SCREEN.
ENDIF.
"If item is selected then Material field appears
IF screen-name CP '*P_MATNR*'.
IF item IS NOT INITIAL.
screen-active = 1.
ELSE.
screen-active = 0.
ENDIF.
MODIFY SCREEN.
ENDIF.
"If item is selected then Company field disappears
IF screen-name CP '*P_BUKRS*'.
IF item IS NOT INITIAL.
screen-active = 0.
ELSE.
screen-active = 1.
ENDIF.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
Post a Comment