Application Development and Automation 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: 
Read only

table control adding lines deleting lines

Former Member
0 Likes
955

I have a table control, and I want push buttons to allow me to insert and delete rows from the table control, and delete them from the actual database table at the same time, how can this be done?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
620

for insert a line.

data n type i.

when 'insert'.

describe table itab lines n.

tabcon-lines = n + 1.

or

data n type i value 0.

when 'INSERT'.

loop at itab.

n = n + 1.

end loop.

tabcon-lines = n + 1.

foe delete.

loop at itab.

n = n + 1.

end loop.

tabcon-lines = n - 1.

5 REPLIES 5
Read only

Former Member
0 Likes
620

capture the row in the PAI , based on the action you perform operations. if Delete the delete record from Database or modify the database with new record..

check this demo programs

RSDEMO02

RSDEMO_TABLE_CONTROL

Edited by: Vijay Babu Dudla on Aug 15, 2008 4:00 PM

Read only

0 Likes
620

im not exactly understanding. I have the pushbuttons added in my table control, i just dont know how to write the code to make them functional

Read only

Former Member
0 Likes
620

HI,

in a table control you will be having either a check box or a button like stuff to select a particular record.

DELETE.

WHen you clik the particular record and after cliking the delete button , the code should recognise the checked record and delete the record from the data base.

INSERT

this also will work in the same fashion. Read the record which you have recently added and check for the primary key and then add a record to the DB table.

All you need is that you have to write in the PAI event if it is MOdule pool

and in the user command subroutine in ALV related programs.

As suggested by VIijay Babu you can also check those programs

Regards,

Venkatesh

Read only

Former Member
0 Likes
621

for insert a line.

data n type i.

when 'insert'.

describe table itab lines n.

tabcon-lines = n + 1.

or

data n type i value 0.

when 'INSERT'.

loop at itab.

n = n + 1.

end loop.

tabcon-lines = n + 1.

foe delete.

loop at itab.

n = n + 1.

end loop.

tabcon-lines = n - 1.

Read only

0 Likes
620

write above code in process before output..

and in case sy-ucomm.