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: 

Table control current line on scrolling

Former Member
0 Kudos
976

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

former_member210266
Active Participant
0 Kudos
571

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

5 REPLIES 5

Former Member
0 Kudos
571

Hi Prachi,

     Below thread may be of some help for you.

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

~Athreya

0 Kudos
571

Hi Athreya,

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

former_member210266
Active Participant
0 Kudos
572

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

0 Kudos
571

Thanks swati. Problem solved.

dhanikpi
Discoverer
0 Kudos
571

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.