<?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 column in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-column/m-p/6092333#M1358975</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Field symbols&lt;/P&gt;&lt;P&gt;I do the same with Warehouse &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

DATA: gp_table TYPE REF TO data.
FIELD-SYMBOLS: &amp;lt;gt_outtab&amp;gt; TYPE table.
FIELD-SYMBOLS: &amp;lt;field_table&amp;gt; TYPE table.


 LOOP AT t_magaz.
    TRANSLATE t_magaz-lgort TO UPPER CASE.
    CLEAR ls_fieldcat.
    ls_fieldcat-fieldname  = t_magaz-lgort.
    ls_fieldcat-datatype    = 'QUAN'.
    ls_fieldcat-outputlen  = 14.
    ls_fieldcat-coltext    = t_magaz-lgort.
    APPEND ls_fieldcat TO gt_fieldcat.
   ENDLOOP.

 FIELD-SYMBOLS: &amp;lt;ls_table&amp;gt;.
  FIELD-SYMBOLS: &amp;lt;l_field&amp;gt;.
  DATA: txt_field(60).
* creazione tabella di output dinamica
  CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table
    EXPORTING
      it_fieldcatalog = gt_fieldcat
    IMPORTING
      ep_table        = gp_table.
  ASSIGN gp_table-&amp;gt;* TO &amp;lt;gt_outtab&amp;gt;.
  REFRESH &amp;lt;gt_outtab&amp;gt;.
  ASSIGN gp_table-&amp;gt;* TO &amp;lt;field_table&amp;gt;.
  REFRESH &amp;lt;field_table&amp;gt;.

loop at t_magaz.
concatenate '&amp;lt;ls_table&amp;gt;-' t_magaz-lgort into txt_field.
assign (txt_field) to &amp;lt;l_field&amp;gt;
&amp;lt;l_field&amp;gt; =  t_magaz-quantity.
endloop.
 APPEND &amp;lt;ls_table&amp;gt; TO &amp;lt;gt_outtab&amp;gt;.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;These are scraps from a more complex code, but there is all you need.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 09 Sep 2009 11:15:34 GMT</pubDate>
    <dc:creator>SimoneMilesi</dc:creator>
    <dc:date>2009-09-09T11:15:34Z</dc:date>
    <item>
      <title>Dynamic column</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-column/m-p/6092331#M1358973</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I want to create dynamic columns in my table control.....For eg a custom table will store the column name...if 5 record are there then 5 columns should be made in table control.....Please help how can I do that?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Sep 2009 11:04:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-column/m-p/6092331#M1358973</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-09T11:04:27Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic column</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-column/m-p/6092332#M1358974</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Priya,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please refer to the below code&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.      **********Creates a dyanamic internal table********** 
  perform get_data. 
  perform write_out. 
  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. 
  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. 
    
  form get_data. 
  * Select Data from table. 
  select * into table &amp;lt;dyn_table&amp;gt; 
             from (p_table). 
  endform. 
   Write out data from table. 
  loop at &amp;lt;dyn_table&amp;gt; into &amp;lt;dyn_wa&amp;gt;. 
    do. 
      assign component  sy-index   
         of structure &amp;lt;dyn_wa&amp;gt; to &amp;lt;dyn_field&amp;gt;. 
      if sy-subrc  0. 
        exit. 
      endif. 
      if sy-index = 1. 
        write:/ &amp;lt;dyn_field&amp;gt;. 
      else. 
        write: &amp;lt;dyn_field&amp;gt;. 
      endif. 
    enddo. 
  endloop
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Sep 2009 11:13:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-column/m-p/6092332#M1358974</guid>
      <dc:creator>former_member873340</dc:creator>
      <dc:date>2009-09-09T11:13:41Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic column</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-column/m-p/6092333#M1358975</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Field symbols&lt;/P&gt;&lt;P&gt;I do the same with Warehouse &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

DATA: gp_table TYPE REF TO data.
FIELD-SYMBOLS: &amp;lt;gt_outtab&amp;gt; TYPE table.
FIELD-SYMBOLS: &amp;lt;field_table&amp;gt; TYPE table.


 LOOP AT t_magaz.
    TRANSLATE t_magaz-lgort TO UPPER CASE.
    CLEAR ls_fieldcat.
    ls_fieldcat-fieldname  = t_magaz-lgort.
    ls_fieldcat-datatype    = 'QUAN'.
    ls_fieldcat-outputlen  = 14.
    ls_fieldcat-coltext    = t_magaz-lgort.
    APPEND ls_fieldcat TO gt_fieldcat.
   ENDLOOP.

 FIELD-SYMBOLS: &amp;lt;ls_table&amp;gt;.
  FIELD-SYMBOLS: &amp;lt;l_field&amp;gt;.
  DATA: txt_field(60).
* creazione tabella di output dinamica
  CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table
    EXPORTING
      it_fieldcatalog = gt_fieldcat
    IMPORTING
      ep_table        = gp_table.
  ASSIGN gp_table-&amp;gt;* TO &amp;lt;gt_outtab&amp;gt;.
  REFRESH &amp;lt;gt_outtab&amp;gt;.
  ASSIGN gp_table-&amp;gt;* TO &amp;lt;field_table&amp;gt;.
  REFRESH &amp;lt;field_table&amp;gt;.

loop at t_magaz.
concatenate '&amp;lt;ls_table&amp;gt;-' t_magaz-lgort into txt_field.
assign (txt_field) to &amp;lt;l_field&amp;gt;
&amp;lt;l_field&amp;gt; =  t_magaz-quantity.
endloop.
 APPEND &amp;lt;ls_table&amp;gt; TO &amp;lt;gt_outtab&amp;gt;.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;These are scraps from a more complex code, but there is all you need.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Sep 2009 11:15:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-column/m-p/6092333#M1358975</guid>
      <dc:creator>SimoneMilesi</dc:creator>
      <dc:date>2009-09-09T11:15:34Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic column</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-column/m-p/6092334#M1358976</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using a module pool table control..and not editable alv&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Sep 2009 11:23:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-column/m-p/6092334#M1358976</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-09T11:23:36Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic column</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-column/m-p/6092335#M1358977</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Priya,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry I misred your post...You can go ahead and do the below coding.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First while designing the code declare all the columns and based on the program logic u can hide the unwanted columns.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in the PBO flow logic use.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT SCREEN.

IF SCREEN-NAME = 'ITAB-COLUMN1' OR SCREEN-NAME = 'ITAB-COLUMN3'.
SCREEN-INVISIBLE = '1'.
MODIFY SCREEN.
ENDIF.

ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know if u need any help&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Gowri&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Sep 2009 11:42:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-column/m-p/6092335#M1358977</guid>
      <dc:creator>former_member873340</dc:creator>
      <dc:date>2009-09-09T11:42:04Z</dc:date>
    </item>
  </channel>
</rss>

