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 current line on scrolling

Former Member
0 Likes
1,909

Hi Experts,

I have made a Z Table Control where i have given vertical and horizontal scrolling . Now when I scroll and try to select a row, then ZTABLE_CONTROL-CURRENT_LINE fetches line number not from the top, it fetches from the current top of ztablecontrol.

It is onlyy changing the value on scrolling, if i do not scroll table control then value is coming correct.

My requirement is whenever i select any row of ZTABLE CONTROL i need to get the curent line number from top. Please guide me what should i do.

Early reply will be rewarded.

Thanks.

1 ACCEPTED SOLUTION
Read only

former_member210266
Active Participant
1,504

Hi Prachi

You can get the current line index by the simple calculation

ZTABLE_CONTROL-TOP_LINE + ZTABLE_CONTROL-CURRENT_LINE - 1

IF ZTABLE_CONTROL-TOP_LINE > 0.
   lw_index =
ZTABLE_CONTROL-TOP_LINE + ZTABLE_CONTROL-CURRENT_LINE - 1.
ENDIF.

Regards

Swati

Hi Experts,

I have made a Z Table Control where i have given vertical and horizontal scrolling . Now when I scroll and try to select a row, then ZTABLE_CONTROL-CURRENT_LINE fetches line number not from the top, it fetches from the current top of ztablecontrol.

It is onlyy changing the value on scrolling, if i do not scroll table control then value is coming correct.

My requirement is whenever i select any row of ZTABLE CONTROL i need to get the curent line number from top. Please guide me what should i do.

Early reply will be rewarded.

Thanks.

5 REPLIES 5
Read only

Former Member
0 Likes
1,504

Hi Prachi,

     Below thread may be of some help for you.

     http://scn.sap.com/thread/1678321

~Athreya

Read only

0 Likes
1,504

Hi Athreya,

Thanks for the reply. But the above thread did not solve my problem . Could you pls suggest something else.

Read only

former_member210266
Active Participant
1,505

Hi Prachi

You can get the current line index by the simple calculation

ZTABLE_CONTROL-TOP_LINE + ZTABLE_CONTROL-CURRENT_LINE - 1

IF ZTABLE_CONTROL-TOP_LINE > 0.
   lw_index =
ZTABLE_CONTROL-TOP_LINE + ZTABLE_CONTROL-CURRENT_LINE - 1.
ENDIF.

Regards

Swati

Read only

0 Likes
1,504

Thanks swati. Problem solved.

Read only

dhanikpi
Discoverer
0 Likes
1,504

Hi prachi,

first of all you need to name (like zmark) the option named mark  in table control just tick it.

also include it in your final table then you need to update zmark = 'x'.

at user command so that it pick the current line and code accordingly.