Copyright 2024 - BV TallVision IT

Lists in DYNPRO's can (>3.0) be presented much like Excel. Table control are automatically represented in a new way. Selecting columns or lines is automatically taken care of by the system. The principle:

  • The table control is declared in the ABAP; a table control is in fact a variable with a structure for controlling data for the screen table. This structure can be found in the TYPE-POOL CXTAB. Declaration: CONTROLS cx_control TYPE TABLEVIEW USING SCREEN scrnr.
  • The table control area needs to be "painted" on the screen, version 4.0b's graphical screen painter should enable you to do this quite easily.
  • Make sure you put some fields in the table, if you don't, some dreadful errors are heading towards you when you compile the program. Further processing of the loop fields is done as the existing step-LOOP.
  • The attributes of a table control can be set (or defaulted) in the screen painter, you can set whether selection of lines or columns is allowed, or whether multiple selection is allowed. You can set a title for the control, freeze the first so-many fields for (horizontal) scrolling and more.
  • As for selection (single or multiple), a variable that contains the selection marker (a 1-character variable, set to space or 'X') can be linked to the table control in the screen painter. For column selection, you would have to refer to the actual CXTAB_CONTROL structure, for the fields you are interested in.
  • At runtime the attributes of the table and it's fields can be retrieved and modified. This works in the same way as the SCREEN table. Using the table control, type CXTAB_CONTROL, a type that contains the data for table representation. An overview:

Headings: type CXTAB_CONTROL from TYPE-POOL CXTAB

FieldnameDescriptionType
FIXED_COLS Number of frozen columns Int 1 Do not change
LINES Number of lines in table Int 1 Do not change
TOP_LINE First line at next PBO Int 1 Do not change
CURRENT_LINE Active line (within LOOP/ENDLOOP Int 1 Do not change
LEFT_COL First movable column Int 1 Do not change
LINE_SEL_MODE Line selection Int 1 "0"=No selection, "1"=One or more lines
LINE_SELECTOR Indicator: copy line selection Char 1  
V_SCROLL Indicator: vertical scroll bar Char 1 " " or "X"
H_GRID Show line between lines Char 1 " " or "X"
V_GRID Show line between columns Char 1 " " or "X"
COLS Internal: table with columns    

Columns: type CXTAB_COLUMN from TYPE-POOL CXTAB

FieldnameDescriptionType
SCREEN The SCREEN table structure, which is not a table here !    
INDEX Column position (could be changed by end user) Int 1 Do not change
SELECTED Flag: column selected Char 1 " " or "X"
VISLENGTH Visual length Int 1

Do not change

An example of a table control worked out, first a declaration in the ABAP source:

REPORT TABTEST.
TYPE-POOLS: CXTAB.       

CONTROLS: CX_CONTROL TYPE TABLEVIEW 
            USING SCREEN 0900.

Two examples of PBO PAI processing:

*---------------------------------------------
PROCESS BEFORE OUTPUT.
*---------------------------------------------
LOOP WITH CONTROL CX_CONTROL.
  MODULE D0900_GET_NEXT_ICON.
ENDLOOP.

* The regular LOOP
*---------------------------------------------
PROCESS AFTER INPUT.
*---------------------------------------------
LOOP WITH CONTROL CX_CONTROL.
ENDLOOP.
MODULE D0900_MENU_RESPONS.

* And for a internal table based LOOP AT:
*---------------------------------------------
PROCESS BEFORE OUTPUT.
*---------------------------------------------
LOOP AT INTERNTABLE CURSOR POSITIE 
  WITH CONTROL CX_CONTROL.
ENDLOOP.
 
*---------------------------------------------
PROCESS AFTER INPUT.
*---------------------------------------------
LOOP AT INTERNTABLE. 	"WITH CONTROL must be omitted
ENDLOOP.
MODULE D0900_MENU_RESPONS.