<?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 Internal table using another internal table values in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-using-another-internal-table-values/m-p/4677357#M1099989</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;at this wiki &lt;/P&gt;&lt;P&gt;&lt;A href="https://www.sdn.sap.com/irj/sdn/wiki?path=/display/abap/individual" target="test_blank"&gt;https://www.sdn.sap.com/irj/sdn/wiki?path=/display/abap/individual&lt;/A&gt;&lt;EM&gt;cell&lt;/EM&gt;coloring&lt;EM&gt;in&lt;/EM&gt;dynamic+alv&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can find an example where I build an internal table &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can look at the coding where I loop though the internal table and at the value to the fieldname.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
* dynamic fields
LOOP AT ta_pernrs INTO wa_pernrs.

WRITE wa_pernrs-pernr TO h_ri_pernr.
is_lvc_cat-fieldname = wa_pernrs-pernr.

is_lvc_cat-ref_field = 'massn'.

is_lvc_cat-ref_table = 'PERNR'.

is_lvc_cat-just = 'C'.

CONCATENATE it_0002-inits it_0002-nachn(1) INTO is_lvc_cat-scrtext_s SEPARATED BY space.

CONCATENATE it_0002-inits it_0002-nachn INTO is_lvc_cat-scrtext_m SEPARATED BY space.

CONCATENATE it_0002-inits it_0002-nachn INTO is_lvc_cat-scrtext_l SEPARATED BY space.

APPEND is_lvc_cat TO it_lvc_cat.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and then ofcourse the creation of the table which is also mentioned in the earlier reply&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table

EXPORTING

it_fieldcatalog = it_lvc_cat

IMPORTING

*ep_table = ta_output.*** Create a new Line with the same structure of the table.

ASSIGN ta_output-&amp;gt;* TO &amp;lt;ta_output&amp;gt;.*

CREATE DATA new_line LIKE LINE OF &amp;lt;ta_output&amp;gt;.

ASSIGN new_line-&amp;gt;* TO &amp;lt;l_line&amp;gt;. 


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;kind regards&lt;/P&gt;&lt;P&gt;arthur de smidt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 23 Oct 2008 07:21:32 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-10-23T07:21:32Z</dc:date>
    <item>
      <title>Dynamic Internal table using another internal table values</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-using-another-internal-table-values/m-p/4677355#M1099987</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have an internal table ITAB1, which will get populated inside the program. This ITAB1 will have only one field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to create an internal table dynamically with the values of ITAB1( single field internal table ) as fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Sasidhar Reddy Matli.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Oct 2008 07:00:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-using-another-internal-table-values/m-p/4677355#M1099987</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-23T07:00:45Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Internal table using another internal table values</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-using-another-internal-table-values/m-p/4677356#M1099988</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;/P&gt;&lt;P&gt;try this code...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

      wa_ifc-col_pos = '1'.
      wa_ifc-fieldname = 'LINE_COLOR'.
      wa_ifc-tabname = 1.
      wa_ifc-datatype = 'CHAR'.
      APPEND wa_ifc TO ifc.
      CLEAR wa_ifc.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
   CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table
        EXPORTING
          it_fieldcatalog = ifc
        IMPORTING
          ep_table        = dy_month.

      ASSIGN dy_month-&amp;gt;* TO &amp;lt;dyn_month&amp;gt;.
      CREATE DATA dy_wa LIKE LINE OF &amp;lt;dyn_month&amp;gt;.
      ASSIGN dy_wa-&amp;gt;* TO &amp;lt;wa_month&amp;gt;.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Arunima&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Oct 2008 07:08:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-using-another-internal-table-values/m-p/4677356#M1099988</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-23T07:08:12Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Internal table using another internal table values</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-using-another-internal-table-values/m-p/4677357#M1099989</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;at this wiki &lt;/P&gt;&lt;P&gt;&lt;A href="https://www.sdn.sap.com/irj/sdn/wiki?path=/display/abap/individual" target="test_blank"&gt;https://www.sdn.sap.com/irj/sdn/wiki?path=/display/abap/individual&lt;/A&gt;&lt;EM&gt;cell&lt;/EM&gt;coloring&lt;EM&gt;in&lt;/EM&gt;dynamic+alv&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can find an example where I build an internal table &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can look at the coding where I loop though the internal table and at the value to the fieldname.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
* dynamic fields
LOOP AT ta_pernrs INTO wa_pernrs.

WRITE wa_pernrs-pernr TO h_ri_pernr.
is_lvc_cat-fieldname = wa_pernrs-pernr.

is_lvc_cat-ref_field = 'massn'.

is_lvc_cat-ref_table = 'PERNR'.

is_lvc_cat-just = 'C'.

CONCATENATE it_0002-inits it_0002-nachn(1) INTO is_lvc_cat-scrtext_s SEPARATED BY space.

CONCATENATE it_0002-inits it_0002-nachn INTO is_lvc_cat-scrtext_m SEPARATED BY space.

CONCATENATE it_0002-inits it_0002-nachn INTO is_lvc_cat-scrtext_l SEPARATED BY space.

APPEND is_lvc_cat TO it_lvc_cat.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and then ofcourse the creation of the table which is also mentioned in the earlier reply&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table

EXPORTING

it_fieldcatalog = it_lvc_cat

IMPORTING

*ep_table = ta_output.*** Create a new Line with the same structure of the table.

ASSIGN ta_output-&amp;gt;* TO &amp;lt;ta_output&amp;gt;.*

CREATE DATA new_line LIKE LINE OF &amp;lt;ta_output&amp;gt;.

ASSIGN new_line-&amp;gt;* TO &amp;lt;l_line&amp;gt;. 


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;kind regards&lt;/P&gt;&lt;P&gt;arthur de smidt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Oct 2008 07:21:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-using-another-internal-table-values/m-p/4677357#M1099989</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-23T07:21:32Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Internal table using another internal table values</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-using-another-internal-table-values/m-p/4677358#M1099990</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;u can do it like this....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  DATA: struct_type TYPE REF TO cl_abap_structdescr,
        comp_tab    TYPE cl_abap_structdescr=&amp;gt;component_table,
        dref        TYPE REF TO data,
        itab_type   TYPE REF TO cl_abap_tabledescr,
        wa_comp     LIKE LINE OF comp_tab,
        index1      TYPE char10.

  LOOP AT excel_tab.
      index1 = sy-tabix.
      CONCATENATE 'COL' '_' index1 INTO wa_comp-name.
      CONDENSE wa_comp-name NO-GAPS.
      wa_comp-type ?= cl_abap_datadescr=&amp;gt;describe_by_name( 'STRING' ).
      APPEND  wa_comp TO comp_tab.
  ENDLOOP.

  struct_type = cl_abap_structdescr=&amp;gt;create( comp_tab ).
  itab_type   = cl_abap_tabledescr=&amp;gt;create( struct_type ).
  CREATE DATA dref TYPE HANDLE itab_type.
  ASSIGN dref-&amp;gt;* TO &amp;lt;dyn_table&amp;gt;.
  CREATE DATA dref TYPE HANDLE struct_type.
  ASSIGN dref-&amp;gt;* TO &amp;lt;dyn_wa&amp;gt;.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Oct 2008 07:32:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-using-another-internal-table-values/m-p/4677358#M1099990</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-23T07:32:10Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Internal table using another internal table values</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-using-another-internal-table-values/m-p/4677359#M1099991</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your answers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Sasidhar Reddy Matli.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Oct 2008 10:52:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-using-another-internal-table-values/m-p/4677359#M1099991</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-23T10:52:41Z</dc:date>
    </item>
  </channel>
</rss>

