<?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: Dynamic Structure Creation in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-structure-creation/m-p/3759003#M904369</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi David,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for that link to presentation. It is really interesting and btw there is also better solution where you do not have to create dynamic table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: personType TYPE REF TO cl_abap_structdescr,
           employeeType TYPE REF TO cl_abap_structdescr,
           comp_tab TYPE cl_abap_structdescr=&amp;gt;component_table,
           comp LIKE LINE OF comp_tab.

personType ?= cl_abap_typedescr=&amp;gt;describe_by_name( 'personType' ).
comp-name = 'EMPLOYEE'. comp-type = personType. append comp to comp_tab.
comp-name = 'MANAGER'. comp-type = personType. append comp to comp_tab.
employeeType = cl_abap_structdescr=&amp;gt;create( comp_tab ).
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 30 Apr 2008 12:41:47 GMT</pubDate>
    <dc:creator>mvoros</dc:creator>
    <dc:date>2008-04-30T12:41:47Z</dc:date>
    <item>
      <title>Dynamic Structure Creation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-structure-creation/m-p/3759000#M904366</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I Have a string (for a eg: 'BPSearch'). I Have a name-value pair table (say T1).&lt;/P&gt;&lt;P&gt;I need to dynamically  create a structure with name 'BPSearch' . The fields of this structure would be the first column in the table T1 and the value for the fields of this structure is the 2nd column of the table T1.&lt;/P&gt;&lt;P&gt;Can some one help me how to do this as I am new to ABAP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Nisha NC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Apr 2008 10:24:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-structure-creation/m-p/3759000#M904366</guid>
      <dc:creator>nisha_vinod</dc:creator>
      <dc:date>2008-04-30T10:24:44Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Structure Creation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-structure-creation/m-p/3759001#M904367</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To create structures dynamically you need to use RTTS and RTTI, I suggest you to read the following [https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b332e090-0201-0010-bdbd-b735e96fe0ae].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Apr 2008 12:29:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-structure-creation/m-p/3759001#M904367</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-30T12:29:29Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Structure Creation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-structure-creation/m-p/3759002#M904368</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;I have solution for you, but it is not the best solution. It creates dynamic table described by ALV fieldcatalog and then it creates structure like line of the dynamic table. You will have to prepare ALV field catalog using your table T1. But maybe it is possible to avoid creating table. So you will just create directly dynamic structure. Just look inside the method CREATE_DYNAMIC_TABLE, it has to be somewhere there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
FIELD-SYMBOLS: &amp;lt;tab1&amp;gt; TYPE STANDARD TABLE,
               &amp;lt;line&amp;gt; TYPE ANY.

  DATA: lt_new TYPE REF TO data.
  DATA: ls_new TYPE REF TO data.
  FIELD-SYMBOLS: &amp;lt;field&amp;gt; TYPE ANY.

* Create tab1
  CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table
    EXPORTING
      it_fieldcatalog = gt_fc1
    IMPORTING
      ep_table        = lt_new.

* Create a new line with the same structure as the table.
  ASSIGN lt_new-&amp;gt;* TO &amp;lt;tab1&amp;gt;.

  CREATE DATA ls_new LIKE LINE OF &amp;lt;tab1&amp;gt;.
  ASSIGN ls_new-&amp;gt;* TO &amp;lt;line&amp;gt;.

* Assigning value YYY to component XXX
  ASSIGN COMPONENT 'XXX' OF STRUCTURE &amp;lt;line&amp;gt; TO &amp;lt;field&amp;gt;.
  MOVE 'YYY' TO &amp;lt;field&amp;gt;.
 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Apr 2008 12:30:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-structure-creation/m-p/3759002#M904368</guid>
      <dc:creator>mvoros</dc:creator>
      <dc:date>2008-04-30T12:30:21Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Structure Creation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-structure-creation/m-p/3759003#M904369</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi David,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for that link to presentation. It is really interesting and btw there is also better solution where you do not have to create dynamic table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: personType TYPE REF TO cl_abap_structdescr,
           employeeType TYPE REF TO cl_abap_structdescr,
           comp_tab TYPE cl_abap_structdescr=&amp;gt;component_table,
           comp LIKE LINE OF comp_tab.

personType ?= cl_abap_typedescr=&amp;gt;describe_by_name( 'personType' ).
comp-name = 'EMPLOYEE'. comp-type = personType. append comp to comp_tab.
comp-name = 'MANAGER'. comp-type = personType. append comp to comp_tab.
employeeType = cl_abap_structdescr=&amp;gt;create( comp_tab ).
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Apr 2008 12:41:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-structure-creation/m-p/3759003#M904369</guid>
      <dc:creator>mvoros</dc:creator>
      <dc:date>2008-04-30T12:41:47Z</dc:date>
    </item>
  </channel>
</rss>

