Using the instance operator NEW, you can create anonymous data objects, such as anonymous structures. You can access the components or the entire data objects by dereferencing. For more information, refer to the Dynamic Programming and Constructor Expressions cheat sheets.
"Creating a data reference variable
DATA addr_ref1 TYPE REF TO addr_struc.
"Populating the anonymous structure
addr_ref1 = NEW #( name = `Mr. Duncan Pea`
street = `Vegetable Lane 11`
city = `349875 Botanica` ).
addr_ref1->name = `Mrs. Jane Doe`.
"Declaring an anonymous structure/a data reference variable inline
DATA(addr_ref2) = NEW addr_struc( name = `Mr. Duncan Pea`
street = `Vegetable Lane 11`
city = `349875 Botanica` ).
addr_ref2->* = VALUE #( BASE addr_ref2->* name = `Mr. John Doe` ).
Serkan AKKAVAK
Computer Engineer BSc
Head of SAP & Software Department
Contact : serkurumsal@yandex.com

0 Comments