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: 

How to add or delete rows in tablecontrol?

Former Member
0 Kudos

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.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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.

4 REPLIES 4

Former Member
0 Kudos

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.

0 Kudos

Hi Ramesh,

my question actually is how to insert an empty row in a TC and how to delete a selected from a TC.

0 Kudos

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.

Former Member
0 Kudos

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