2015 Jan 02 7:23 AM
Hello guys, I have a problem I can get the curren row select by double click in my Control Table with code below:
WHEN 'DBCLICK'.
clear: OK_CODE200.
data: ws_field type string,
ws_line type string.
GET CURSOR FIELD ws_field LINE ws_line.
IF ws_field(7) EQ 'WA_ALV2'.
clear wa_alv2.
READ TABLE IT_ALV2 INTO WA_ALV2 INDEX ws_line
If the user, click on the any row when the control table is showing all "first rows" is correct, for example in image below, user click on the first line:
I get the correct current line selected
But, when I move the scroll to down, the numerical order is modified, for example, in the image below you can see only 3 rows, this is because I moved the scroll to down, and now I only can see 3 records, but the others records are above:
If I click on the first record displayed, my ws_line variable will have the value "1"
this is not correct, is correct only because the control table its showing only 3 records, but the other records are above, this is my problem, because when the user click on this row, my variable ws_line get the number row select, for example "1" with this number I go to my internal table for example:
READ TABLE IT_ALV2 INTO WA_ALV2 INDEX ws_line
But with this, I will get the first row of the internal table, but in my internal table I have all record not only 3 like image above:
Any one can help me?
2015 Jan 03 7:02 AM
Hii Luis
Below is sample code i used
data : ind type i.
data : t_line type i.
clear ind.
t_line = zcntrl-top_line - 1.
clear w_split.
clear index.
clear sy-ucomm.
get cursor line wa_line.
wa_line = wa_line + t_line.
index = wa_line + 1.
Hello guys, I have a problem I can get the curren row select by double click in my Control Table with code below:
WHEN 'DBCLICK'.
clear: OK_CODE200.
data: ws_field type string,
ws_line type string.
GET CURSOR FIELD ws_field LINE ws_line.
IF ws_field(7) EQ 'WA_ALV2'.
clear wa_alv2.
READ TABLE IT_ALV2 INTO WA_ALV2 INDEX ws_line
If the user, click on the any row when the control table is showing all "first rows" is correct, for example in image below, user click on the first line:
I get the correct current line selected
But, when I move the scroll to down, the numerical order is modified, for example, in the image below you can see only 3 rows, this is because I moved the scroll to down, and now I only can see 3 records, but the others records are above:
If I click on the first record displayed, my ws_line variable will have the value "1"
this is not correct, is correct only because the control table its showing only 3 records, but the other records are above, this is my problem, because when the user click on this row, my variable ws_line get the number row select, for example "1" with this number I go to my internal table for example:
READ TABLE IT_ALV2 INTO WA_ALV2 INDEX ws_line
But with this, I will get the first row of the internal table, but in my internal table I have all record not only 3 like image above:
Any one can help me?
2015 Jan 02 7:44 AM
Hi Roberto,
i guess you are doing scroll down by using mouse right, instead of doing like use page down for scrolling controll table then you will get expected result.
Thanks,
Sree
2015 Jan 02 4:33 PM
Could you please give me more information? I can't understand what's "Page fown for scrolling"
2015 Jan 03 7:01 AM
Hii Luis
Try to get top line of you table control (table control name-top_line) and then try to find out your line index.
Regards
Gaurav
2015 Jan 03 7:02 AM
Hii Luis
Below is sample code i used
data : ind type i.
data : t_line type i.
clear ind.
t_line = zcntrl-top_line - 1.
clear w_split.
clear index.
clear sy-ucomm.
get cursor line wa_line.
wa_line = wa_line + t_line.
index = wa_line + 1.
2015 Jan 04 1:38 AM
Hello Gaurav, I have a question refer to your code, in this line: t_line = zcntrl-top_line - 1. "zcntrl" is my control table name? I wirte this code on my MODULE user_command_0200. but I have the error below:
My control table name is: tbc2. but as you can see I get an error where SAP says tbc2-TOP_LINE does not exist.
Could you please tell me if the place where I did write my code is correct?
2015 Jan 04 5:01 AM
Hi Luis,
How did you define your table control?
CONTROLS: tbc2 TYPE TABLEVIEW USING SCREEN 1000.
2015 Jan 04 5:36 AM
2015 Jan 04 6:01 AM
Hi Luis,
In your screenshot you can see line,
tbc2-current line.
If you are able to access that you should be able to access top_line as well.
You can double click on tbc2, it will take you to the declaration of table control.
2015 Jan 04 6:22 AM
2015 Jan 05 2:59 AM
I solved my problem, I moved CONTROLS: TBC2 TYPE TABLEVIEW USING SCREEN 0200. to my Top Inclide.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |