Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8451

Re: Dynamic table as class (instance) attribute

$
0
0

Hi David,

 

When using type ref to data, you have to assign this object to field-symbol.

 

Definition part.

 

PUBLIC SECTION.     METHODS : constructor,               add                IMPORTING                  element TYPE any.   PRIVATE SECTION.     DATA : list TYPE REF TO data.

implementation part.

 

METHOD constructor.     CREATE DATA me->list TYPE STANDARD TABLE OF string. " Created only one time   ENDMETHOD.                    "constructor   METHOD add.     FIELD-SYMBOLS : <list> TYPE STANDARD TABLE.     ASSIGN me->list->* TO <list>.     CHECK sy-subrc EQ 0.     APPEND element         TO <list>.   ENDMETHOD.                    "add

You can use something like this, but you cant use generic type for me->list.

If you dont use type standart table of syntax, you cant create table type.

READ TABLE or LOOP AT ... WHERE is problematic with this kind of table.

 

Best Regards.

Tolga


Viewing all articles
Browse latest Browse all 8451

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>