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 delete and add rows in a table control

Former Member
0 Kudos

Hi

how to delete rows and add new rows in a tbale control

Sathya

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi,

Check these threads out

add rows

delete rows

Regards,

Santosh

Message was edited by: Santosh Kumar P

8 REPLIES 8

former_member223537
Active Contributor
0 Kudos

Hi,

In the PAI write this code

PROCESS AFTER INPUT.

LOOP AT itab.

ENDLOOP.

MODULE MODIFY_TC.

MODULE MODIFY_TC.

  • To add a row

DESCRIBE TABLE itab LINES tc_tab-lines.

tc_tab-lines = tc_tab-lines + 1.

  • To delete a row if check box is ticked

DELETE itab WHERE check = c_x.

  • To delete a row depending on tabix

DELETE itab index l_tabix.

ENDMODULE.

Make sure that you put a if condition in the above module inorder to ensure addition or deletion of a row.

Best regards,

Prashant

Former Member
0 Kudos

Hi

You have to delete/add records in the internal table listed by table control.

It usually use a MARK field to select the rows to be deleted:

CASE OK_CODE.

WHEN 'DELE'.

LOOP AT ITAB WHERE MARK = 'X'.

DELETE ITAB.

ENDLOOP.

To add new records you need only to append new records:

WHEN 'NEW'.

APPEND INITIAL LINE TO ITAB.

Max

Former Member
0 Kudos

hi,

Check these threads out

add rows

delete rows

Regards,

Santosh

Message was edited by: Santosh Kumar P

0 Kudos

refer program..

<b>RSDEMO_TABLE_CONTROL</b>

baskaran00
Active Participant
0 Kudos

Hi,

To delete and add rows in the table control, first set the selection mode property and give a name to it (Say "SEL").

Either u can select the rows in the table control and press the push button.

Then in PAI write the module.

CONTROLS TC1 TYPE TABLEVIEW USING SCREEN 9001.

MODULE DeleteADDRecord INPUT.

if SEL = 'X' AND sy-ucomm = 'DELETE'.

delete it_purchase index tc1-Current_line.

elseif SEL = 'X' AND sy-ucomm = 'ADD'.

it_purchase-itemno = tc1-Current_line + 1.

insert it_purchase index tc1-Current_line.

endif.

ENDMODULE. " DeleteRecord INPUT

Try with the above code.

former_member635387
Discoverer
0 Kudos

First we have to Describe internal table line of that table control.

code :

DESCRIBE TABLE lt lines v_line.
display-lines = v_line.

then take one push button in layout.

and write code inside process after input.

CASE SY-UCOMM.
WHEN 'NEW'.
APPEND INITIAL LINE TO LT.
ENDCASE.

this thread is over 13 years old. What prompted you to answer it? Maybe there is a bug in the activity stream, or did you search for it?