Ansicht
Dokumentation

ABENVALUE_CONSTRUCTOR_PARAMS_ITAB - VALUE CONSTRUCTOR PARAMS ITAB

ABENVALUE_CONSTRUCTOR_PARAMS_ITAB - VALUE CONSTRUCTOR PARAMS ITAB

Fill RESBD Structure from EBP Component Structure   RFUMSV00 - Advance Return for Tax on Sales/Purchases  
This documentation is copyright by SAP AG.
SAP E-Book

VALUE, Internal Tables

... VALUE dtype$|#( $[let_exp$]
                   $[BASE itab$]
                   $[FOR for_exp1
                    FOR for_exp2
                    ... $]
                   ( line_spec1 )
                   ( line_spec2 )
                     ... ) ...


Additions

1. ... BASE itab

2. ... FOR for_exp

Effect

  • The table lines are then constructed in one or more sets of internal parentheses by specifying line_spec. Each set of inner parentheses constructs one or more lines in accordance with the information in line_spec and inserts them into the created internal table in accordance with the rules for the statement INSERT ... INTO TABLE, with one difference: Any conflicts with an existing unique primary table key raise an exception of the class CX_SY_ITAB_DUPLICATE_KEY. The object is inserted in the order of the parentheses.

If the VALUE operator is used as the source of an assignment to an internal table, it is first initialized after the evaluation of a possible LET expression or is assigned the content of itab. Then, line_spec data is then evaluated and inserted directly into the target table.

Notes

  • In assignments of constructor expressions to an internal table, its existing lines cannot be used directly as an argument in line_spec. This is because this table is deleted before line_spec is evaluated or overwritten by the content of itab. If the entire internal table or lines from the left side are needed on the right side, however, they can be saved in local helper variables using a LET expression, since this expression is evaluated first.
  • The operand type for line_spec in the inner parentheses is the line type of the table type specified using dtype or #, which means it is always uniquely identifiable. Constructor expressions at this position can therefore always derive the required data type using #.

Construction of an internal table with a structured line type and filling it with two lines. The structures are filled with values component by component.

Construction of an internal table with a tabular line type and filling it with two lines. The first line is assigned a table that is already filled. The second line is constructed using VALUE.

Examples

See also the examples for the instance operator NEW.

Addition 1

... BASE itab

Effect

Notes

  • Without the addition BASE, the content of tables can only be newly constructed using the value operator, but not extended. If the same table is specified after BASE to which the constructor expression is assigned, further lines can be inserted in this table.
  • If the target table is specified as itab after BASE in an assignment to an existing internal table, there is no assignment before line_spec is evaluated, but the target table simply keeps its value instead.

Example

Use of BASE. The table type of base1 or base2 is transferred in the construction of tab1 and tab2. This is not possible in the construction of tab3 since the line type of base2 is not structured and hence does not match the specification of individual components in the following parentheses. The type itab2 is specified explicitly for tab3. This is possible since the line type of base2 can be converted into this line type. Since sorted tables are constructed, the lines in the results are also sorted.

Example

Use of BASE to append lines to existing lines in an internal table.

Example

Use of BASE to append lines to an internal table in a loop. After the output, it is shown how the same function can be applied using an iteration expression with FOR.

VALUE - Addition BASE for Internal Tables

Addition 2

... FOR for_exp

Effect

The specification of one or more consecutive iteration expressions using FOR, this means that the lines constructed in line_spec for each iteration of the last FOR expression are inserted into the target table. When constructing table lines in line_spec, the visible local work areas and field symbols of the iteration expressions can be used to construct the table lines.

  • If the VALUE operator is used, it should be noted that assignments to internal tables are also initialized or assigned the content of itab after BASE even in the case of table comprehensions after the evaluation of a LET expressions and the target table is then used directly. The original table can therefore not be used directly in the FOR expressions, unless it is assigned to a helper variable after LET.

Example

Construction of a temporary internal table with an elementary line type and filling it with square numbers using an iteration expression.






CPI1466 during Backup   CL_GUI_FRONTEND_SERVICES - Frontend Services  
This documentation is copyright by SAP AG.

Length: 9063 Date: 20240416 Time: 171803     sap01-206 ( 150 ms )