Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Re: user-command

moniabap_moni
Explorer
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

use the case statement.

case sy-uomm.

when 'select all'.

....checkbox = 'x'.

when ' deselect'.

....checkbox = ' '.

endcase.

4 REPLIES 4

Former Member
0 Kudos

Hi,

use the case statement.

case sy-uomm.

when 'select all'.

....checkbox = 'x'.

when ' deselect'.

....checkbox = ' '.

endcase.

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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