You use the field-set macro to assign values to ITS variables in the active context. This allows you to set the values of a single variable (especially if that variable contains a large amount of data) or build up an array of values from one column of a table.
Typically, you set these values in the PBO module of a transaction when you are preparing data for display. You can even make multiple field-set calls in separate PBO modules.
field-set contextfield-name (in, CHAR) contextfield-index (in, NUM) contextfield-value (in, CHAR)
Parameter |
Description |
contextfield-name |
Context field name. |
contextfield-index |
Context field index. |
contextfield-value |
Context field value. |
Suppose you are processing an internal table, which has the following structure and contents:
MATNO QTY DESC 1234 1 10 mm drill bit 5678 1 Drill bit case
You can define the contents of this table to the ITS with the following ABAP code:
data counter type i. counter = 1. loop at matinfo. field-set 'matinfo-matno' counter matinfo-matno. field-set 'matinfo-qty' counter matinfo-qty. field-set 'matinfo-desc' counter matinfo-desc. add 1 to counter. endloop.
The variable name you use as the first parameter can be any name you like. This is the name used by the ITS to identify the variable
For performance reasons, field-set calls are first buffered on the application server. To transfer all data accumulated by field-set calls to the ITS, you use the field-transport macro.
One column of an ABAP table corresponds to one ITS array. The ITS can only store one-dimensional arrays, not the multi-dimensional structure of an ABAP table. For this reason, the name you choose for the parameter should reflect both the ABAP table name and the column name.
ITS array indexes start at 1, not 0.
You can have two ITS arrays derived from the same ABAP table (for example, books-isbn and books-title) that have unequal numbers of elements.