Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Question on the ASSIGN keyword

0 Kudos

Hello,

I had a question regarding the syntax of the ASSIGN keyword. What is the difference between ASSIGN X TO Y and ASSIGN X->* TO Y? I noticed that this allowed the passage of a TYPE REF TO DATA variable to a STANDARD TABLE field symbol i had, but what exactly does the ->* do?

1 ACCEPTED SOLUTION

lenapadeken
Product and Topic Expert
Product and Topic Expert

Hi edisnord,

->* is a dereferencing operator. It means follow the pointer (->) and show what's behind (*). In your case you're having a dereferenced data reference X that is assigned to Y. This syntax might help:

DATA X TYPE REF TO data.
CREATE DATA X TYPE type.
ASSIGN X->* TO FIELD-SYMBOL(<Y>).

You can find more information here ASSIGN, dynamic_dobj - ABAP Keyword Documentation (sap.com) and here Dereferencing Operator - ABAP Keyword Documentation (sap.com).

Best regards,

Lena

3 REPLIES 3

lenapadeken
Product and Topic Expert
Product and Topic Expert

Hi edisnord,

->* is a dereferencing operator. It means follow the pointer (->) and show what's behind (*). In your case you're having a dereferenced data reference X that is assigned to Y. This syntax might help:

DATA X TYPE REF TO data.
CREATE DATA X TYPE type.
ASSIGN X->* TO FIELD-SYMBOL(<Y>).

You can find more information here ASSIGN, dynamic_dobj - ABAP Keyword Documentation (sap.com) and here Dereferencing Operator - ABAP Keyword Documentation (sap.com).

Best regards,

Lena

kilian_kilger
Active Participant

Note than in newer ABAP releases you can use X->* directly in most places in ABAP without using the ASSIGN command.

Thanks Lena and Kilian, your comments were very informative 🙂