2 Replies Latest reply: Sep 20, 2007 4:19 PM by kuamr kk RSS

Table control checkbox selection

sridher reddy
Currently Being Moderated

Dear friends,

In my table control I have displaye 10 records with check box ,

and I want to delete them( which are selected) from my internal table..

How to capture the selected data from table control?

 

Thanks,

Sridhar

  • Re: Table control checkbox selection
    Vasu Gunda
    Currently Being Moderated

    Add a field in ur internal table  CB type checkbox.

    Now in PAI

     

    this field is set to 'X' when user selects the record.

    Later delete internal table where this field = 'X'

     

    Delete itab where CB = 'X'.

     

    *******************************************

     

    Check this program :

     

    REPORT demo_dynpro_tabcont_loop_at.

     

    CONTROLS flights TYPE TABLEVIEW USING SCREEN 100.

    DATA cols LIKE LINE OF flights-cols.

     

    DATA: ok_code TYPE sy-ucomm,

    save_ok TYPE sy-ucomm.

     

    DATA: itab TYPE TABLE OF demo_conn.

    TABLES demo_conn.

     

    SELECT * FROM spfli INTO TABLE itab.

     

    LOOP AT flights-cols INTO cols WHERE index GT 2.

    cols-screen-input = '0'.

    MODIFY flights-cols FROM cols INDEX sy-tabix.

    ENDLOOP.

     

    CALL SCREEN 100.

     

    MODULE status_0100 OUTPUT.

    SET PF-STATUS 'SCREEN_100'.

    ENDMODULE.

     

    MODULE cancel INPUT.

    LEAVE PROGRAM.

    ENDMODULE.

     

    MODULE read_table_control INPUT.

    MODIFY itab FROM demo_conn INDEX flights-current_line.

    ENDMODULE.

     

    MODULE user_command_0100 INPUT.

    save_ok = ok_code.

    CLEAR ok_code.

    CASE save_ok.

    WHEN 'TOGGLE'.

    LOOP AT flights-cols INTO cols WHERE index GT 2.

    IF cols-screen-input = '0'.

    cols-screen-input = '1'.

    ELSEIF cols-screen-input = '1'.

    cols-screen-input = '0'.

    ENDIF.

    MODIFY flights-cols FROM cols INDEX sy-tabix.

    ENDLOOP.

    WHEN 'SORT_UP'.

    READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.

    IF sy-subrc = 0.

    SORT itab STABLE BY (cols-screen-name+10) ASCENDING.

    cols-selected = ' '.

    MODIFY flights-cols FROM cols INDEX sy-tabix.

    ENDIF.

    WHEN 'SORT_DOWN'.

    READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.

    IF sy-subrc = 0.

    SORT itab STABLE BY (cols-screen-name+10) DESCENDING.

    cols-selected = ' '.

    MODIFY flights-cols FROM cols INDEX sy-tabix.

    ENDIF.

    WHEN 'DELETE'.

    READ TABLE flights-cols INTO cols WITH KEY screen-input = '1'.

    IF sy-subrc = 0.

    LOOP AT itab INTO demo_conn WHERE mark = 'X'.

    DELETE itab.

    ENDLOOP.

    ENDIF.

    WHEN 'INSERT'.

    READ TABLE flights-cols INTO cols WITH KEY screen-input = '1'.

    IF sy-subrc = 0.

    LOOP AT itab INTO demo_conn WHERE mark = 'X'.

    itab1 = itab.

    modify itab1.

    ENDLOOP.

    ENDIF.

    if not itab1 is initial.

    INSERT dbtab FROM TABLE itab1.

    endif.

    ENDCASE.

    ENDMODULE.

     

     

    Regards

    vasu

  • Re: Table control checkbox selection
    kuamr kk
    Currently Being Moderated

    hi

     

    DATA: ok_code TYPE sy-ucomm,

          save_ok TYPE sy-ucomm.

     

    DATA: itab TYPE TABLE OF demo_conn,

          fill TYPE i.

    TABLES demo_conn.

     

    DATA: lines TYPE i,

          limit TYPE i.

     

    SELECT * FROM spfli INTO CORRESPONDING FIELDS OF TABLE itab.

     

    CALL SCREEN 100.

     

    MODULE status_0100 OUTPUT.

      SET PF-STATUS 'SCREEN_100'.

      DESCRIBE TABLE itab LINES fill.

      flights-lines = fill.

    ENDMODULE.

     

    MODULE fill_table_control OUTPUT.

      READ TABLE itab INTO demo_conn INDEX flights-current_line.

    ENDMODULE.

     

    MODULE cancel INPUT.

      LEAVE PROGRAM.

    ENDMODULE.

     

    MODULE read_table_control INPUT.

      lines = sy-loopc.

      MODIFY itab FROM demo_conn INDEX flights-current_line.

    ENDMODULE.

     

    regards

    kk.

Actions