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 can we delete a line from the table control .

Former Member
0 Kudos

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

7 REPLIES 7

Former Member
0 Kudos

You could try using the variable tablecontrol-current_line.

Former Member
0 Kudos

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

0 Kudos

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?

0 Kudos

'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.

0 Kudos

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

Former Member
0 Kudos

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

jayanthi_jayaraman
Active Contributor
0 Kudos

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.

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/table%20c...

Message was edited by:

Jayanthi Jayaraman