‎2008 Oct 05 7:18 AM
Hi
I want to get the field value of table control in modulepool. I have used get cursor field field value val, but it didn't give the correct fieldname and no value
If I use get cursor line line statement it gives the line no of displayed rows only, after scrolling the value will not give correct. How to resolve this
Thanks in Advance
Venkateswararao
‎2008 Oct 05 8:21 AM
Hi Venkateswara Rao,
If a column selected in a table control, then we can find it out using its properties. For this,
ZTC-COLS[n]-SELECTED
If this field is set, then that column is selected.
Anyway, just place the cursor in any column, check out this property.
Regarding LINE value, always it will return the position in VISIBLE ORDER.
So just add ZTC-TOP_LINE with that LINE value and reduce one. Now you can get the absolute INDEX of the record in your internal table.
-
The 'GET CURSOR' statement does not give absolute COLUMN NAME. Instead it will give the SCREEN FIELD NAME. i.e. workarea hyphen field name. Then we have to extract column name alone with the specification of OFFSET because the workarea and hyphen will have a constant length.
DATA : W_FNAM TYPE CHAR61, " Screen Field Name
W_CNAM TYPE CHAR30, " Column name
W_LINE TYPE I. " Visible Record Number
GET CURSOR FIELD W_FNAM LINE W_LINE.
W_LINE = W_LINE + ZTC-TOP_LINE - 1. " Actual Record Number
W_CNAM = W_FNAM+12. " Column NameHere, W_FNAM conatains the value as 'WA_TC_TSTCT-SNO'. W_CNAM will have the column name as 'SNO'. The offset is 12, because the workarea 'WA_TC_TSTCT' and Hyphen has a length of 12.
-
Regards,
R.Nagarajan.
-
We can -
Edited by: Nagarajan Ramamoorthy on Oct 6, 2008 9:55 AM
‎2008 Oct 05 9:38 AM
use the LINE lin addition incase of table control
GET CURSOR ... LINE lin
for more details read the F1 help.
‎2008 Oct 06 10:54 AM
After
Get cursor line line.
Use this code.
IF TC-TOP_LINE > 1.
LINE = LINE + ( TC-TOP_LINE - 1 ).
ENDIF.
It will give you correct Line no after Scroll
use it It will definitely Work
Regards,
Alpesh