<?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: appending column to an dynamically created internal table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/appending-column-to-an-dynamically-created-internal-table/m-p/2139149#M450357</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;
  call function 'LVC_FIELDCATALOG_MERGE'
    exporting
      i_structure_name = p_table
    changing
      ct_fieldcat      = i_fcat
    exceptions
      others           = 1.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;lt;b&amp;gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt; Here add your field name in the i_fcat internal table (field catalog) &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;&amp;lt;/b&amp;gt;&lt;/P&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 = i_fcat
    importing
      ep_table        = i_content.
  if sy-subrc = 0.
    assign i_content-&amp;gt;* to &amp;lt;ptab&amp;gt;.
  else.
    write: 'Error creating internal table'.
    stop.
  endif.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;aRs&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 02 Apr 2007 15:02:43 GMT</pubDate>
    <dc:creator>former_member194669</dc:creator>
    <dc:date>2007-04-02T15:02:43Z</dc:date>
    <item>
      <title>appending column to an dynamically created internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/appending-column-to-an-dynamically-created-internal-table/m-p/2139148#M450356</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi folks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have an dynamically created internal table &amp;lt;dyn_tab&amp;gt; which is based on a parameter p_table (  containing the table name ). now i want to add one more column to this &amp;lt;dyn_tab&amp;gt; table where i can store further information in. how can i do that ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i appreciate your help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2007 14:55:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/appending-column-to-an-dynamically-created-internal-table/m-p/2139148#M450356</guid>
      <dc:creator>former_member5350</dc:creator>
      <dc:date>2007-04-02T14:55:45Z</dc:date>
    </item>
    <item>
      <title>Re: appending column to an dynamically created internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/appending-column-to-an-dynamically-created-internal-table/m-p/2139149#M450357</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;
  call function 'LVC_FIELDCATALOG_MERGE'
    exporting
      i_structure_name = p_table
    changing
      ct_fieldcat      = i_fcat
    exceptions
      others           = 1.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;lt;b&amp;gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt; Here add your field name in the i_fcat internal table (field catalog) &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;&amp;lt;/b&amp;gt;&lt;/P&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 = i_fcat
    importing
      ep_table        = i_content.
  if sy-subrc = 0.
    assign i_content-&amp;gt;* to &amp;lt;ptab&amp;gt;.
  else.
    write: 'Error creating internal table'.
    stop.
  endif.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;aRs&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2007 15:02:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/appending-column-to-an-dynamically-created-internal-table/m-p/2139149#M450357</guid>
      <dc:creator>former_member194669</dc:creator>
      <dc:date>2007-04-02T15:02:43Z</dc:date>
    </item>
    <item>
      <title>Re: appending column to an dynamically created internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/appending-column-to-an-dynamically-created-internal-table/m-p/2139150#M450358</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, thanks for your immediate answer:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;one question is left - as it dumps ( the i_content table stays initial ) - how did you define i_content and i_fcat ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Clemens Leider&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2007 15:20:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/appending-column-to-an-dynamically-created-internal-table/m-p/2139150#M450358</guid>
      <dc:creator>former_member5350</dc:creator>
      <dc:date>2007-04-02T15:20:06Z</dc:date>
    </item>
    <item>
      <title>Re: appending column to an dynamically created internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/appending-column-to-an-dynamically-created-internal-table/m-p/2139151#M450359</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;Please check this sample program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
type-pools : abap. 
field-symbols: &amp;lt;dyn_table&amp;gt; type standard table, 
               &amp;lt;dyn_wa&amp;gt;, 
               &amp;lt;dyn_field&amp;gt;. 

data: dy_table type ref to data, 
      dy_line  type ref to data, 
      xfc type lvc_s_fcat, 
      ifc type lvc_t_fcat. 

selection-screen begin of block b1 with frame. 
parameters: p_table(30) type c default 'T001'. 
selection-screen end of block b1. 

start-of-selection. 
  perform get_structure. 
  perform create_dynamic_itab.      


form get_structure. 
  data : idetails type abap_compdescr_tab, 
       xdetails type abap_compdescr. 
  data : ref_table_des type ref to cl_abap_structdescr. 
  * Get the structure of the table. 
  ref_table_des ?=  
      cl_abap_typedescr=&amp;gt;describe_by_name( p_table ). 
  idetails[] = ref_table_des-&amp;gt;components[]. 
    loop at idetails into xdetails. 
    clear xfc. 
    xfc-fieldname = xdetails-name . 
    xfc-datatype = xdetails-type_kind. 
    xfc-inttype = xdetails-type_kind. 
    xfc-intlen = xdetails-length. 
    xfc-decimals = xdetails-decimals. 
    append xfc to ifc. 
  endloop. 

*Add your new field(s) into table ifc here.
  ...  


endform. 


form create_dynamic_itab. 
* Create dynamic internal table and assign to FS 
  call method cl_alv_table_create=&amp;gt;create_dynamic_table 
               exporting 
                  it_fieldcatalog = ifc 
               importing 
                  ep_table        = dy_table. 
    assign dy_table-&amp;gt;* to &amp;lt;dyn_table&amp;gt;. 
  * Create dynamic work area and assign to FS 
  create data dy_line like line of &amp;lt;dyn_table&amp;gt;. 
  assign dy_line-&amp;gt;* to &amp;lt;dyn_wa&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;Ferry Lianto&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2007 15:23:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/appending-column-to-an-dynamically-created-internal-table/m-p/2139151#M450359</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-02T15:23:37Z</dc:date>
    </item>
    <item>
      <title>Re: appending column to an dynamically created internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/appending-column-to-an-dynamically-created-internal-table/m-p/2139152#M450360</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;
field-symbols:
      &amp;lt;ptab&amp;gt;        type standard table.

data: i_fcat        type lvc_t_fcat.
data: i_content     type ref to data.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;aRs&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2007 15:25:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/appending-column-to-an-dynamically-created-internal-table/m-p/2139152#M450360</guid>
      <dc:creator>former_member194669</dc:creator>
      <dc:date>2007-04-02T15:25:08Z</dc:date>
    </item>
  </channel>
</rss>

