‎2007 Jun 13 11:52 AM
Hi experts,
I am using At Selection Screen Output event to disable parameters based on a particular radio button.
the code is:
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS:s_pernr FOR pb0001-pernr MODIF ID M1.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
SELECTION-SCREEN BEGIN OF LINE .
SELECTION-SCREEN COMMENT 5(5) text-003.
SELECTION-SCREEN POSITION 15.
PARAMETERS: p_begda LIKE pb0001-begda MODIF ID M2.
SELECTION-SCREEN COMMENT 38(8) text-004 .
PARAMETERS: p_endda LIKE pb0001-begda MODIF ID M2.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-005.
SELECT-OPTIONS:s_offid FOR pb4001-offid MODIF ID M3.
SELECTION-SCREEN END OF BLOCK b3 .
SELECTION-SCREEN BEGIN OF BLOCK b4 WITH FRAME TITLE text-006.
SELECT-OPTIONS:s_objid FOR pb4003-objid MODIF ID M4.
SELECTION-SCREEN END OF BLOCK b4.
SELECTION-SCREEN BEGIN OF BLOCK b5 WITH FRAME TITLE text-007.
PARAMETERS:p_optn1 RADIOBUTTON GROUP g1.
PARAMETERS:p_optn2 RADIOBUTTON GROUP g1.
PARAMETERS:p_optn3 RADIOBUTTON GROUP g1.
PARAMETERS:p_optn4 RADIOBUTTON GROUP g1.
SELECTION-SCREEN END OF BLOCK b5.
*AT SELECTION-SCREEN OUTPUT.
*IF P_OPTN3 = 'X'.
*LOOP AT SCREEN.
*IF SCREEN-GROUP1 = 'M1'
*OR SCREEN-GROUP1 = 'M2'
*OR SCREEN-GROUP1 = 'M4'.
*SCREEN-INPUT = '0'.
*MODIFY SCREEN.
*ENDIF.
*ENDLOOP.
*ENDIF.
&----
*& Start of Selection
&----
START-OF-SELECTION.
IF p_optn1 = 'X'.
PERFORM get_data_from_pb0001.
ELSEIF p_optn2 = 'X'.
PERFORM get_data_from_pb0002.
ELSEIF p_optn3 = 'X'.
PERFORM get_data_from_pb0022.
ELSEIF p_optn4 = 'X'.
PERFORM get_data_from_pb0023.
ENDIF.
PERFORM populate_data.
**********************************************
but when i am running the report the report is processed and the alv grid is displayed.And after that when i press the back button the parameters are disabled .
But this is not what i wanted.
I want that when i select a particular radio button the specified parameters are disabled before the actual grid display.
Where am i goin wrong.
‎2007 Jun 13 12:16 PM
you have to do like this
data : flag.
SELECTION-SCREEN BEGIN OF BLOCK b5 WITH FRAME TITLE text-007.
PARAMETERS:p_optn1 RADIOBUTTON GROUP g1 user command ucom.
PARAMETERS:p_optn2 RADIOBUTTON GROUP g1.
PARAMETERS:p_optn3 RADIOBUTTON GROUP g1.
PARAMETERS:p_optn4 RADIOBUTTON GROUP g1.
SELECTION-SCREEN END OF BLOCK b5.
AT SELECTION-SCREEN OUTPUT.
IF flag = 'X'.
LOOP AT SCREEN.
IF SCREEN-GROUP1 = 'M1'
OR SCREEN-GROUP1 = 'M2'
OR SCREEN-GROUP1 = 'M4'.
SCREEN-INPUT = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
clear flag.
ENDIF.
at selection-screen.
if P_OPTN3 = 'X'.
flag = 'X'.
else.
clear flag.
endif.
regards
shiba dutta
‎2007 Jun 13 11:54 AM
Hi
Do it in the AT selection-screen output event
see the sample
REPORT zrich_001.
PARAMETERS: p_rad1 RADIOBUTTON GROUP grp1 DEFAULT 'X'
user-command chk,
p_rad2 RADIOBUTTON GROUP grp1.
SELECT-OPTIONS: s_datum1 FOR sy-datum MODIF ID d1,
s_datum2 FOR sy-datum MODIF ID d2.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF p_rad1 = 'X'
AND screen-group1 = 'D2'.
screen-active = '0'.
ENDIF.
IF p_rad2 = 'X'
AND screen-group1 = 'D1'.
screen-active = '0'.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
or
IF pa_rep EQ gc_x.
LOOP AT SCREEN.
IF screen-group1 = gc_abc.
screen-input = gc_zero_num.
ELSEIF screen-group1 = gc_def.
screen-active = gc_one_num.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ELSEIF pa_upd EQ gc_x.
*For Reprocessing
LOOP AT SCREEN.
IF screen-group1 = gc_def.
screen-input = gc_zero_num.
ELSEIF screen-group1 = gc_abc.
screen-active = gc_one_num.
ENDIF.
MODIFY SCREEN.
CLEAR pa_upd.
ENDLOOP.
ENDIF.
Reward points for useful Answers
Regards
Anji
‎2007 Jun 13 11:57 AM
Hi,
The problem is you dont have the event
AT SELECTION-SCREEN.
You need to check the radio button here and set some flag.
Then in the event
AT SELECTION-SCREEN OUTPUT you need to put the code to disable fields.
<b>You are going Wrong coz</b>
The problem with the current report is you dont have the AT SELECTION-SCREEN so it going to START OF SELECTION.
When ever you have AT SELECTION-SCREEN after this event bloc AT SELECTION-SCREEN OUTPUT is called so the screen fields will get disabled.
Regards,
Sesh
Message was edited by:
Seshatalpasai Madala
‎2007 Jun 13 11:59 AM
you will need to reset the radio button 3 to '' (blank) on coming back because the at selection screen output event is fired again when you come back. at this stage, the value of the radio button is still 'X'...and thats why the observed behaviour.
in the alv user command, write the code to reset the buttons to their initial values (selecting the one you want) and then see the result.
Message was edited by:
Priyank Jain
‎2007 Jun 13 12:01 PM
Hi,
U just have to set the user-command for the radio button like this...
Then it will trigger both <b>at selection-screen</b> event and <b>at selection-screen output</b> event.
SELECTION-SCREEN BEGIN OF BLOCK b5 WITH FRAME TITLE text-007.
PARAMETERS:p_optn1 RADIOBUTTON GROUP g1 <b>USER-COMMAND RD1</b>.
PARAMETERS:p_optn2 RADIOBUTTON GROUP g1.
PARAMETERS:p_optn3 RADIOBUTTON GROUP g1.
PARAMETERS:p_optn4 RADIOBUTTON GROUP g1.
‎2007 Jun 13 12:04 PM
See the Anji program and when you select radio button ,selection-screen will not disable,you need to press enter button.
‎2007 Jun 13 12:16 PM
you have to do like this
data : flag.
SELECTION-SCREEN BEGIN OF BLOCK b5 WITH FRAME TITLE text-007.
PARAMETERS:p_optn1 RADIOBUTTON GROUP g1 user command ucom.
PARAMETERS:p_optn2 RADIOBUTTON GROUP g1.
PARAMETERS:p_optn3 RADIOBUTTON GROUP g1.
PARAMETERS:p_optn4 RADIOBUTTON GROUP g1.
SELECTION-SCREEN END OF BLOCK b5.
AT SELECTION-SCREEN OUTPUT.
IF flag = 'X'.
LOOP AT SCREEN.
IF SCREEN-GROUP1 = 'M1'
OR SCREEN-GROUP1 = 'M2'
OR SCREEN-GROUP1 = 'M4'.
SCREEN-INPUT = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
clear flag.
ENDIF.
at selection-screen.
if P_OPTN3 = 'X'.
flag = 'X'.
else.
clear flag.
endif.
regards
shiba dutta
‎2007 Jun 14 6:31 AM
Thanks to all for ur help.
I have awarded points for all ur help.
‎2007 Jun 14 6:59 AM
I need some more help on this.
its working fine now but when the selction screen is displayed its having p_optn1 selected as default but the parameters of modif id M2 M3 and M4 are still enabled.
How to cater for this.
‎2007 Jun 14 7:01 AM
hEY SORRY ALL.
i got the answer myself.
This could be done in the initialisation event.