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

Former Member
0 Likes
723

Hi all,

how to create the vertical scroll bar in the table control.....i want steps or a sample example of it...plzz

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
690

You have to write a PAI module and a PF status which has 4 function codes for example ..'PGDO', 'PGUP', 'PGLA', 'PGFI' ...

*----


MODULE scroll INPUT.

XCODE = OK_CODE.

CASE xcode.

WHEN 'PGDO'. "one page down

offset = tabcontrl-lines - step_lines.

IF tabcontrl-top_line LT offset.

tabcontrl-top_line = tabcontrl-top_line + step_lines.

ENDIF.

WHEN 'PGUP'. "one page up

offset = step_lines.

IF tabcontrl-top_line GT offset.

tabcontrl-top_line = tabcontrl-top_line - step_lines.

ELSE.

tabcontrl-top_line = 1.

ENDIF.

WHEN 'PGLA'. " last page

tabcontrl-top_line = tabcontrl-lines - step_lines + 1.

WHEN 'PGFI'. " first page

tabcontrl-top_line = 1.

ENDCASE.

ENDMODULE. " SCROLL INPUT

*--


in TOP include--


CONTROLS: tabcontrl TYPE TABLEVIEW

USING SCREEN '9000'.

*----


where step_lines is

step_lines = sy-loopc. " lines visible in the table

You have to write MODULE SCROLL in PAI anywhere. It should be a PAI module that's all. For assigning sy-loopc to step_lines ( an integer type), you write it in PBO module that too:

*----


LOOP AT itab1 WITH CONTROL tabcontrl CURSOR TABCONTRL-CURRENT_LINE.

MODULE ITAB_TO_SCREEN.

MODULE lines .

ENDLOOP.

*----


This 'MODULE lines' is a PBO module in which u can assign step_lines = sy-loopc.

Reward points if found helpfull..

7 REPLIES 7
Read only

Former Member
0 Likes
690

write the following code in PBO

MODULE SET_LINES OUTPUT.

DATA VLINES TYPE I.

DESCRIBE TABLE ITABCTL LINES VLINES.

TABCTL-LINES = VLINES + 1.

ENDMODULE. " set_lines OUTPUT

here ITABCTL is the internal table being displayed on Table control TABCTL.

Read only

Former Member
0 Likes
691

You have to write a PAI module and a PF status which has 4 function codes for example ..'PGDO', 'PGUP', 'PGLA', 'PGFI' ...

*----


MODULE scroll INPUT.

XCODE = OK_CODE.

CASE xcode.

WHEN 'PGDO'. "one page down

offset = tabcontrl-lines - step_lines.

IF tabcontrl-top_line LT offset.

tabcontrl-top_line = tabcontrl-top_line + step_lines.

ENDIF.

WHEN 'PGUP'. "one page up

offset = step_lines.

IF tabcontrl-top_line GT offset.

tabcontrl-top_line = tabcontrl-top_line - step_lines.

ELSE.

tabcontrl-top_line = 1.

ENDIF.

WHEN 'PGLA'. " last page

tabcontrl-top_line = tabcontrl-lines - step_lines + 1.

WHEN 'PGFI'. " first page

tabcontrl-top_line = 1.

ENDCASE.

ENDMODULE. " SCROLL INPUT

*--


in TOP include--


CONTROLS: tabcontrl TYPE TABLEVIEW

USING SCREEN '9000'.

*----


where step_lines is

step_lines = sy-loopc. " lines visible in the table

You have to write MODULE SCROLL in PAI anywhere. It should be a PAI module that's all. For assigning sy-loopc to step_lines ( an integer type), you write it in PBO module that too:

*----


LOOP AT itab1 WITH CONTROL tabcontrl CURSOR TABCONTRL-CURRENT_LINE.

MODULE ITAB_TO_SCREEN.

MODULE lines .

ENDLOOP.

*----


This 'MODULE lines' is a PBO module in which u can assign step_lines = sy-loopc.

Reward points if found helpfull..

Read only

Former Member
0 Likes
690

Hi,

in order to get the vertical scroll bar you just need to write the code below in your PBO of the screen.

data : N type I.

<itab is the internal table being passed to the table control>

<tabctrl> is the name of the table control being created on your screen.

describe table itab lines N.

<tabctrl>-lines = N.

This will dynamically change the number of lines of the table control. If you hardcode it only that many number of lines will be displayed in the table control.

Regards,

Satish

Read only

Former Member
0 Likes
690

Hi,

use like:

tabcntrl-lines = sy-tfill + 1.

Regards,

Renjith Michael.

Read only

Former Member
0 Likes
690

Hi Frns

As we know Table control comes by default with a vertical scroll bar, so we need to juss enable it , to do this , juss add a simple statement in PBO's Module - Endmodule

CONTROL-LINES = SY-DBCNT.

Hope this would solve your query, if helpful & really useful reward points.

Thanks & Regards

RK Nimma

Read only

Former Member
0 Likes
690

in the trans se83 you get the example progs for this ..... checkout

Santhosh

Read only

0 Likes
690

thanks