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: 

Field symbols ?

Former Member
0 Kudos

I would like to pass the DREF variable as parameter to the class method. How should I define the parameter ?

Would the TYPING METHOD be 'DREF' and Associated type 'DATA'?

2 REPLIES 2

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Not sure what you are trying to do yet, but I think you want to do something like this.

data: dref type ref to data.

REgards,

Rich Heilman

0 Kudos

For example, when creating a dynamic internal table.



report  zrich_0002.

field-symbols: <dyn_table> type standard table,
               <dyn_wa>.

data: new_table type ref to data.

data: it_fldcat type lvc_t_fcat,
      wa_it_fldcat type lvc_s_fcat.
data: index(2) type c.


do 10 times.
  index = sy-index.
  clear wa_it_fldcat.
  concatenate 'Field' index into
           wa_it_fldcat-fieldname .
  condense  wa_it_fldcat-fieldname no-gaps.
  wa_it_fldcat-datatype = 'CHAR'.
  wa_it_fldcat-intlen = 5.
  append wa_it_fldcat to it_fldcat .
enddo.


* Create dynamic internal table and assign to FS
call method cl_alv_table_create=>create_dynamic_table
  exporting
    it_fieldcatalog = it_fldcat
  importing
    ep_table        = new_table.

assign new_table->* to <dyn_table>.

check sy-subrc = 0.

Regards,

Rich Heilman