A table control is a control that contains an R/3 table data. It has columns and rows of data.
A table control has the following parts:

The frame box defines the visible portion of the table data on the screen.
Each cell of the table control is considered a control. The information on these controls is in the control structure. The whole table is also a control. Special information on the table control is in the
It_TableInfo structure.Using Table Controls in SAPGUI
The following operations are allowed on a table control in SAPGUI:
A column may be defined as fixed, and then the end user cannot scroll over this column.
Using Table Controls in the GUI Library
The GUI Library provides all the above operations on a table control.
Displaying a Table Control
You display a table control as you would any other control on the screen.
Working with a Table Control
The following steps describe a typical procedure for working with the table control:
This will send the changes in the It_TableInfo structure to the application server.
Example: Scrolling
The following example scrolls in a table control to display row number 5 as the first row. It assumes that control number 16 on the screen is a table.
pEvt->eventtype |= MES_VSCROLL ;
IT_TABLEINFO tbinfo;
int len = ItEv_GetControlInfo(pEvt, ITCTRL_IDX(16),&tbinfo, sizeof(tbinfo));
tbinfo.TabVerScrollbarStartRow = 5;
len = ItEv_SetControlInfo(pEvt, ITCTRL_IDX(16),&tbinfo, sizeof(tbinfo));
if (It_SendEvent(hMr, &pEvt) == FALSE) {
printf("error in sendevent\n");
}
if (It_GetEvent(hMr, &pEvt) == FALSE) {
printf("error in getevent\n");
}
Switching Between Columns
Use the
ItEv_SetTableColumnPermutation function to switch between two columns in the table control.The ItEv_SetTableColumnPermutation function uses an array that stores the order of the columns in the table control. Changing the values in the array changes the order of the columns in the table control.
The following example prompts the user to enter the columns to switch, and then switches between them. It assumes that control number 16 on the screen is a table.
printf("Swap: ");
int a, b, pCols[10];
for (i = 0; i < 10; i++)
pCols[i] = i;
scanf("%d %d", &a, &b);
pCols[a] = b;
pCols[b] = a;
ItEv_SetTableColumnPermutation(pEvt, ITCTRL_IDX(16), pCols, 10);
It_SendEvent(hMr, &pEvt);
It_GetEvent(hMr, &pEvt);
Changing the Width of a Column
Use the
ItEv_SetWidth function to change the width of a table control column.