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: 

->* operator

Former Member
0 Kudos

Hello,

Im reading the documentation on ->* operator, and dont really understand how it works, can any body tell me its functionality?

Thanks

Gabriel P.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

What it does, it takes the underlying DATA object from a dynamically created a element, and assigns that to the data element. Other wise there is no way dealing with the dynamically created object.

Regards,

Ravi

3 REPLIES 3

Former Member
0 Kudos

Basically it is a deferencing operator. It is used for refering an anonymus object of any type.

Check this piece of code

DATA:   gt_dyn_table TYPE REF TO data,
        gs_dyn_line  TYPE REF TO data.

FIELD-SYMBOLS: <fs_quota>   TYPE STANDARD TABLE,
               <fs_amount>,
               <fs_quota_wa>.

*Create dynamic internal table
  CALL METHOD cl_alv_table_create=>create_dynamic_table
               EXPORTING
                  it_fieldcatalog = gt_fldcat
               IMPORTING
                  ep_table        = gt_dyn_table.

  ASSIGN gt_dyn_table->* TO <fs_quota>.

  CREATE DATA gs_dyn_line LIKE LINE OF <fs_quota>.
  ASSIGN gs_dyn_line->* TO <fs_quota_wa>.

Thanks,

Message was edited by: Naren Somen

Former Member
0 Kudos

What it does, it takes the underlying DATA object from a dynamically created a element, and assigns that to the data element. Other wise there is no way dealing with the dynamically created object.

Regards,

Ravi

former_member188685
Active Contributor
0 Kudos

Hi,

CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = t_fieldcat
IMPORTING
ep_table = r_dyn_table
EXCEPTIONS
generate_subpool_dir_full = 1
OTHERS = 2.

IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

* Get access to new table using field symbol.

ASSIGN r_dyn_table->* TO <t_dyn_table>.
* Create work area for new table.

CREATE DATA r_wa_dyn_table LIKE LINE OF <t_dyn_table>.

* Get access to new work area using field symbol.

ASSIGN r_wa_dyn_table->* TO <wa_dyn_table>.

Regards

Vijay