Ansicht
Dokumentation

ABENNEW_CONSTRUCTOR_PARAMS_STRUCT - NEW CONSTRUCTOR PARAMS STRUCT

ABENNEW_CONSTRUCTOR_PARAMS_STRUCT - NEW CONSTRUCTOR PARAMS STRUCT

Fill RESBD Structure from EBP Component Structure   CPI1466 during Backup  
This documentation is copyright by SAP AG.
SAP E-Book

NEW, Structures

... NEW dtype$|#( $[let_exp$]
                 $[BASE dobj$]
                 comp1 = dobj1 comp2 = dobj2 ... ) ...


Effect

If dtype is a structured data type or # stands for such a type, the individual components can be specified as named arguments comp1, comp2, ... Each component of the created anonymous data object can be assigned a data object with the same data type as the component, or can be converted to it. The assignment is made for all data types in accordance with the corresponding assignment rules.

An addition BASE can be specified in front of the individual component assignments, followed by a data object dobj. dobj is a functional operand position. The type of dobj must be convertible to the type of the anonymous data object. If BASE is specified, the content of dobj is assigned to the anonymous data object before the individual components are assigned. If the character # is specified for the type of the anonymous data object and the type cannot be determined from the operand position of the VALUE expression, the type of dobj is used for this expression if it is known and structured.

dobj1, dobj2, ... are general expression positions. Optionally, a LET expression let_exp can be specified in front of the assignments to define local helper fields that can be used on the right side of the assignments.

If a component is structured itself, either a suitable data object can be assigned to the entire substructure or its components can be specified using the structure component selector (-). Non-specified components are ignored and keep their type-specific initial value, or the value assigned using BASE. If the addition BASE is used, at least one component must also be specified.

It is not possible to assign multiple values to a component if the component is addressed by the same name. In structures that contain component groups, the respective components can be addressed as usual as components of the including structures or by using the name of the component group. Then, a component might be assigned more than one value and the latest assignment is respected.

Notes

  • The assignments can be specified in any order in parentheses.
  • If a component with a complex data type is to be constructed in an argument position, the value operator VALUE can be used. This affects tabular components, for example. This is also possible for structured components but is not necessary since the subcomponents can be addressed using the structure component selector.
  • When a constructor expression is assigned to a reference variable using NEW, the original reference is available in the entire expression in the target variable. The target variable is not overwritten until the expression is completed. In the case of the value operator VALUE, however, the target variable can only be assigned to a helper variable using LET and is then no longer available.

Construction of an anonymous data object with a nested structure type and tabular components. The subcomponents of col2 are addressed directly using the structure component selector. VALUE must be used to construct the tabular component col3 because the syntax for constructing internal tables cannot be specified directly as an argument.

Example

Use of BASE. The type of the return value of base1 is transferred in the construction of ref1. This is not possible in the construction of ref2, since base2 is not structured. In both results, col1 and col3 have the values xx or zz assigned using BASE, whereas col2 has the directly assigned value BB.

Example

See also the examples for the value operator VALUE.






TXBHW - Original Tax Base Amount in Local Currency   ROGBILLS - Synchronize billing plans  
This documentation is copyright by SAP AG.

Length: 5473 Date: 20240423 Time: 114754     sap01-206 ( 98 ms )