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: 

Line selected in a table control

Former Member
0 Kudos

Hi,

I'm using the command GET CURSOR LINE line to get the line I selected in a table control. The number of visible rows is 4. This command gets me the correct row I selected only upto the 4th line but after that, for the 5th row, the row selected is returned as '4'.

How can I get the correct row that I've selected on the table control?

Please advise.

Thanks.

3 REPLIES 3

naimesh_patel
Active Contributor
0 Kudos

You should use the std mechanism of selecting the line in table control.

1. You need to have one character field for the selection in your internal table

2. Assign this field in your table control property:

Check the checkbox "w/SelColumn" and give this character field name in the adjacent field

Save and activate.

Now, when you select the row, the corresponding "Character" field will have the value "X".

Regards,

Naimesh Patel

0 Kudos

GET CURSOR only works on the number of table control lines that can be displayed on screen at any one time. So, if your screen can display only 4 lines, all you'll ever get from GET CURSOR is a number 1 to 4.

But your screen also knows which of your table control records is currently displayed as the top line of your table control. This information is held in field TC_ITEMS-TOP_LINE (where TC_ITEMS is the name of your table control). By combining these two bits of information, you can find the correct line number of your selected record.

For example in the case you describe where you are clicking on line 5 but GET CURSOR thinks it is line 4 because your screen has moved down a record, I would think that TC_ITEMS-TOP_LINE would be 2. Add 4 and 2 together, subtract 1 and you'll get your correct line number.

0 Kudos

Hi Christine,

Thanks very much for the reply. It did work for me. I found the solution at this site that was posted by Franklin Mendez on April 15th, 2008

clear lv_line.

GET CURSOR LINE lv_line.

lv_line = lv_line + tc_prod_rl_ind-top_line - 1.

<REMOVED BY MODERATOR>

Regards,

Tessy

Edited by: Alvaro Tejada Galindo on Apr 28, 2008 12:39 PM