06-17-2008 5:34 PM
Re: user-command
Hi Experts
I have ITAB which has 5 fields and a variable chbox.and i am printing the 5 fields value thro write stmt and displaying chcekbox in the front of output and in user-command i have selectall ,deselect,refresh buttons when i click 'selectall' all the checkbox in output has to select as TICK,and when click 'deselect' all the checkbox in output has to deselect and if i click refresh it has to refresh the output for the selected checkbox.
Rewarded if helpful.......
Example
-
selectall ,deselect,refresh
-
[] 10000000 age india north west
[] 10000000 age india north south
[] 10000000 age india east west
06-18-2008 3:17 AM
Hi,
use the case statement.
case sy-uomm.
when 'select all'.
....checkbox = 'x'.
when ' deselect'.
....checkbox = ' '.
endcase.
06-18-2008 3:17 AM
Hi,
use the case statement.
case sy-uomm.
when 'select all'.
....checkbox = 'x'.
when ' deselect'.
....checkbox = ' '.
endcase.
06-18-2008 3:59 AM
Hi Moni,
Please check the following code
CASE sy-ucomm.
WHEN 'SELECTALL'.
DO w_lines TIMES.
READ LINE sy-index FIELD VALUE w_check.
IF w_check EQ space.
checkbox = 'X'.
MODIFY LINE sy-index FIELD VALUE w_check FROM w_check.
ENDIF.
ENDDO.
WHEN 'DESELECT'.
DO w_lines TIMES.
READ LINE sy-index FIELD VALUE w_check.
checkbox = ' '.
MODIFY LINE sy-index FIELD VALUE w_check FROM w_check.
ENDDO.
WHEN 'REFRESH'.
DO w_lines TIMES.
READ LINE sy-index FIELD VALUE w_check.
IF w_check EQ 'X'.
CLEAR checkbox.
MODIFY LINE sy-index FIELD VALUE w_check FROM w_check.
ENDIF.
ENDDO.
ENDCASE.
Besrt regards,
raam
06-18-2008 4:03 AM
hi,
try the below code in AT USER-COMMAND Event.
AT USER-COMMAND.
Case Sy-ucomm.
when 'SELECTALL'.
loop at itab into wa.
wa-chkbox = 'X'.
modify itab from wa.
endloop.
When 'DESELECTALL'.
loop at itab into wa.
wa-chkbox = space.
modify itab from wa.
endloop.
When 'REFRESH'.
Rebuild the internal table.
endcase.
chkbox is the char field of length 1 for checkbox
Reward if found helpful.
Regards,
Boobalan Suburaj
06-18-2008 4:36 PM
Hi Moni,
Try this simple LOOP (at the event AT USER-COMMAND):
FIELD-SYMBOLS: <fs> type itab.
LOOP AT itab ASSIGNING <fs>.
IF sy-ucomm = 'SELECTALL'.
<fs>-checkbox = 'X'.
ELSEIF sy-ucomm = 'DESELECT'.
CLEAR: <fs>-checkbox. checkbox = ' '.
ELSEIF sy-ucomm = 'REFRESH'.
<fs>-checkbox = <default>. " set your default value (either X or space)
ENDIF.
ENDLOOP.
Using the ASSIGN clause you have NOT to MODIFY your itab table! Because <fs> points directly to the current line.
Try it and have success,
Heinz