‎2007 Apr 17 7:11 AM
Hi Friends,
I have a requirement as follows.
AT SELECTION-SCREEN OUTPUT based on a check box value, I am enabling and disabling few other screen fields. But the problem is once I checked the ckeck box, I need to hit the enter key to reflect the changes.
If the user is not hitting the enter key the changes will not reflect on the screen.
Is there any way to do this (to apply enter in the code).
Please update.Will be giving reward points for suitable answers.
Thanks
Sankar
‎2007 Apr 17 7:14 AM
hi,,
Use check boxes with user command . you can define checkboxes and radio buttons with function codes, you can do the same with checkboxes and radio buttons on selection screens. You do this using the USER-COMMAND addition when you declare the relevant parameters:
PARAMETERS ... AS CHECKBOX | RADIOBUTTON GROUP ... USER-COMMAND <ucom>.
You can assign a function code <ucom> to an individual checkbox. However, a radio button group must have one shared function code, since it is only possible to make the assignment for the first button in the group.
When you select a checkbox or radio button in a group, the runtime analysis triggers the AT SELECTION-SCREEN event and places the function code <ucom> into component UCOMM of the interface work area SSCRFIELDS. You must use the TABLES statement to declare the SSCRFIELDS structure.
After the AT SELECTION-SCREEN event has been processed, the system displays the selection screen again. The only way to exit the selection screen and carry on processing the program is to choose Execute (F8). Consequently, checkboxes and radio buttons with function codes are more suitable for controlling dynamic modifications on a selection screen than for controlling the program flow.
TABLES sscrfields.
PARAMETERS: rad1 RADIOBUTTON GROUP rad USER-COMMAND radio,
rad2 RADIOBUTTON GROUP rad,
rad3 RADIOBUTTON GROUP rad.
PARAMETERS check AS CHECKBOX USER-COMMAND check.
AT SELECTION-SCREEN.
MESSAGE i888(sabapdocu) WITH text-001 sscrfields-ucomm.
START-OF-SELECTION.
WRITE text-002.
i hope this will solve your problem
regards,
veeresh
‎2007 Apr 17 7:14 AM
Hi,
Try the sample code and see:
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: pa_file TYPE rlgrap-filename MODIF ID abc,
pa_lifnr TYPE lfa1-lifnr MODIF ID abc,
pa_vkorg TYPE vbak-vkorg MODIF ID abc.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
PARAMETERS: pa_kunnr TYPE vbak-kunnr MODIF ID def.
SELECT-OPTIONS: s_lifnr FOR gs_lfa1-lifnr MODIF ID def,
s_date FOR gs_lfa1-erdat MODIF ID def,
s_augru FOR gs_vbak-augru MODIF ID def,
s_vbeln FOR gs_vbak-vbeln MODIF ID def.
SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: pa_upd RADIOBUTTON GROUP g1 USER-COMMAND uc01 DEFAULT 'X'."#EC *
SELECTION-SCREEN COMMENT 3(60) text-004 FOR FIELD pa_upd.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: pa_rep RADIOBUTTON GROUP g1 ."#EC *
SELECTION-SCREEN COMMENT 3(60) text-005 FOR FIELD pa_rep.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK b3.
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.
***********************************************************
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.
reward if useful
regards,
Anji
‎2007 Apr 17 7:14 AM
hi,,
Use check boxes with user command . you can define checkboxes and radio buttons with function codes, you can do the same with checkboxes and radio buttons on selection screens. You do this using the USER-COMMAND addition when you declare the relevant parameters:
PARAMETERS ... AS CHECKBOX | RADIOBUTTON GROUP ... USER-COMMAND <ucom>.
You can assign a function code <ucom> to an individual checkbox. However, a radio button group must have one shared function code, since it is only possible to make the assignment for the first button in the group.
When you select a checkbox or radio button in a group, the runtime analysis triggers the AT SELECTION-SCREEN event and places the function code <ucom> into component UCOMM of the interface work area SSCRFIELDS. You must use the TABLES statement to declare the SSCRFIELDS structure.
After the AT SELECTION-SCREEN event has been processed, the system displays the selection screen again. The only way to exit the selection screen and carry on processing the program is to choose Execute (F8). Consequently, checkboxes and radio buttons with function codes are more suitable for controlling dynamic modifications on a selection screen than for controlling the program flow.
TABLES sscrfields.
PARAMETERS: rad1 RADIOBUTTON GROUP rad USER-COMMAND radio,
rad2 RADIOBUTTON GROUP rad,
rad3 RADIOBUTTON GROUP rad.
PARAMETERS check AS CHECKBOX USER-COMMAND check.
AT SELECTION-SCREEN.
MESSAGE i888(sabapdocu) WITH text-001 sscrfields-ucomm.
START-OF-SELECTION.
WRITE text-002.
i hope this will solve your problem
regards,
veeresh
‎2007 Apr 17 7:43 AM
Veera,
But the specified check box is not defined in the program.
it belonds to logical db field. in that case i can't put a user command for this.
sankar
‎2007 Apr 17 7:16 AM
hi,
Similarly to on screens, where you can define checkboxes with function codes, you can do the same with checkboxes on selection screens. You do this using the USER-COMMAND addition when you declare the relevant parameters:
PARAMETERS ... AS CHECKBOX USER-COMMAND <ucom>.
When you select a checkbox , the runtime analysis triggers the AT SELECTION-SCREEN event and places the function code <ucom> into component UCOMM of the interface work area SSCRFIELDS. You must use the TABLES statement to declare the SSCRFIELDS structure.
After the AT SELECTION-SCREEN event has been processed, the system displays the selection screen again. The only way to exit the selection screen and carry on processing the program is to choose Execute (F8). Consequently, checkboxes and radio buttons with function codes are more suitable for controlling dynamic modifications on a selection screen than for controlling the program flow.
‎2007 Apr 17 7:30 AM
Hi..
paste this sample code..
<b>parameters:</b>
p_check as checkbox <b>user-command CHK</b>,
p_test(10) type c modif id SCR.
<b>at selection-SCREEN OUTPUT</b>.
IF p_check = 'X'.
loop at screen.
if screen-group1 = 'SCR'.
screen-active = 0.
endif.
modify screen.
endloop.
endif.
Message was edited by:
Rammohan Nagam
‎2007 Apr 17 7:34 AM
Sankar,
See the simple code for this requirement.
REPORT zextest595 .
*--- Radiobuttons
PARAMETERS: p_up RADIOBUTTON GROUP a DEFAULT 'X' USER-COMMAND rb,
p_list RADIOBUTTON GROUP a.
PARAMETERS: p_pcfile LIKE rlgrap-filename OBLIGATORY DEFAULT 'C:\'
MODIF ID ccc,
p_pctype LIKE rlgrap-filetype OBLIGATORY DEFAULT 'ASC'
MODIF ID ccc,
p_unix LIKE rlgrap-filename OBLIGATORY DEFAULT '.\'
MODIF ID ccc.
PARAMETERS: p_dir LIKE rlgrap-filename OBLIGATORY DEFAULT '.'
MODIF ID ddd,
p_fp LIKE rlgrap-filename
MODIF ID ddd.
*----
AT SELECTION-SCREEN
*----
AT SELECTION-SCREEN OUTPUT.
IF p_up = 'X' .
LOOP AT SCREEN.
CASE screen-group1.
WHEN 'CCC'.
screen-input = 1. "Enable
screen-invisible = 0. "Disable
MODIFY SCREEN.
WHEN 'DDD'.
screen-input = 0.
screen-invisible = 1.
MODIFY SCREEN.
ENDCASE.
ENDLOOP.
ENDIF.
IF p_list = 'X'.
LOOP AT SCREEN.
CASE screen-group1.
WHEN 'CCC'.
screen-input = 0.
screen-invisible = 1.
MODIFY SCREEN.
WHEN 'DDD'.
screen-input = 1.
screen-invisible = 0.
MODIFY SCREEN.
ENDCASE.
ENDLOOP.
ENDIF.
Don't forget ot reward if useful...