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: 

Table control index

0 Kudos

Hi,

I have a table control. How to get the index of the row selected in the table control?

Please help. Very urgent

Thanks

1 ACCEPTED SOLUTION

venkat_o
Active Contributor
0 Kudos

Hi Kushaal Choudri, Procedure for Table control line selection and modifying master table using those values. 1). U should take one variable in your internal table or in structure which is used for table control fields ex :

data :begin of itab occurs 0 ,
mark type c ,
matnr like mara-matnr ,
matkl like mara-matkl,
maktx like makt-maktx,
end of itab .
Controls: TABC types TABLEVIEW using screen 100.
2). This mark variable should be given in Table control properties. follow the path double click on the table control-->attributes .->select w/SelColumn and in that itab-mark. Check in the figure. [http://bp2.blogger.com/_O5f8iAlgdNQ/R99gOUH8CXI/AAAAAAAAA9I/d3gOum1fJ6s/s1600-h/pic28145-796618.jpg|http://bp2.blogger.com/_O5f8iAlgdNQ/R99gOUH8CXI/AAAAAAAAA9I/d3gOum1fJ6s/s1600-h/pic28145-796618.jpg] 3). After that. Take this example.
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
LOOP AT ITAB WITH CONTROL tabc
ENDLOOP.
PROCESS AFTER INPUT.
MODULE CANCEL AT EXIT-COMMAND.
LOOP AT ITAB.
Module read_table_control.
ENDLOOP.
module user_command_0100. ============================== In this Module read_table_control, You should write the following code MODULE read_table_control INPUT. MODIFY itab INDEX tabc-current_line."( This will update the ITAB table MARK field with 'X ' whatever we have selected on table control.) ENDMODULE. 4) If you want to Delete some of the records from Table control follow this code u2026Create one pushbutton and give Fucnction code to that and write below code
WHEN 'DELETE'.
LOOP AT itab WHERE mark = 'X'.
DELETE itab.
ENDLOOP.
ENDCASE.
I hope that it helps u . Regards, Venkat.O

3 REPLIES 3

Former Member
0 Kudos

if you only want to determine the row of the table control. SY´-SUBRC allows you to check if the cursor is placed in a row of a table control.

Cursor Position on Table Controls

At PBO you can set the cursor on a specific field of a specific row of a table control.

SET CURSOR FIELD .

thanks

Plz Reward points if useful

Richa

Edited by: Richa Khosla on May 28, 2008 7:06 AM

venkat_o
Active Contributor
0 Kudos

Hi Kushaal Choudri, Procedure for Table control line selection and modifying master table using those values. 1). U should take one variable in your internal table or in structure which is used for table control fields ex :

data :begin of itab occurs 0 ,
mark type c ,
matnr like mara-matnr ,
matkl like mara-matkl,
maktx like makt-maktx,
end of itab .
Controls: TABC types TABLEVIEW using screen 100.
2). This mark variable should be given in Table control properties. follow the path double click on the table control-->attributes .->select w/SelColumn and in that itab-mark. Check in the figure. [http://bp2.blogger.com/_O5f8iAlgdNQ/R99gOUH8CXI/AAAAAAAAA9I/d3gOum1fJ6s/s1600-h/pic28145-796618.jpg|http://bp2.blogger.com/_O5f8iAlgdNQ/R99gOUH8CXI/AAAAAAAAA9I/d3gOum1fJ6s/s1600-h/pic28145-796618.jpg] 3). After that. Take this example.
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
LOOP AT ITAB WITH CONTROL tabc
ENDLOOP.
PROCESS AFTER INPUT.
MODULE CANCEL AT EXIT-COMMAND.
LOOP AT ITAB.
Module read_table_control.
ENDLOOP.
module user_command_0100. ============================== In this Module read_table_control, You should write the following code MODULE read_table_control INPUT. MODIFY itab INDEX tabc-current_line."( This will update the ITAB table MARK field with 'X ' whatever we have selected on table control.) ENDMODULE. 4) If you want to Delete some of the records from Table control follow this code u2026Create one pushbutton and give Fucnction code to that and write below code
WHEN 'DELETE'.
LOOP AT itab WHERE mark = 'X'.
DELETE itab.
ENDLOOP.
ENDCASE.
I hope that it helps u . Regards, Venkat.O

Former Member
0 Kudos

Hi,

The fields of the control table are taken from an internal table.....

that internal table should have a field as MARK type c.

Whenever user clicks on any row in the control table this field becomes contains 'X'.

So by using this you can do the functionality u need.

Reward if helpful.

Regards,

Syed