Application Development 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: 

Scroll bars on table controls.

Former Member
0 Kudos

Hi,

In module pool programming, I have a screen on which I have 3 table controls. The problem is how do I get vertical scroll bars for these table controls?

I am displaying ths screen in the web. In the web I observe that there are buttons for move up, move previous, move first and move last. I havent put these buttons, they seem to appear by default.

How do I add function codes (sy-ucomm or ok_code) for these buttons.

Thanks and Regards,

Mick

4 REPLIES 4

Former Member
0 Kudos

check the link..

Former Member
0 Kudos

Hii

Try using check boxes for horizontal and vertical scroll bars in the table control properties.

Displaying in the table control then in your PBO MODULE, you should use the following statement,

DESCRIBE TABLE itab LINES TC_LINES .

May be this link on ITS Sevice parameters will help you

http://help.sap.com/saphelp_webas630/helpdata/en/24/ef243a84da356be10000000a11402f/plain.htm

Regards

Naresh

Former Member
0 Kudos

Hi Mick,

LINES: Controls the scroll bar of the table control. At LOOP without internal table, LINES has the initial value zero and must be set in the program so that the scroll bar can be used. At LOOP AT <itab> the system sets this component to the number of rows of the internal table, whenever the table control is processed for the first time. The initialization event of a table control is not determined uniquely. If the corresponding internal table is not fully created at this event, then the LINES variable receives an incorrect value. If LINES in the LOOP loop is smaller as the number of rows of the internal table, then the table control contains blank rows at the end.

Therefore you should always set the LINES component explicitly in the ABAP program, including at LOOP AT <itab>. In this way you have full control over the dimensions of the vertical scroll bar and so can control the number of rows that are ready for input. Initialization should usually occur at PBO directly before the LOOP statement for the table control.

regards,

keerthi.

Former Member
0 Kudos

HI

GOOD

GO THROUGH THIS

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.

Example

Processing with an internal table

PROCESS BEFORE OUTPUT.

LOOP AT itab WITH CONTROL ctrl CURSOR ctrl-CURRENT_LINE.

ENDLOOP.

PROCESS AFTER INPUT.

LOOP AT itab WITH CONTROL ctrl.

MODULE ctrl_pai.

ENDLOOP.

Here, the system fills the output fields before displaying the screen by reading the internal table itab .

When the user has entered data, the module ctrl_pai INPUT must be executed to check the input and to refresh the contents of the internal table.

Vertical scrolling with the scroll bar is followed by the event PAI for the displayed page. Then, cntl-TOP_LINE is increased and PBO is processed for the next page.

Program-driven scrolling and the most of the functionality described above is achieved by manipulating the control attributes.

Attributes

The CONTROLS statement creates a complex data object of the type CXTAB_CONTROL with the name of the control.

You maintain the initial values in the Screen Painter and assign the screen with the initial values for a control using the addition USING SCREEN .

Initialization is achieved automatically in the "1st access to the control" (setting or reading values).

You can use the customizing button (in the top right corner) to save the current setting (column widths and column positions) and use it as the initial value for the next call.

All the initial values can be overwritten by the program using the MOVE ... TO TC attributes statement.

Example

ctrl-fixed_cols = 2. "2 columns fixed

The contents of the SCREEN structure (table Cols ) acts as a default value for each line of this column, but within LOOP ... ENDLOOP (flow logic), it can be overwritten by LOOP AT SCREEN / MODIFY SCREEN .

With the attributes listed below, you should be aware of the following:

LINES This must always be set as the only attribute if you are not using LOOP AT itab .

TOP_LINE Also set by the SAPgui through the vertical scroll bar slider.

CURRENT_LINE Read only, set by the system ( TOP_LINE + SY-STEPL - 1 )

LEFT_COL Also set by the SAPgui through the horizontal scroll bar slider.

COLS-INDEX Also set by the SAPgui after moving columns.

COLS-SELECTED Also set by the SAPgui after column selection.

When displaying the control, the system uses the current contents when the event DCO occurs (i.e. after all PBO modules have run). The modified values (brought about by the user making changes on the screen) are set immediately after DCI (i.e. before the first PAI module runs).

http://www.geocities.com/SiliconValley/Campus/6345/contro02.htm

THANKS

MRUTYUN