Skip to Content
avatar image
Former Member

How to add or delete rows in tablecontrol?

Hi,

I am using a tablecontrol to enter data records.

I want to use 2 buttons, one to insert a row into a tablecontrol and another to delete a selected row of a tablecontrol.

How do I insert or delete rows of a tablecontrol?

Thanks.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Sep 04, 2008 at 01:29 PM

    place 2 radio buttons...

    Now when you use Insert push button create an empty entry in your TC and enter values and save it by modifying the internal table...

    check entry and delete the row and in TC delete it from internal table.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      You will have to insert or delete the row into the internal table that is linked to your table control. So on click of the "insert" button you can call a MODULE that will update the internal table from table control. In PBO as it is you must have written loop statment to link internal table to table control.

      And as mentioned above. You can always keep a blank record at the end of your internal table. So in your linked table control that will come as a blank line.

      Similarly for delete update the internal table on click of "Delete" button. I am not sure how is the selection captured in table control though.

  • avatar image
    Former Member
    Sep 04, 2008 at 07:49 PM

    Hi Kumar,

    Please look at the below sections......

    ADDING BLANK LINES

    To add blank lines to table control we do not need to change any of the fields of the structure CXTAB_CONTROL simply adding blank lines to the internal table will do.

    INSERT INITIAL LINE INTO itab.

    DELETING SELECTED ROWS

    Deletion of selected rows is simple. To delete selected rows first we will determine the rows which have been selected through selection column .

    FOR SINGLE ROW SELECTION

    IF mark EQ 'X' . "mark is the name of selection column field

    DELETE itab FROM workarea .

    ENDIF.

    FOR MULTIPLE ROW SELECTION

    *To deetermine the rows selected we will use the selection column field to loop

    *through the internal table.

    LOOP AT itab WHERE mark EQ 'X'. "mark is the name of selection column field

    DELETE itab " and is part of the internal table .

    ENDLOOP.

    Thanks,

    Ravi Kanth

    Add comment
    10|10000 characters needed characters exceeded