CONTROLS - TYPE TABLEVIEW
CONTROLS contrl TYPE TABLEVIEW USING SCREEN dynnr.
Declares a table control. If the type
TABLEVIEW is specified in the statement
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. This structure can be used to read and edit the attributes of the associated 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
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
The Structure CXTAB_CONTROL
The Structure CXTAB_COLUMN
- 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 triggered with an empty function code and the component TOP_LINE of the structure CXTAB_CONTROL is automatically set to the new topmost 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. For page by page scrolling, the number of pages to be scrolled can be obtained from the system field
sy-loopcduring the loop processing.
sy-loopccontains the number of currently displayed rows, while the component LINES of the structure CXTAB_CONTROL contains the number of rows in the entire table control.
If a table control is defined on the dynpro with the number 100, whose rows are defined with reference
to the database table SPFLI in ABAP Dictionary, the corresponding programming of the ABAP program can
look as follows. In a PBO module
prepare_tab, an internal table
is filled with data from the database table. The number of rows of
is assigned to the component
lines of the structure
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
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.