04-25-2007 8:48 AM
hi all
how can we delete a line from the table control .
situation is.
created table control in se51 which will display the data of a table.
how could i select a line from the table control ?
how could i delete the selected lines form the table.
thanks in advance
04-25-2007 8:51 AM
04-25-2007 8:51 AM
Hi
In the attributes of Table control (below) along with Vertical and Horizontal scrollbasr
Single line and Multiline Selections checkboxes will be there, check them
'and define a variable V_CHK for Line selection in the attributes.
and in the PAI (in LOOP...ENDLOOP)
write the logic for selected records
loop at Itab where V_CHK = 'X'.
endllop.
or Delete ITAB where V_CHK = 'X'.
reward points
regards,
Anji
04-25-2007 9:02 AM
i have to delete a database table
and i have created the table contol with the same structure as
of that table .
Is there is any way to detect the selected line and get the content in the line?
04-25-2007 9:10 AM
'flag' is of type char(1) available in the Internal table which was assigned to the select option in the table control.
1)If it is a database table use the below statement
Delete table Dic_Table index x.
2) for 'flag' u can use any table field with data type char(1), generally there will be fields available with name 'Mark' etc., u can use that
3) x is a variable of type i.
05-07-2007 11:21 AM
Hi,
U have to <b>award points for useful answers</b> and u have to mention it as solved if ur question is solved. Dont forget.
Regards,
Sudheer
04-25-2007 8:59 AM
Change the Table Control attributes such that user can only select a single record(row).
<u>Tip to delete a selected record</u>
1) write a module 'Mark' in the PAI as below
PROCESS AFTER INPUT.
MODULE cancel AT EXIT-COMMAND.
LOOP WITH CONTROL table_view.
MODULE read_table_control.
FIELD flag MODULE mark ON INPUT.
ENDLOOP.
MODULE user_command_0100.
2) Module Mark is below.
MODULE mark INPUT.
CHECK flag = 'X'.
x = table_view-top_line + sy-stepl - 1.
Delete itab INDEX x.
ENDMODULE. " mark INPUT
Table_view is the TableControl Name.
'flag' is of type char(1) available in the Internal table which was assigned to the select option in the table control.
<u>award if uesful</u>
Regards,
Sudheer
04-25-2007 9:01 AM
Hi,
Check this link.In this I am explaining the process step by step.Kindly reward points by clikcing the star on th eleft of reply,if it helps.
Message was edited by:
Jayanthi Jayaraman