‎2007 Jul 05 9:31 AM
hi !
I need to change selects option dynamically from mandatory / not mandatory
depends on the user selection of radio buttons.
What is the event should i use for task ?
I tried the following code:
AT SELECTION-SCREEN OUTPUT.
IF p_cust IS NOT INITIAL .
LOOP AT SCREEN.
IF screen-name = 'S_KNA1'.
screen-required = '1'.
MODIFY SCREEN.
ENDIF.
IF screen-name = 'S_KONDA'.
screen-required = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
I also tried the event :
*AT SELECTION-SCREEN ON RADIOBUTTON GROUP radi .
IF p_cust IS NOT INITIAL .
LOOP AT SCREEN.
IF screen-name = 'S_KNA1'.
screen-required = '1'.
MODIFY SCREEN.
ENDIF.
IF screen-name = 'S_KONDA'.
screen-required = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
However both events doesn't work !
Please give a code example of how to do the task.
Thanks
Moshe
‎2007 Jul 05 9:39 AM
Hi
U should manage it in AT SELECTION-SCREEN event without to change the field input/output characteristics.
PARAMETERS: P1 TYPE C,
P2 TYPE C,
P3 TYPE C.
PARAMETERS: R1 RADIOBUTTON GROUP R1 USER-COMMAND AAA,
R2 RADIOBUTTON GROUP R1,
R3 RADIOBUTTON GROUP R1.
AT SELECTION-SCREEN.
CASE 'X'.
WHEN R1.
IF P1 IS INITIAL.
MESSAGE E208(00) WITH 'Insert P1'.
ENDIF.
WHEN R2.
IF P2 IS INITIAL.
MESSAGE E208(00) WITH 'Insert P1'.
ENDIF.
WHEN R3.
IF P3 IS INITIAL.
MESSAGE E208(00) WITH 'Insert P1'.
ENDIF.
ENDCASE.
Max
‎2007 Jul 05 9:39 AM
Hi
U should manage it in AT SELECTION-SCREEN event without to change the field input/output characteristics.
PARAMETERS: P1 TYPE C,
P2 TYPE C,
P3 TYPE C.
PARAMETERS: R1 RADIOBUTTON GROUP R1 USER-COMMAND AAA,
R2 RADIOBUTTON GROUP R1,
R3 RADIOBUTTON GROUP R1.
AT SELECTION-SCREEN.
CASE 'X'.
WHEN R1.
IF P1 IS INITIAL.
MESSAGE E208(00) WITH 'Insert P1'.
ENDIF.
WHEN R2.
IF P2 IS INITIAL.
MESSAGE E208(00) WITH 'Insert P1'.
ENDIF.
WHEN R3.
IF P3 IS INITIAL.
MESSAGE E208(00) WITH 'Insert P1'.
ENDIF.
ENDCASE.
Max
‎2007 Jul 05 9:41 AM
Hi,
Instead of SCREEN-NAME use SCREEN-GROUP1 and for your select options give MODIF ID.
As follows
SELECTION-OPTIONS: selcrt for dobj MODIF ID MOD1.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
CHECK SCREEN-GROUP1 = 'MOD1.
SCREEN-REQUIRED = 1.
MODIFY SCREEN.
ENDLOOP.
This is COZ when you use select-options you get TWO fileds on the INPUT screen LOW and HIGH so you have to check for selcrit-low and selctri-high you can avoid all this my assigning a MODIF ID.
Regards,
Sesh
‎2007 Jul 05 9:59 AM
Hi,
You have used the correct event. The things you have to take care:
1. In declaration of the RADIO BUTTON you must use the addition USER-COMMAND.
For example,
PARAMETER p_rdoc RADIOBUTTON GROUP grp USER-COMMAND ucmnd DEFAULT 'X'.
2. if you are using select option, then the screen fields will be S_KNA1-LOW and S_KNA1-HIGH and correspondingly same for the S_KONDA. But if you are parameters, then your code is alright.
AT SELECTION-SCREEN OUTPUT.
IF p_cust IS NOT INITIAL .
LOOP AT SCREEN.
IF screen-name = 'S_KNA1'.
screen-required = '1'.
MODIFY SCREEN.
ENDIF.
IF screen-name = 'S_KONDA'.
screen-required = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
‎2007 Jul 05 1:35 PM
Hi Dp !
First Thanks for your answer, it was very helpful.
I wanted to ask else how at the AT SELECTION-SCREEN OUTPUT.
do i get the last field the user selected
( set focus at : S_KNA1-low, S_KONDA-low, or p_cust radio button )
I tried GET CURSOR FIELD CURSORFIELD.
However its sy-subrc is always ne 0, and hence i don't get proper field?
Thanks
Moshe