<?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: Adding fields to an internal table at runtime in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/adding-fields-to-an-internal-table-at-runtime/m-p/1048288#M88504</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;create a dynamic table(it_new) and fieldcatalog for the additional fields&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;as u had told that fieldcatalog is ready&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;by using field symbols &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Assign component 'fieldname' of structure it_fieldcat&lt;/P&gt;&lt;P&gt;to &amp;lt;fld_symbol&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this will work&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if u want sample code i will send&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 14 Dec 2005 14:40:02 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-12-14T14:40:02Z</dc:date>
    <item>
      <title>Adding fields to an internal table at runtime</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/adding-fields-to-an-internal-table-at-runtime/m-p/1048284#M88500</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;Would you know of way to add additional fields/columns to an existing internal table at runtime?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know how to generate a table dynamically from scratch, but here I want to add fields to an &amp;lt;B&amp;gt;EXISTING INTERNAL TABLE&amp;lt;/B&amp;gt;. Even it is WAS 6.40 let me know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any idea will be appreciated ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ravi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Dec 2005 14:18:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/adding-fields-to-an-internal-table-at-runtime/m-p/1048284#M88500</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-14T14:18:23Z</dc:date>
    </item>
    <item>
      <title>Re: Adding fields to an internal table at runtime</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/adding-fields-to-an-internal-table-at-runtime/m-p/1048285#M88501</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The only way is to build it from the beginning, once you create an instance of the internal table, you can't change it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a small sample program which uses a dynamic internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;report zrich_0003
       no standard page heading.

type-pools: slis.

field-symbols: &amp;lt;dyn_table&amp;gt; type standard table,
               &amp;lt;dyn_wa&amp;gt;.

data: alv_fldcat type slis_t_fieldcat_alv,
      it_fldcat type lvc_t_fcat.


selection-screen begin of block b1 with frame title text-001.
parameters: p_check type c.
selection-screen end of block b1.

start-of-selection.

  perform build_dyn_itab.
  perform build_report.

  loop at &amp;lt;dyn_table&amp;gt; into &amp;lt;dyn_wa&amp;gt;.
    write:/ &amp;lt;dyn_wa&amp;gt;.
  endloop.


************************************************************************
*  Build_dyn_itab
************************************************************************
form build_dyn_itab.

  data: index(3) type c.

  data: new_table type ref to data,
        new_line  type ref to data,
        wa_it_fldcat type lvc_s_fcat.

* Create fields
  clear index.
  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=&amp;gt;create_dynamic_table
               exporting
                  it_fieldcatalog = it_fldcat
               importing
                  ep_table        = new_table.

  assign new_table-&amp;gt;* to &amp;lt;dyn_table&amp;gt;.

* Create dynamic work area and assign to FS
  create data new_line like line of &amp;lt;dyn_table&amp;gt;.
  assign new_line-&amp;gt;* to &amp;lt;dyn_wa&amp;gt;.

endform.

*********************************************************************
*      Form  build_report
*********************************************************************
form build_report.

  data: fieldname(20) type c.
  data: fieldvalue(5) type c.
  data: index(3) type c.
  field-symbols: &amp;lt;fs1&amp;gt;.

  do 10 times.

    index = sy-index.

* Set up fieldname
    concatenate 'FIELD' index into
             fieldname .
    condense   fieldname  no-gaps.

* Set up fieldvalue
    concatenate 'FLD' index into
             fieldvalue.
    condense   fieldvalue no-gaps.

    assign component  fieldname  of structure &amp;lt;dyn_wa&amp;gt; to &amp;lt;fs1&amp;gt;.
    &amp;lt;fs1&amp;gt; =  fieldvalue.

  enddo.

* Append to the dynamic internal table
  append &amp;lt;dyn_wa&amp;gt; to &amp;lt;dyn_table&amp;gt;.

endform.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Dec 2005 14:23:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/adding-fields-to-an-internal-table-at-runtime/m-p/1048285#M88501</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2005-12-14T14:23:20Z</dc:date>
    </item>
    <item>
      <title>Re: Adding fields to an internal table at runtime</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/adding-fields-to-an-internal-table-at-runtime/m-p/1048286#M88502</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rich, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know this.&lt;/P&gt;&lt;P&gt;Remember my weblog about the new BADI. &lt;/P&gt;&lt;P&gt;/people/ravikumar.allampallam/blog/2005/12/05/need-a-way-to-change-appearance-of-a-standard-existing-alv-report&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to add more fields to the output of the report here. I am able to fields to the FIELDCAT, however the actual internal table is not being changed. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Ravi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Dec 2005 14:32:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/adding-fields-to-an-internal-table-at-runtime/m-p/1048286#M88502</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-14T14:32:27Z</dc:date>
    </item>
    <item>
      <title>Re: Adding fields to an internal table at runtime</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/adding-fields-to-an-internal-table-at-runtime/m-p/1048287#M88503</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oh yes,  Good weblog.  You know more about than I do.  I was under the impression that once you create your internal table either statically or at runtime, that you can not change it.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Dec 2005 14:36:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/adding-fields-to-an-internal-table-at-runtime/m-p/1048287#M88503</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2005-12-14T14:36:03Z</dc:date>
    </item>
    <item>
      <title>Re: Adding fields to an internal table at runtime</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/adding-fields-to-an-internal-table-at-runtime/m-p/1048288#M88504</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;create a dynamic table(it_new) and fieldcatalog for the additional fields&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;as u had told that fieldcatalog is ready&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;by using field symbols &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Assign component 'fieldname' of structure it_fieldcat&lt;/P&gt;&lt;P&gt;to &amp;lt;fld_symbol&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this will work&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if u want sample code i will send&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Dec 2005 14:40:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/adding-fields-to-an-internal-table-at-runtime/m-p/1048288#M88504</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-14T14:40:02Z</dc:date>
    </item>
    <item>
      <title>Re: Adding fields to an internal table at runtime</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/adding-fields-to-an-internal-table-at-runtime/m-p/1048289#M88505</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;pls let me know if there any clarifications&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;as i had got the same problem few days ago and solved it&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lets say fld1 , fld2 and fld3 are the additional fields &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;these 3 flds can be updated to fieldcatalog.&lt;/P&gt;&lt;P&gt;now ur problem is to update the values for these 3 fields in the internal table , right??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Assign componet 'FLD1' of structure it_fielcat to &amp;lt;fld_symbol&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;fld_symbol&amp;gt; = your internal table value for the field&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this will update the internal table field with the value in fld1&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Dec 2005 14:48:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/adding-fields-to-an-internal-table-at-runtime/m-p/1048289#M88505</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-14T14:48:43Z</dc:date>
    </item>
  </channel>
</rss>

