04-23-2009 2:30 PM
Hi every one,
I have 2 radio buttons in my screen. I have grouped them. My requirement is that when i select RB1 one input/output field should be enabled and when i select RB2 it should be disabled.
Also when Iam trying to select the other radio button its asking me to fill in all the required fields. but i want other mandatory fields to be filled after selecting the radio button.
Please suggest me a solution.
Thanks in advance,
Sri...
04-24-2009 1:52 AM
Hi Sri,
In PBO
-
LOOP at screen.
if screen-name = 'Your field"
Screen-Input = 0.
Screen-Invisible = 1.
Modify Screen.
Endloop.
-
Try this code hope it will solve your problem.
04-23-2009 2:48 PM
enabling and disabling can be done using loop at screen in pbo module.
Just search the forum.
For other issue. Don't mark any fields as mandatory. instead you check it manually the mandatory fields initial check.
So that you can avoid that error.
04-23-2009 4:51 PM
Hi,
In addition to above answer if you are using Table control and want to change attributes at press of either of buttons, then you should read structure TAB_C-COLS, where TAB_C is name of table control.
COLS has structure similar to SCREEN.
Regards
Bin
04-24-2009 1:52 AM
Hi Sri,
In PBO
-
LOOP at screen.
if screen-name = 'Your field"
Screen-Input = 0.
Screen-Invisible = 1.
Modify Screen.
Endloop.
-
Try this code hope it will solve your problem.
04-24-2009 5:24 AM
Hi Suvendu,
Thank you. Your code has worked. But when I am trying to inactive two fields at a time it's not working.
i.e.
Loop at screen.
CASE sy-ucomm.
WHEN 'F_AT'.
IF R1 = 'X'.
IF screen-name = 'field1' AND screen-name = 'field2'.
Screen-Input = 0.
Screen-Invisible = 1.
Modify Screen.
ENDIF.
ENDIF.
ENDCASE.
Endloop.
is not working. what might be the problem?
Thanks,
Sri...
04-24-2009 6:43 AM
Put Field1 and Field2 in one screen Group
CASE sy-ucomm.
WHEN 'F_AT'.
Loop at screen.
IF R1 = 'X'.
IF screen-Group1 = <Group>.
Active = 0.
Modify Screen.
ENDIF.
ENDIF.
Endloop.
ENDCASE.
OR:
IN PBO:
Loop at screen.
IF R1 = 'X'.
IF screen-Group1 = <Group>.
Active = 0.
Modify Screen.
ENDIF.
ENDIF.
Endloop.
Regards,
Gurpreet
04-24-2009 7:03 AM
04-24-2009 7:08 AM
Module Pool:
Goto-->Screen Painter-->Properties of the Input/Output Field-->Give the group name(First box only).
Report:
Use
Modif ID 'XX'
Regards,
Gurpreet
04-24-2009 8:10 AM
Hi,
Thanks for ur inputs.
Every thing went right untill this problem araised.
I am haveing 5 radio buttons in my screen where where 2 buttons are one group and the rest are grouped in another group.
when one radio button in group 1 is selected then the required screen-group is getting disabled, and again when i am selecting radio button in group 2 another screen-group is getting disabled but the previously disabled screen-group is getting enabled again.
So please provide a solution to my problem.
Thanks,
Sri...
04-24-2009 8:22 AM
Once you Click the Button the Field is disable and again when you click the other button make the screen field active(Screen-Active = 1).
IF button1 = 'X'.
Loop at screen.
IF screen-Group1 = <Group>.
Active = 0.
Modify Screen.
ENDIF.
Endloop.
ELSE.
Loop at screen.
IF screen-Group1 = <Group>.
Active = 1.
Modify Screen.
ENDIF.
Endloop.
ENDIF.
Hope this helps.
Regards,
Gurpreet
04-24-2009 9:21 AM
Hi Gurupreet,
In the PBO my code goes like this :
LOOP AT SCREEN.
CASE sy-ucomm.
WHEN 'F_AT'.
IF R1 = 'X'.
if screen-group1 = 'G1'.
Screen-Input = 0.
Screen-Invisible = 1.
Modify Screen.
ENDIF.
ENDIF.
WHEN 'F_MOP'.
IF R3 = 'X'.
if screen-group1 = 'G2'.
Screen-Input = 0.
Screen-Invisible = 1.
Modify Screen.
ENDIF.
ELSEIF R4 = 'X'.
if screen-name = 'field1'.
Screen-Input = 0.
Screen-Invisible = 1.
Modify Screen.
ENDIF.
ELSEIF R5 = 'X'.
if screen-name = 'field2'.
Screen-Input = 0.
Screen-Invisible = 1.
Modify Screen.
ENDIF.
ENDIF.
ENDCASE.
ENDLOOP.
Any changes that I need to make to this code.
Thanks,
Sri...
04-24-2009 9:51 AM
Where ever you require the field to diaply Use
Subroutine Perform screen_opt_grp USING 'G1' '1' '0'. Pass the Group name not displaying.
Try to Avoid Case statement inside the LOOPS.
CASE SY_UCOMM.
WHEN 'F_AT'.
IF R1 = 'X'.
Perform screen_opt_grp USING 'G1' '0' '1'.
ELSE. " R2 = 'X' Display the field
Perform screen_opt_grp USING 'G1' '1' '0'.
ENDIF.
WHEN 'F_MOP'.
IF R3 = 'X'.
Perform screen_opt_grp USING 'G2' '0' '1'.
ELSEIF R4 = 'X'.
PErform Screen_opt_name USING 'FIELD1' '0' '1'.
ELSEIF R5 = 'X'.
PErform Screen_opt_name USING 'FIELD2' '0' '1'.
ENDIF.
ENDCASE.
FORM Screen_OPT_GRP Using VALUE(GRP)
Value(W1)
Value(W2). " SCreen Group
LOOP AT SCREEN.
if screen-group1 = GRP.
Screen-Input = W1.
Screen-Invisible = W2.
Modify Screen.
ENDIF.
ENDLOOP.
ENDFORM.
FORM Screen_OPT_NAMEUsing VALUE(L_NAME)
Value(W1)
Value(W2). " Screen Name.
LOOP AT SCREEN.
if screen-name = L_NAME.
Screen-Input = W1.
Screen-Invisible = W2.
Modify Screen.
ENDIF.
ENDLOOP.
ENDFORM.
Hope this helps
Regards,
Gurpreet
04-24-2009 12:21 PM
Hi Gurupreet,
Many thanks for your reply. But my problem has not rectified with that. still when I am selecting RB from second group the previously disabled screen-group (when selecting RB from first group)is getting enabled.
please try to rectify my problem.
thanks,
Sri...
04-24-2009 1:02 PM
I think now i have the correct picture of your problem.
Everytime you select radiobutton from 2nd group PBO is execute again and the screen table is refreshed.Which enables the disable field.Make the field disable in the 2nd case also.
CASE SY_UCOMM.
WHEN 'F_AT'.
IF R1 = 'X'.
Disable Screen Group
ENDIF.
WHEN 'F_MOP'.
IF R1 = 'X'.
Disable Screen Group " Check the radiobutton here also
ENDIF.
IF R3 = 'X.
Process.
ELSEIF R4 = 'X'.
Process.
ENDIF.'
ENDCASE.
Regards,
Gurpreet
04-24-2009 2:25 PM
04-24-2009 7:00 AM
Hi..
This is my pattern.
1. SELECTION-SCREEN
PARAMETERS RB1 RADIOBUTTON GROUP GRP1 USER-COMMAND C1000 DEFAULT 'X'.
PARAMETERS P_BUKRS1 TYPE BUKRS MODIF ID I01.
PARAMETERS P_BUKRS2 TYPE BUKRS MODIF ID I01.
PARAMETERS RB2 RADIOBUTTON GROUP GRP1.
PARAMETERS P_MATNR1 TYPE MATNR MODIF ID I02.
PARAMETERS P_MATNR2 TYPE MATNR MODIF ID I02.
2. AT SELECTION-SCREEN OUTPUT
IF RB1 NE 'X'.
LOOP AT SCREEN.
IF SCREEN-GROUP1 EQ 'I01'. " MODIF ID
SCREEN-ACTIVE = '0'. "(or Vissible, InVisible)
ELSE.
SCREEN-ACTIVE = '1'. "(or Vissible, InVisible)
ENDIF.
MODIFY SCREEN..
ENDLOOP.
ENDIF.
IF RB2 NE 'X'.
LOOP AT SCREEN.
IF SCREEN-GROUP1 EQ 'I02'. " MODIF ID
SCREEN-ACTIVE = '0'. "(or Vissible, InVisible)
ELSE.
SCREEN-ACTIVE = '1'. "(or Vissible, InVisible)
ENDIF.
MODIFY SCREEN..
ENDLOOP.
ENDIF.
^^;
Edited by: William KIM on Apr 24, 2009 8:01 AM
Edited by: William KIM on Apr 24, 2009 8:03 AM
04-24-2009 1:14 PM
Hi Sri,
Enabling and disabling of screen fields can be done only in PBO .
You can check if the field is X in PBO then display two field else the other two fields.
Or if you are using PAI set some flag or value and check the same in PBO. before hiding the fields.
The sample code is as follows:
PBO :
If R1 = X. (field value set or flag set)
Loop at screen.
IF screen-name = 'field1' OR screen-name = 'field2'.
Screen-Input = 0.
Screen-Invisible = 1.
Modify Screen.
ENDIF.
ENDIF.
Endloop.
Hope it helps
Regards,
Komal