Documentation View

We are hiring and constantly growing! Have a look through our vacancies to find the right role for you!

ABAPASSIGN_MEM_AREA_DYNAMIC_ACCESS - ASSIGN MEM AREA DYNAMIC ACCESS

ABAPASSIGN_MEM_AREA_DYNAMIC_ACCESS - ASSIGN MEM AREA DYNAMIC ACCESS

Fill RESBD Structure from EBP Component Structure   BAL Application Log Documentation  
This documentation is copyright by SAP AG.
SAP E-Book

ASSIGN, dynamic_access

Short Reference



... ${ cref->(attr_name) $}
  $| ${ iref->(attr_name) $}
  $| ${ (clif_name)=>(attr_name) $}
  $| ${ (clif_name)=>attr $}
  $| ${ clif=>(attr_name) $} ...

Alternatives:

1. ... cref->(attr_name)

2. ... iref->(attr_name)

3. ... (clif_name)=>(attr_name)

4. ... (clif_name)=>attr

5. ... clif=>(attr_name)

Effect

These alternatives to specifying the memory area mem_area of the statement ASSIGN dynamically are designed especially for dynamic access to attributes of classes or interfaces (Dynamic Access).

In an inline declaration of the field symbol using FIELD-SYMBOL(<fs>), its typing is performed with the generic type data.

In these variants, the statement ASSIGN sets the return code sy-subrc. If the assignment is successful, sy-subrc is set to 0, otherwise to 4. If the assignment is not successful, the field symbol keeps its previous state. It is therefore not sufficient to evaluate the predicate expression <fs> IS ASSIGNED and sy-subrc needs to be checked as well.

Note

Field symbols to which instance attributes or parts of instance attributes are assigned have a memory-preserving effect on the associated object.

Alternative 1

... cref->(attr_name)


Effect

This form is possible for all visible attributes of objects. cref can be any class reference variable that points to an object that contains the attribute specified in a character-like field attr_name. The system searches for the attribute first in the static type of cref and then in the dynamic type.

The attribute name does not have to be in uppercase letters. It can contain offsets/lengths, structure component selectors, object component selectors, and class component selectors, in order to assign parts of the attribute (or referenced objects of the attribute).

Example

Dynamic assignment of an object attribute of an object to a field symbol. The assignment is made via an object reference variable of the static type of the root class object, which can point to any object.

Alternative 2

... iref->(attr_name)


Effect

This form may be used for all visible attributes of objects. iref can be any interface reference variable that points to an object that contains the interface attribute specified in a character-like field attr_name. The search for this method takes place only in the static type of iref.

The attribute name does not have to be in uppercase letters. It can contain offsets/lengths, structure component selectors, object component selectors, and class component selectors, in order to assign parts of the attribute (or referenced objects of the attribute).

Example

Dynamic assignment of an object attribute to a field symbol. The assignment is made via an interface reference variable.

Alternative 3

... (clif_name)=>(attr_name)


Alternative 4

... (clif_name)=>attr


Effect

These forms may be used for all visible static attributes. Classes and interfaces and also attributes can be specified dynamically in character-like fields clif_name or attr_name. The attribute attr can, however, also be specified directly. The system searches for the class or interface first and then the attribute.

The content of attr_name and clif_name does not have to be in uppercase letters. attr_name can contain offsets/lengths, structure component selectors, object component selectors, and class component selectors, in order to assign parts of the attribute or referenced objects of the attribute. Here, no offsets/lengths or object component selectors can be specified after a directly specified attribute attr.

Note

If a class of another program is specified in clif_name using an absolute type name, this program is loaded into a new additional program group or into the current program group, depending on the program type, if it has not yet been loaded. If required, the program constructor is also executed in this case.

Alternative 5

... clif=>(attr_name)


Effect

This form may be used for all visible static attributes. The class or interfaces is specified directly, and the attribute specified dynamically in a character-like field attr_name. The system searches for the attribute in the specified class or interface.

The content of attr_name does not have to be in uppercase letters. attr_name can contain offsets/lengths, structure component selectors, object component selectors, and class component selectors, in order to assign parts of the attribute or referenced objects of the attribute.

Example

Different dynamic assignments of a static class attribute to field symbols.






BAL_S_LOG - Application Log: Log header data   ROGBILLS - Synchronize billing plans  
This documentation is copyright by SAP AG.

Length: 7581 Date: 20221203 Time: 162331     sap01-206 ( 125 ms )