Binding program arrays to screen arrays

In order to display a browsable list of records, the program arrays must be associated to a screen array in the form when defining the DISPLAY ARRAY instruction.

In a model-view-controller paradigm, the DISPLAY ARRAY intruction acts as the controller, the program array is the model, and the screen array with the corresponding TABLE container is the view.

In order to associate the program array to the TABLE container of the current form, you must specify the screen array corresponding to the form table, when declaring the DISPLAY ARRAY instruction:
DISPLAY ARRAY custarr TO sa_cust.* ATTRIBUTES(UNBUFFERED)

In the above code example, custarr is the program array, and sa_cust is the screen array.

The program array is typically defined as a DYNAMIC ARRAY OF RECORD LIKE tabname type, that must match the members of the the screen array used by the DISPLAY ARRAY instruction.

If you do not want to display all columns of the underlying SQL table, a good practice is to define PHANTOM form fields, to keep the same number of members in both program array and screen array structures. The data of these hidden columns will be available in the program array for processing, but are not visible to the user.

However, when the SQL table contains a large number of columns, you should save resources by using only the set of columns that are relevant in the context of the browsable record list.