‎2008 May 28 5:14 AM
Hi,
I have a table control. How to get the index of the row selected in the table control?
Please help. Very urgent
Thanks
‎2008 May 28 6:48 AM
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 .
2).
This mark variable should be given in Table control properties.
follow the path
double click on the table control--Controls: TABC types TABLEVIEW using screen 100.>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.
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
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.
I hope that it helps u .
Regards,
Venkat.O
WHEN 'DELETE'.
LOOP AT itab WHERE mark = 'X'.
DELETE itab.
ENDLOOP.
ENDCASE.
‎2008 May 28 6:06 AM
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
‎2008 May 28 6:48 AM
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 .
2).
This mark variable should be given in Table control properties.
follow the path
double click on the table control--Controls: TABC types TABLEVIEW using screen 100.>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.
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
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.
I hope that it helps u .
Regards,
Venkat.O
WHEN 'DELETE'.
LOOP AT itab WHERE mark = 'X'.
DELETE itab.
ENDLOOP.
ENDCASE.
‎2008 May 28 7:33 AM
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