SAP OO OBS ASSIGN LOCAL 1

Get Example source ABAP code based on a different SAP table
  


ABAP Code Snippet
ARTICLE

No local copies using ASSIGN
In ABAP Objects it is not possible to use field symbols in procedures to work with copies of other data.

Error message in ABAP Objects if the following syntax is used:

ASSIGN LOCAL COPY OF INITIAL f TO <(><<)>fs>.

ASSIGN LOCAL COPY OF f TO <(><<)>fs>.
Correct syntax:

DATA dref TYPE REF TO data.
CREATE DATA dref LIKE f.
ASSIGN dref->* TO <(><<)>fs>.

DATA dref TYPE REF TO data.
CREATE DATA dref LIKE f.
ASSIGN dref->* TO <(><<)>fs>.
<(><<)>fs> = f.
Reason:

Due to the introduction of the general data references concept, the addition LOCAL COPY of the statement ASSIGN is obsolete. The value of f can be copied using the assigment <(><)> = f after ASSIGN.