‎2008 Aug 15 8:42 PM
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?
‎2008 Aug 16 12:58 PM
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.
‎2008 Aug 15 8:53 PM
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
‎2008 Aug 15 9:29 PM
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
‎2008 Aug 15 9:36 PM
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
‎2008 Aug 16 12:58 PM
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.
‎2008 Aug 16 1:01 PM
write above code in process before output..
and in case sy-ucomm.