Skip to Content
author's profile photo Former Member
Former Member

Re: user-command

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 18, 2008 at 02:17 AM

    Hi,

    use the case statement.

    case sy-uomm.

    when 'select all'.

    ....checkbox = 'x'.

    when ' deselect'.

    ....checkbox = ' '.

    endcase.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 18, 2008 at 03: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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 18, 2008 at 02: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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 18, 2008 at 03: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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.