Application Development and Automation 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: 
Read only

Table Control in Modulepool

Former Member
0 Likes
570

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

3 REPLIES 3
Read only

Former Member
0 Likes
458

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 Name

Here, 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

Read only

Former Member
0 Likes
458

use the LINE lin addition incase of table control

GET CURSOR ... LINE lin

for more details read the F1 help.

Read only

Former Member
0 Likes
458

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