ABAP Keyword Documentation → ABAP − Reference → SAP GUI User Dialogs → General Dynpros → ABAP Statements for Dynpros → CONTROLS
CONTROLS - TYPE TABLEVIEW
Other versions: 7.31 | 7.40 | 7.54
Syntax
CONTROLS contrl TYPE TABLEVIEW USING SCREEN dynnr.
Effect
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 group CXTAB. In
dynpro processing, the components
of the structure contain the attributes of the table control. Using this structure you can read and edit the attributes of the relevant table control.
At the top level, the deep structure CXTAB_CONTROL contains components for the general attributes of the table control. The component COLS is an internal table of the structure CXTAB_COLUMN and contains the attributes of individual columns. The structure CXTAB_COLUMN contains a structured component SCREEN of the type SCREEN. This component contains the attributes of the screen element of each column. With the exception of 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
Component | Meaning |
---|---|
FIXED_COLS | Number of lead columns. The start value is taken from the definition of the table control in the dynpro dynnr . |
LINES | Controls 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 startvalue of LINES is 0 and must be set in the program so that the scroll bar can be used. With referenceto an internal table, LINES is set to the current number of rows in the internal table if the tablecontrol is being processed for the first time. However, since this time is not defined, the value of LINES should also be explicitly set to the number of rows of the internal table before thePBO processing in this case. |
TOP_LINE | Top displayed row for next PBO. Set at time ofPAI by the position of the vertical slider box. |
CURRENT_LINE | Current row 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_COL | Number of first horizontally scrollable column displayed after the lead columns. Is set at time ofPAI by the position of the horizontal slider box. |
LINE_SEL_MODE | Row selection mode: "0" if no rows can be selected , "1" if one row, "2" if multiple rows. The start value is taken from the definition of the table control in the dynpro dynnr . |
COL_SEL_MODE | Column 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_SELECTOR | Flag ("X" or " ") whether there is a selection column. The start value is taken from the definition of the table control in the dynpro dynnr . |
H_GRID | Flag ("X" or " ") whether there are horizontal separators. The start value is taken from the definition of the table control in the dynpro dynnr . |
V_GRID | Flag ("X" or " ") whether there are vertical separators. The start value is taken from the definition of the table control in the dynpro dynnr . |
COLS | Control table for individual columns of the structure CXTAB_COLUMN. |
INVISIBLE | Flag ("X" or " ") indicating whether the table control is visible in the GUI window. |
The Structure CXTAB_COLUMN
Component | Meaning |
---|---|
SCREEN | Structure for the attributes of the screen element of the current column. The components can beset for the values described there either directly or using MODIFY SCREEN . MODIFY SCREEN overwrites a direct assignment. |
INDEX | Current 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 ofPAI. |
SELECTED | Flag ("X" or " ") whether or not column is selected. Is set to current value at time of PAI. |
VISLENGTH | Visible length of the column. Start value is taken from the definition of the table control in dynpro dynnr . |
INVISIBLE | Flag ("X" or " ") whether or not the column is visible in the table control. |
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 row 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 row before the time of 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 rows scrolled can be taken from the system field
sy-loopc
in loop executions.sy-loopc
contains the number of currently displayed rows and the component LINES of the structure CXTAB_CONTROL contains the number of lines in the full table control.
Example
If a table control is defined on the dynpro with the number 100 and the rows of this table control are
defined with reference to the database table SPFLI in 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
rows of spfli_tab
is assigned to the component lines
of the structure flight_tab
created using CONTROLS
;
this is done to activate the scroll bar of the table control. In a PAI module modify_tab
, the row 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 row of the table control. The corresponding dynpro flow logic can be seen in the example for LOOP
.
CONTROLS flight_tab TYPE TABLEVIEW USING SCREEN '0100'.
TABLES spfli.
DATA spfli_tab TYPE SORTED TABLE OF spfli
WITH UNIQUE KEY carrid connid.
...
MODULE prepare_tab OUTPUT.
IF spfli_tab IS INITIAL.
SELECT *
FROM spfli
INTO TABLE @spfli_tab.
flight_tab-lines = lines( spfli_tab ).
ENDIF.
ENDMODULE.
MODULE modify_tab INPUT.
MODIFY TABLE spfli_tab FROM spfli.
ENDMODULE.