2007 Apr 17 10:18 AM
Hello All,
I have a check box say C1 and radiobuttons R1 and R2.
My scenario is When I click on check box C1 the Radiobutton R1 must be invisible and only R2 must be visible.
For that I wrote the code like this :-
IF p_ekeh = 'X'.
LOOP AT SCREEN.
IF screen-group1 = 'MOD'.
IF screen-name = 'R1'.
screen-input = '0'.
screen-active = '0'.
ENDIF.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ELSE.
* Do nothing
ENDIF.
But I'm able to get the required output only if I press enter after selecting my checkbox.
I want this to happen immediatly after I check the check box.
Is there anything wrong in my code ?
Regards,
Deepu.K
2007 Apr 17 10:25 AM
Hi,
Use <b>User-command < name ></b> in check box parameter.
*----
PARAMETERS : c1 AS CHECKBOX USER-COMMAND cd,
r1 RADIOBUTTON GROUP rad,
r2 RADIOBUTTON GROUP rad.
AT SELECTION-SCREEN OUTPUT.
IF c1 = 'X'.
LOOP AT SCREEN.
IF screen-name = 'R1'.
screen-input = '0'.
screen-active = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSE.
LOOP AT SCREEN.
IF screen-name = 'R1'.
screen-input = '1'.
screen-active = '1'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
r2 = ''.
r1 = 'X'.
ENDIF.
*----
Regards,
Balavardhan.K
Message was edited by:
Balavardhan K
Hello All,
I have a check box say C1 and radiobuttons R1 and R2.
My scenario is When I click on check box C1 the Radiobutton R1 must be invisible and only R2 must be visible.
For that I wrote the code like this :-
IF p_ekeh = 'X'.
LOOP AT SCREEN.
IF screen-group1 = 'MOD'.
IF screen-name = 'R1'.
screen-input = '0'.
screen-active = '0'.
ENDIF.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ELSE.
* Do nothing
ENDIF.
But I'm able to get the required output only if I press enter after selecting my checkbox.
I want this to happen immediatly after I check the check box.
Is there anything wrong in my code ?
Regards,
Deepu.K
2007 Apr 17 10:25 AM
Hi,
Use <b>User-command < name ></b> in check box parameter.
*----
PARAMETERS : c1 AS CHECKBOX USER-COMMAND cd,
r1 RADIOBUTTON GROUP rad,
r2 RADIOBUTTON GROUP rad.
AT SELECTION-SCREEN OUTPUT.
IF c1 = 'X'.
LOOP AT SCREEN.
IF screen-name = 'R1'.
screen-input = '0'.
screen-active = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSE.
LOOP AT SCREEN.
IF screen-name = 'R1'.
screen-input = '1'.
screen-active = '1'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
r2 = ''.
r1 = 'X'.
ENDIF.
*----
Regards,
Balavardhan.K
Message was edited by:
Balavardhan K
2007 Apr 17 10:28 AM
Hi Balavardhan,
Yes U r right.
I forgot to include User-Command statement to my parameter.
Thanks a lot.
Points awarded.
Regards,
Deepu.K
2007 Apr 17 10:26 AM
This occurs because the code needs the PBO to be executed, for which the user needs to do some screen action (enter, refresh, etc).
You can define a function code for the checkbox if you want this to be executed when the user checks/unchecks the box. In the screen properties, assign a function code to the checkbox. This will trigger the flow logic of the program, you will not need to do anything else.
Hope this helps.
Sudha
2007 Apr 17 10:27 AM
Hi Deepu ,
Use the addition USER-COMMAND along with the check box.
Regards
Arun
2007 Apr 17 10:28 AM
Hi Deepu
What you need to do is attach a user-command to the checkbox like
parameter my_checkbox as checkbox user-command checkboxselected.
When the user selects the checkbox on the selection screen, the runtime environment triggers the event AT SELECTION-SCREEN and transfers the function code fcode to the component ucomm of the interface work area sscrfields. If a function code used in the GUI status of the selection screen is specified for fcode, the selection screen processing is affected accordingly.
Example:
The elements of block b2 are assigned to the modification group bl2. A checkbox show_all allows the user to select whether or not these elements are displayed. The display is changed immediately, as selecting the checkbox triggers the event AT SELECTION-SCREEN. The function code is not required. Instead, the content of show_all is evaluated during PBO.
PARAMETERS show_all AS CHECKBOX USER-COMMAND flag.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
PARAMETERS: p1 TYPE c LENGTH 10,
p2 TYPE c LENGTH 10,
p3 TYPE c LENGTH 10.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME.
PARAMETERS: p4 TYPE c LENGTH 10 MODIF ID bl2,
p5 TYPE c LENGTH 10 MODIF ID bl2,
p6 TYPE c LENGTH 10 MODIF ID bl2.
SELECTION-SCREEN END OF BLOCK b2.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF show_all <> 'X' AND
screen-group1 = 'BL2'.
screen-active = '0'.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
2007 Apr 17 10:30 AM
hi,
try like this
<b>p_ekeh as checkbox user-command ucom.</b>
IF p_ekeh = 'X'.
LOOP AT SCREEN.
IF screen-group1 = 'MOD'.
IF screen-name = 'R1'.
screen-input = '0'.
screen-active = '0'.
ENDIF.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ELSE.
Do nothing
ENDIF.
ravi
2007 Apr 17 10:30 AM
REPORT YCHATEST.
PARAMETERS : P_CHK AS CHECKBOX default 'X' USER-COMMAND ABC,
P_RAD1 RADIOBUTTON GROUP RAD MODIF ID DEF,
P_RAD2 RADIOBUTTON GROUP RAD MODIF ID GHI.
DATA : V_FLAG(1).
AT SELECTION-SCREEN.
IF SY-UCOMM EQ 'ABC'.
IF P_CHK EQ 'X'.
V_FLAG = '0'.
ELSE.
V_FLAG = '1'.
ENDIF.
ENDIF.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF SCREEN-GROUP1 EQ 'DEF'.
SCREEN-INPUT = V_FLAG.
SCREEN-ACTIVE = V_FLAG.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
2007 Apr 17 10:38 AM
Try this
PARAMETERS:
p_num TYPE i MODIF ID abc,
p_str(10) TYPE c MODIF ID xyz LOWER CASE.
PARAMETERS:
rone type c RADIOBUTTON GROUP r1 DEFAULT 'X' USER-COMMAND ucom,
rtwo type c RADIOBUTTON GROUP r1 .
SELECTION-SCREEN PUSHBUTTON /10(20) charly USER-COMMAND abcd.
TABLES sscrfields.
DATA:
w_str(10) TYPE c,
w_len TYPE i. .
AT SELECTION-SCREEN OUTPUT.
IF rone EQ 'X'.
LOOP AT SCREEN.
IF screen-group1 = 'XYZ'.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSE.
LOOP AT SCREEN.
IF screen-group1 = 'ABC'.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |