Purpose | With Table you can create a new table (SAP table control) | ||||||||||||
Example | Table
(10,20) (16,84)
name="proj"
title="Project
overview This creates a table control with title "Project overview". The table columns are then defined by Column statements. |
||||||||||||
Format | Table
(row1,column1) (row2,column2)
name="mytable"
title="mytitle"
A new table with heading "MyTitle" is created. The internal name is "mytable". The total number of rows is "rowcount". The number of lines displayed depends on the coordinates. Column statements are automatically assigned to the preceding Table statements unless a different table is specified with the table= option. |
||||||||||||
Options |
|
||||||||||||
Using a table variable
|
It is recommended to create a suitable table variable for the data of the table with
CreateTable. Example:
// Create table variable V[cities] if not yet done: CreateTable V[cities] city country latitude longitude endif
// Display table
Column "City" size=30 name="city" Without a table variable, GuiXT uses a single variable named V[tablename.cell.columnname.rownumber] per cell, for example V[projects.cell.description.7]. |
||||||||||||
Variable assignment
|
Both the content of the table
(input and output) and the state (scrolling, selection of rows and columns,
changing column widths and column order) are mapped into variables the names
of which start with the table name, e.g.
"mytable".
The names of the variables for the cell content begin with
"mytable.cell.".
All status variables begin with
"mytable.stat."
Cell content Each table cell is represented by a variable V[tabname.columnname.row]. Example: V[projects.description.7] is the 7th row, column "description" in the table "projects". With CLear V[projects] you can reset the whole table content. In order to reset the table state (Scrolling, row selections,...) you use CLear V[projects.stat.*] Scrolling The scrolling functions are automatically implemented by the SAP table control (scroll buttons, SAP icons, scroll bars). If several tables are simultaneously displayed, the scroll keys (first page, page forward / back, last page) are applied to the table in which the cursor is, otherwise to the first table displayed. The variable V[tabname.stat.firstvisiblerow] contains the number of the first row displayed. The variable can be changed in a script to scroll to a different line, for example to implement a search function. Example: Set V[projects.stat.firstvisiblerow] 12 This scrolls the table to line 12. If the variable is not set, the value 1 is assumed. The variable V[tabname.stat.lastvisiblerow] contains the number of the last displayed line. A change in a script has no effect.
Horizontal scrolling Horizontal scrolling through the tables columns is also possible. The variable V[tabname.stat.firstvisiblercolumn] contains the number of the first displayed column. If the variable is not set, the value 1 is assumed. If you use fixedcolumns= the variable V[tabname.stat.firstvisiblecolumn] contains the number of the first column that is displayed in the scrollable column range. For example, when you have 2 fixed columns, it starts with 3.
Column order The initial order of the columns is determined by the order of the column instructions. The user can then change the order of the columns. It can also be set dynamically in the script. The variables are V[tabname.stat.columnnumber.columnname], e.g. V[projects.stat.columnnumber.description].
Column width
The initial width of the columns is determined by the
width=
options of the
column
statements. The user can then change the width of the columns. It can also
be set dynamically in the script. The variables are
V[tabname.stat.columnwidth.columname],
e.g.
Row selection For a selected row the variable V[tabname.stat.rowselection.row] is set to "X". Example: if V[projects.stat.rowselection.1=X] queries whether row 1 has been selected. The selection of a row can also be set by a script.
Setting rows to readonly To set individual rows to "readonly" you can use the variable V[tabname.stat.rowreadonly.row]. The value "X" means "readonly". Example: Set V[projects.stat.rowreadonly.&V[i]] "X"
Column selection For a selected column the variable V[tabname.stat.columnselection.columnname] is set to "X". Example: if V[projects.stat.columnselection.description=X] queries whether column "description" has been selected. The selection of a column can also be set by a script.
Pushbuttons in table columns A column statement may define pushbuttons that launch an InputScript. The following variables are set: V[_tabrow] Number of the selected row in the table display, starting with 1 for the first line shown V[_tabrowabs] Absolute row number within the table
Search help (F4) for table columns You can assign an SAP search help for a column in the column statement.
Cursor position The cursor position within the table can be queried with the following variables: V[_cursortabname] Table title (title=) V[_cursortabtechname] Technical table name (name=) V[_cursorcolname] Column title V[_cursorcoltechname] Technical column name V[_tabcol] Column number V[_tabrow] Number of the cursor row in the table display, starting with 1 for the first line shown V[_tabrowabs] Absolute row number within the table V[_cursorrow] Row where the table controls starts ("Row 1" in Table command) V[_cursorcol] Column where the table controls starts ("Column 1" in Table command)
Settin the cursor to a table cell Use SetCursor cell[tabname,columnname,row], for example SetCursor cell[project,Description,3] Here the row number here is the row number as on the display, not the absolute row number in the whole table. For "columnname" you may use the column title or it technical name. If you want to place the cursor to a cell given its absolute row number, e.g. V[posrow], column "descr", you may use the following coding: if
V[posrow<&V[xtab.stat.firstvisiblerow]]
or
V[posrow>&V[xtab.stat.lastvisiblerow]]
|
||||||||||||
Components | GuiXT + InputAssistant |