<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: CREATE DATA dref in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/create-data-dref/m-p/5391822#M1239351</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;    You can use this class for dyanamic generation of class &lt;/P&gt;&lt;P&gt;    CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        it_fieldcatalog = ifc         (Field catalog)&lt;/P&gt;&lt;P&gt;      IMPORTING&lt;/P&gt;&lt;P&gt;        ep_table        = dy_table.&lt;/P&gt;&lt;P&gt;dy_table is a pointer to an internal table .&lt;/P&gt;&lt;P&gt;and to be declared like &lt;/P&gt;&lt;P&gt;DATA: dy_table TYPE REF TO data.&lt;/P&gt;&lt;P&gt; ASSIGN dy_table-&amp;gt;* TO &amp;lt;dyn_itrecord&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Following fields of the fieldcatlog also should be filled&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    xfc-fieldname =  'MCODE'.&lt;/P&gt;&lt;P&gt;    xfc-datatype  = 'CHAR'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; xfc-inttype   = 'D'.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    xfc-intlen    = '18'.&lt;/P&gt;&lt;P&gt;    xfc-decimals  = 0.&lt;/P&gt;&lt;P&gt;    APPEND xfc TO ifc.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 07 Apr 2009 10:33:43 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-04-07T10:33:43Z</dc:date>
    <item>
      <title>CREATE DATA dref</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/create-data-dref/m-p/5391820#M1239349</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to create internal table dynamically, and below is the sample code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
      DATA: tab_fieldcat  TYPE lvc_t_fcat.

      CREATE DATA dref_table TYPE (tabname).
      ASSIGN dref_table-&amp;gt;* TO &amp;lt;wa&amp;gt;.

     structref ?= cl_abap_typedescr=&amp;gt;describe_by_data( &amp;lt;wa&amp;gt; ).    

      LOOP AT structref -&amp;gt;components ASSIGNING &amp;lt;wa_component&amp;gt;.
        IF sy_tabix &amp;lt; 10.
          wa_field-fieldname     = &amp;lt;wa_component&amp;gt;-name.
          wa_field-ref_table     = g_table.
          wa_field-ref_field     = &amp;lt;wa_component&amp;gt;-name.
          APPEND wa_field TO tab_fieldcat.
        ENDIF.
      ENDLOOP.

      CREATE DATA eptable LIKE tab_fieldcat.    &amp;lt;----------- PROBLEM !!!
      ASSIGN eptable-&amp;gt;* TO &amp;lt;itab&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Problem face at the last statement CREATE DATA, where &amp;lt;itab&amp;gt; is containing field components ROW_POS, COL_POS, FIELDNAME, TABNAME, etc etc that those are fields coming from structure &lt;STRONG&gt;lvc_t_fcat&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But i want dynamic table created according to fields that i filtered during LOOP~ENDLOOP. &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Please comment how i can achieve that.&lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;FYI, i can't use method cl_alv_table_create=&amp;gt;create_dynamic_table since i've read the disadvantage abt it from internet.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Apr 2009 10:13:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/create-data-dref/m-p/5391820#M1239349</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-07T10:13:06Z</dc:date>
    </item>
    <item>
      <title>Re: CREATE DATA dref</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/create-data-dref/m-p/5391821#M1239350</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use create data statement as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: gv_struct_name TYPE w_tabname,&lt;/P&gt;&lt;P&gt;         gv_dref TYPE REF TO data,.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS: &amp;lt;gf_itab&amp;gt; TYPE STANDARD TABLE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;gv_struct_name = 'your structure or table name'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF NOT gv_struct_name IS INITIAL.&lt;/P&gt;&lt;P&gt;    CREATE DATA gv_dref TYPE TABLE OF (gv_struct_name).&lt;/P&gt;&lt;P&gt; ASSIGN gv_dref-&amp;gt;* TO &amp;lt;gf_itab&amp;gt;.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this will help you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Apr 2009 10:21:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/create-data-dref/m-p/5391821#M1239350</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-07T10:21:26Z</dc:date>
    </item>
    <item>
      <title>Re: CREATE DATA dref</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/create-data-dref/m-p/5391822#M1239351</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;    You can use this class for dyanamic generation of class &lt;/P&gt;&lt;P&gt;    CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        it_fieldcatalog = ifc         (Field catalog)&lt;/P&gt;&lt;P&gt;      IMPORTING&lt;/P&gt;&lt;P&gt;        ep_table        = dy_table.&lt;/P&gt;&lt;P&gt;dy_table is a pointer to an internal table .&lt;/P&gt;&lt;P&gt;and to be declared like &lt;/P&gt;&lt;P&gt;DATA: dy_table TYPE REF TO data.&lt;/P&gt;&lt;P&gt; ASSIGN dy_table-&amp;gt;* TO &amp;lt;dyn_itrecord&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Following fields of the fieldcatlog also should be filled&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    xfc-fieldname =  'MCODE'.&lt;/P&gt;&lt;P&gt;    xfc-datatype  = 'CHAR'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; xfc-inttype   = 'D'.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    xfc-intlen    = '18'.&lt;/P&gt;&lt;P&gt;    xfc-decimals  = 0.&lt;/P&gt;&lt;P&gt;    APPEND xfc TO ifc.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Apr 2009 10:33:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/create-data-dref/m-p/5391822#M1239351</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-07T10:33:43Z</dc:date>
    </item>
    <item>
      <title>Re: CREATE DATA dref</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/create-data-dref/m-p/5391823#M1239352</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sheelesh, thanks for your reply however your code is leading me back to the problem that mentioned in my post. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please comment.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Apr 2009 10:34:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/create-data-dref/m-p/5391823#M1239352</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-07T10:34:39Z</dc:date>
    </item>
    <item>
      <title>Re: CREATE DATA dref</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/create-data-dref/m-p/5391824#M1239353</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi varghese oommen, i can not use cl_alv_table_create=&amp;gt;create_dynamic_table due to it is having limitation on the memory.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please comment.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Apr 2009 10:35:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/create-data-dref/m-p/5391824#M1239353</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-07T10:35:43Z</dc:date>
    </item>
    <item>
      <title>Re: CREATE DATA dref</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/create-data-dref/m-p/5391825#M1239354</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The below statements will crate the dynamic internal table with reference to variable gv_struct_name but you need to populate the name of your table to the variable gv_struct_name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT gv_struct_name IS INITIAL.&lt;/P&gt;&lt;P&gt;CREATE DATA gv_dref TYPE TABLE OF (gv_struct_name).&lt;/P&gt;&lt;P&gt;ASSIGN gv_dref-&amp;gt;* TO &amp;lt;gf_itab&amp;gt;.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have used the same code previously and is working fine.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Apr 2009 10:51:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/create-data-dref/m-p/5391825#M1239354</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-07T10:51:08Z</dc:date>
    </item>
    <item>
      <title>Re: CREATE DATA dref</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/create-data-dref/m-p/5391826#M1239355</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You eg given is base on a table. For my case after i got a table, i need to further filter out those not required fields. That's why i need to Loop~Endloop to populate the fields that i need.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Problem comes when i create itab dynamically where it doesn't create according to the structure that i prepared.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Apr 2009 10:59:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/create-data-dref/m-p/5391826#M1239355</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-07T10:59:43Z</dc:date>
    </item>
    <item>
      <title>Re: CREATE DATA dref</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/create-data-dref/m-p/5391827#M1239356</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all, this is to update you that i get my problem solved by using SUBMIT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(1)Main program -&amp;gt; (2)Submit subprogram -&amp;gt; (3)call subroutine in Main program&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(1) &amp;amp; (2) - In main program, i SUBMIT xxx AND RETURN calling the subprogram.&lt;/P&gt;&lt;P&gt;             - At this calling step, i EXPORT my fieldcat to memory ID &lt;/P&gt;&lt;P&gt;(2) &amp;amp; (3) - In subprogram, it only having the code to call back a subrountine in Main prog.&lt;/P&gt;&lt;P&gt;             - In main program, it IMPORT back the fieldcat from memory ID and then resume the code for&lt;/P&gt;&lt;P&gt;               dynamic table creation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;eg code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Main prog - Z_MAIN

      EXPORT IT_FIELDCAT TO MEMORY ID 'TEST'.
      SUBMIT Z_SUB AND RETURN.

      FORM TEST.

        IMPORT IT_FIELDCAT FROM MEMORY ID 'TEST'.

        CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table
          EXPORTING
            it_fieldcatalog           = IT_FIELDCAT
          IMPORTING
            ep_table                  = ep_table
          EXCEPTIONS
            generate_subpool_dir_full = 1
            OTHERS                    = 2.

          UNASSIGN &amp;lt;gf_table&amp;gt;.
          ASSIGN ep_table-&amp;gt;* TO &amp;lt;gf_table&amp;gt;.
       ENDFORM.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Subprog - Z_SUB
      PERFORM TEST IN PROGRAM Z_MAIN.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Apr 2009 06:24:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/create-data-dref/m-p/5391827#M1239356</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-10T06:24:52Z</dc:date>
    </item>
  </channel>
</rss>

