SAP CONTROLS TABLEVIEW ABAP Statements



Get Example source ABAP code based on a different SAP table
  


• TYPE TABLEVIEW CONTROLS
• USING SCREEN CONTROLS

CONTROLS, TYPE TABLEVIEW
Short Reference

ABAP_SYNTAX
CONTROLS contrl TYPE TABLEVIEW USING SCREEN dynnr.

What does it do?
Declares a table control . If the type TABLEVIEW is specified in the statement CONTROLS, a deep structure is created with the name of the control and the type cxtab_control of the type pool CXTAB. In dynpro processing, the components of the structure contain the properties of the table control. Using this structure, the properties of the relevant table control can be changed and read.
At the top level, the deep structure cxtab_control contains components for the general properties of the table control. The component cols is an internal table of the structure cxtab_column and contains the properties of individual columns. The structure cxtab_column contains a structured component SCREEN of the type SCREEN. This component contains the properties of the screen element of each column. Apart from the component current_line, all components of the structure cxtab_control can be set in the ABAP program.
dynnr expects the number of a dynpro on which a table control with the name contrl is defined. A literal or a constant of the type n with length 4 can be specified for dynnr. When a dynpro in which a table control called contrl is defined is called for the first time, the start values of certain components of the structure are taken from the definition of the table control whose dynpro is specified after USING.
The Structure <(>cxtab_control<)> ComponentMeaning
fixed_colsNumber of lead columns. The start value is taken from the definition of the table control in the dynpro dynnr.
LINESControls the vertical scroll bar of the table control. If the LOOP is executed in the dynpro flow logic without reference to an internal table, that start value of LINES is 0 and must be set in the program so that the scroll bar can be used. With reference to an internal table, LINES is set to the current number of lines in the internal table if the table control is being processed for the first time. However, since this event is not defined, the value of LINES should also be explicitly set to the number of lines of the internal table before the PBO processing in this case.
top_lineTop displayed line for next PBO. Set at time of PAI by the position of the vertical slider box.
current_lineCurrent line during a LOOP in the dynpro flow logic. If the addition FROM of the statement LOOP is not specified, the value of current_line corresponds to the result of sy-stepl + (top_line - 1).
left_colNumber of first horizontally scrollable column displayed after the lead columns. Is set at time of PAI by the position of the horizontal slider box.
line_sel_modeLine selection mode: 0 if no lines can be selected, 1 if one line, 2 if multiple lines. The start value is taken from the definition of the table control in the dynpro dynnr .
lcol_sel_modeColumn selection mode: 0 if no columns can be selected, 1 if one column, 2 if multiple columns. The start value is taken from the definition of the table control in the dynpro dynnr .
line_selectorFlag ( X or blank) indicating whether there is a selection column. The start value is taken from the definition of the table control in the dynpro dynnr.
h_gridFlag ( X or blank) indicating whether there are horizontal separators. The start value is taken from the definition of the table control in the dynpro dynnr.
v_gridFlag ( X or blank) indicating whether there are vertical separators. The start value is taken from the definition of the table control in the dynpro dynnr.
colsControl table for individual columns of the structure cxtab_column.
invisibleFlag ( X or blank) indicating whether the table control is visible in the GUI window.
The Structure <(>cxtab_column<)> ComponentMeaning
screenStructure for the properties of the screen element of the current column. The components can be set for the values described there either directly or using MODIFY SCREEN. MODIFY SCREEN overwrites a direct assignment.
indexCurrent position of the column in the table control. The start value is taken from the definition of the table control in the dynpro dynnr. Is set to current value at time of PAI.
selectedFlag ( X or blank) indicating whether the column is selected. Is set to current value at time of PAI.
vislengthVisible length of the column. Start value is taken from the definition of the table control in dynpro dynnr.
invisibleFlag ( X or blank) indicating whether the column is visible in the table control.



Latest notes:

In a table control, it is possible to scroll vertically using a scroll bar if the component LINES of the structure cxtab_control was set to the correct line number before the PBO processing of the table control. Every time the scroll bar is scrolled, the event PAI is raised with an empty function code and the component top_line of the structure cxtab_control is automatically set to the new top line before PBO.
For program-driven scrolling, it is sufficient to assign a value to the component top_line of the structure cxtab_control during PBO processing. When scrolling by page, the number of lines scrolled can be taken from the system field sy-loopc in loop executions. sy-loopc contains the number of currently displayed lines and the component LINES of the structure cxtab_control contains the number of lines in the entire table control.
ABAP_HINT_END



Example ABAP Coding

If a table control is defined on the dynpro with the number 100 and the lines of this table control are defined with reference to the DDIC database table SPFLI in the ABAP Dictionary, the corresponding programming of the ABAP program can be as follows. In a PBO module prepare_tab, an internal table spfli_tab is filled with data from the database table. The number of lines of spfli_tab is assigned to the component lines of the structure flight_tab created using CONTROLS to activate the scroll bar of the table control. In a PAI module modify_tab, the line of the internal table is modified whose primary table key matches that of the interface work area spfli defined using TABLES. The PAI module modify_tab is called for every displayed line of the table control. The corresponding dynpro flow logic can be seen in the example for LOOP .
ABEXA 00146
ABAP_EXAMPLE_END

Return to menu