ABAPCONTROLS_TABLEVIEW - CONTROLS TABLEVIEW

BAL_S_LOG - Application Log: Log header data   General Data in Customer Master  
This documentation is copyright by SAP AG.

CONTROLS - TYPE TABLEVIEW

Short Reference



Syntax

CONTROLS contrl TYPE TABLEVIEW USING SCREEN dynnr.

Effect

Declaration of a Table Control. If the type TABLEVIEW is entered in the CONTROLS statement, adeep structure is created with the name of thecontrol and the type CXTAB_CONTROL of the type groupCXTAB. Duringscreenprocessing, 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 ofthe table control. The component COLS is an internal table of the structure CXTAB_COLUMN and containsthe attributes of individual columns. The structure CXTAB_COLUMN contains a structured component SCREEN,which has the same structure as screenand 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.

In dynnr, you must specify the number of a screen on which a table control with the name contrlis defined. For dynnr, you can specify a literal or a constant of the type n and the length 4. When a screen, in which a table control called contrl is defined, is first called, thestartvalues of certain components of the structure are obtained from the definition of the table control whose screen is specified after the USING addition.

Structure CXTAB_CONTROL

ComponentDescription
 FIXED_COLSNumber of lead columns. Start value is taken from the definition of the table control in screen dynnr.
 LINESControls the vertical scroll bar of the table control. If theLOOP is executed in thescreen flow logic without reference to an internal table, that start value of LINES is 0 and must beset in the program so that the scroll bar can be used. With reference to an internal table, LINES isset to the current number of rows in the internal table if the table control is being processed forthe 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_LINETopmost displayed row for next PBOPBO. Set at time ofPAI by the position of the vertical slider box.
 CURRENT_LINECurrent row during a LOOP in the screen flow logic. If the FROM addition to theLOOP statement 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 ofPAI by the position of the horizontal slider box.
 LINE_SEL_MODERow selection mode: "0" if no rows can be selected , "1" if one row, "2" if several rows. Start value is taken from the definition of the table control in screen dynnr.
 COL_SEL_MODEColumn selection mode: "0" if no columns can be selected , "1" if one column, "2" if several columns. Start value is taken from the definition of the table control in screen dynnr.
 LINE_SELECTORFlag ("X" or " ") whether there is a selection column. Start value is taken from the definition of the table control in screen dynnr.
 H_GRIDFlag ("X" or " ") whether there are horizontal separators. Start value is taken from the definition of the table control in screen dynnr.
 V_GRIDFlag ("X" or " ") whether there are vertical separators. Start value is taken from the definition of the table control in screen dynnr.
 COLSControl table for individual columns of structure CXTAB_COLUMN.
 INVISIBLEFlag ("X" or " ") whether or not the table control is visible in the window or not.

Structure CXTAB_COLUMN

ComponentDescription
 SCREENStructure for the attributes of the screen element of the current column. The components can be set for the values described there either directly or usingMODIFY SCREEN . The latter overwrites a direct value assignment.
 INDEXCurrent position of the column in the table control. Start value is taken from the definition of the table control in the screen dynnr. Is set to the current value at time ofPAI.
 SELECTEDFlag ("X" or " ") whether or not column is selected. Is set to current value at time ofPAI.
 VISLENGTHVisible length of column. Start value is taken from the definition of the table control in screen dynnr.
 INVISIBLEFlag ("X" or " ") whether or not the column is visible in the table control.

Notes

  • In a table control, you can scroll vertically using a scroll bar if the component LINES of the structure CXTAB_CONTROL was set to the correct row number before thePBO processing of the table control. Every time you scroll with the scroll bar, the eventPAIis 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-controlled scrolling, it is sufficient to assign a value to the component TOP_LINE of thestructure 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-loopc during theloop 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.


Example

If a table control is defined on the screen with the number 100, whose rows are defined with referenceto the database table SPFLI in the ABAP Dictionary, the corresponding programming of the ABAP programcan look as follows. In a PBO module prepare_tab, an internal table spfli_tab is filledwith data from the database table. The number of rows of spfli_tab is assigned to the componentlines of the structure flight_tab created using CONTROLS; this is done to activate thescroll 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 screen flow logic can be seen in the example forLOOP.

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.


SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up   General Data in Customer Master  
This documentation is copyright by SAP AG.


Length: 11928 Date: 20120522 Time: 040610     triton ( 312 ms )