Skip to Content
0
Former Member
Jun 05, 2006 at 01:34 PM

accessing dynamic internal table's fields??

686 Views

Hi,

I can create internal table with these codes;

  DATA: LT_FIELDCATALOG type LVC_T_FCAT,
        LS_FIELDCATALOG type LVC_S_FCAT,
        LT_DATA type ref to DATA.

  FIELD-SYMBOLS: <FS_ITAB> type any table.

  FIELD-SYMBOLS: <FS_DATA> type ref to DATA.

  LS_FIELDCATALOG-FIELDNAME  = 'KULLANICI'.
  LS_FIELDCATALOG-INTTYPE    = 'C'.
  APPEND LS_FIELDCATALOG to LT_FIELDCATALOG.

  LOOP AT ITAB_WEEKS.
    LS_FIELDCATALOG-FIELDNAME  = ITAB_WEEKS-WEEK.
    LS_FIELDCATALOG-INTTYPE    = 'C'.
    APPEND LS_FIELDCATALOG to LT_FIELDCATALOG.
  ENDLOOP.

  assign LT_DATA to <FS_DATA>.

  call method cl_alv_table_create=>create_dynamic_table
     exporting
       it_fieldcatalog = LT_FIELDCATALOG
     importing
       ep_table = <FS_DATA>
     exceptions
       generate_subpool_dir_full = 1
       others = 2
		.
  if sy-subrc <> 0.
  endif.

  assign <FS_DATA>->* to <FS_ITAB>.

There is no problem to create internal table. But I don't know how many fields has the <FS_ITAB> have? As seen above codes, there is one field called 'KULLANICI'. And I want to insert dynamic internal table as;

   <FS_ITAB>-KULLANICI = 'XYZ'.

But I can not. Now, my problem is how can I see the total fields (and also field names) and how can I insert values?

I have seen like these codes;

   select * from ... into corresponding fields of <FS_ITAB>.

But this is not usefull for me.

Thanks.