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: 

to delete/insert in itab

Former Member
0 Kudos

Hi,

How to delete or insert in itab (in table control) by marking a particular row?

At the same time the database should be updated with the operation done.

Thanks,

Mohan

3 REPLIES 3

former_member181995
Active Contributor
0 Kudos

Mohan,

same as you done in reports.

for more info just use F1 help on insert delete update command from se38.

you will come to know.

Amit.

Former Member
0 Kudos

check this program : DEMO_DYNPRO_TABCONT_LOOP_AT.

hope it will make you better understandable.

valter_oliveira
Active Contributor
0 Kudos

Hello.

First your table control must have a mark column. For that create in the structure of itab a field TYPE char1 (named MARK for example) and then in table control parameters, select it to the mark field.

Then, in the screen layout, create a button delete row and assign a function code to it (DEL for example).

After that, in PAI of that screen, USER-COMMAND module, make a statement like:


CASE ok_code.
...
  WHEN 'DEL'.
    perform del_row.
...
ENDCASE.

Create your form with something LIKE.


FORM del_row.
  LOOP AT itab INTO wa WHERE mark EQ 'X'.
    DELETE ztable WHERE field = wa-field.
  ENDLOOP.
  DELETE itab WHERE mark EQ 'X'.
ENDFORM.

Also, don't forget that to the mark fields became marked after a enter (for example), must be passed to itab in PAI too, like.


LOOP.
  FIELD: wa-mark MODULE mark ON REQUEST.
ENDLOOP.

Create your module with something LIKE.


MODULE mark INPUT.
  modify itab from wa TRANSPORTING mark.
ENDMODULE.

Regards.

Valter Oliveira.