<?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 -FIELDCATALOG????? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-fieldcatalog/m-p/2732106#M634424</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI &lt;/P&gt;&lt;P&gt;just use this code and change the fields according to ur requiremnt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;STEP: 1 - get backend field catalog (currently displayed alv)&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CLEAR: tl_fieldcatalog. REFRESH: tl_fieldcatalog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL METHOD w_grid-&amp;gt;get_backend_fieldcatalog&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IMPORTING&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    et_fieldcatalog = tl_fieldcatalog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;STEP: 2 - create a new fieldcatalog for dynamic internal table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CLEAR: sl_fieldcatalog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CLEAR: t_outtab_fieldname. REFRESH: t_outtab_fieldname.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CLEAR: tl_fieldcatalog_new. REFRESH: tl_fieldcatalog_new.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CLEAR: t_download_fieldname. REFRESH: t_download_fieldname.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CLEAR: t_download_fieldheading. REFRESH: t_download_fieldheading.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT tl_fieldcatalog INTO sl_fieldcatalog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  STEP: 2.1 - populate data in T_OUTTAB_FIELDNAME&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    APPEND sl_fieldcatalog-fieldname TO t_outtab_fieldname.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  STEP: 2.2 - populate TL_FIELDCATALOG_NEW &amp;amp; T_DOWNLOAD_FIELDNAME&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    IF sl_fieldcatalog-no_out EQ ''.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      IF sl_fieldcatalog-fieldname NE 'STATUS'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      OR sl_fieldcatalog-fieldname NE 'MESG_STATUS'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      OR sl_fieldcatalog-fieldname NE 'ZLOCK'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      OR sl_fieldcatalog-fieldname NE 'T_PLANT'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      OR sl_fieldcatalog-fieldname NE 'T_CSR'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        If field is COMM_PLANT, change its length&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        IF sl_fieldcatalog-fieldname EQ 'COMM_PLANT'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          sl_fieldcatalog-outputlen = 1800.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          sl_fieldcatalog-intlen = 1800.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          sl_fieldcatalog-dd_outlen = 1800.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        ENDIF.    "comm_plant&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        sl_fieldcatalog_new = sl_fieldcatalog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        APPEND sl_fieldcatalog_new TO tl_fieldcatalog_new.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        APPEND sl_fieldcatalog-fieldname TO t_download_fieldname.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        APPEND sl_fieldcatalog-scrtext_l TO t_download_fieldheading.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        CLEAR: sl_fieldcatalog, sl_fieldcatalog_new.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;STEP: 3 - create dynamic internal table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  FREE: ref_download.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     I_STYLE_TABLE             =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      it_fieldcatalog           = tl_fieldcatalog_new&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    IMPORTING&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      ep_table                  = ref_download&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     E_STYLE_FNAME             =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    EXCEPTIONS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      generate_subpool_dir_full = 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      OTHERS                    = 2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ASSIGN ref_download-&amp;gt;* TO &amp;lt;ft_download&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CREATE DATA ref_wa LIKE LINE OF &amp;lt;ft_download&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ASSIGN ref_wa-&amp;gt;* TO &amp;lt;fs_download&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;STEP: 4 - populate data in dynamic internal table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT t_outtab INTO wa_outtab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    LOOP AT t_download_fieldname.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      ASSIGN COMPONENT t_download_fieldname OF STRUCTURE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                       &amp;lt;fs_download&amp;gt; TO &amp;lt;fs_download_field&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      IF t_download_fieldname-field EQ 'COMM_PLANT'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;            STEP: 4.1 - get long text from database table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        CLEAR: wal_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        SELECT SINGLE * FROM zshaven_plnt_txt&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                        INTO wal_table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                        WHERE vbeln   = wa_outtab-vbeln&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                        AND   posnr   = wa_outtab-posnr&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                        AND   del_no  = wa_outtab-del_no&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                        AND   del_itm = wa_outtab-del_itm.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        IF sy-subrc EQ 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                STEP: 4.2 - break long-text into separate lines&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          CLEAR: tl_text. REFRESH: tl_text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          SPLIT wal_table-plant_comm&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                AT '~'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                INTO TABLE tl_text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                STEP: 4.3 - Combine these separate lines with space in&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                            between two lines&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          CLEAR: wal_text, final_text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          LOOP AT tl_text INTO wal_text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            IF final_text IS INITIAL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              final_text = wal_text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            ELSE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              CONCATENATE final_text '-' wal_text&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                  INTO final_text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              REPLACE '-' WITH ' ' INTO final_text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;            STEP: 4.4  - move long text to work-area&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          &amp;lt;fs_download_field&amp;gt; = final_text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        ENDIF.    "subrc&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      ELSE.    "t_download_fieldname&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        READ TABLE t_outtab_fieldname&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            WITH KEY field = t_download_fieldname-field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        ASSIGN COMPONENT t_outtab_fieldname-field OF STRUCTURE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                         wa_outtab TO &amp;lt;fs_outtab_field&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        &amp;lt;fs_download_field&amp;gt; = &amp;lt;fs_outtab_field&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    STEP: 4.5 - Move data from work-area to dynamic internal table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    APPEND &amp;lt;fs_download&amp;gt; TO &amp;lt;ft_download&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CLEAR: &amp;lt;fs_download&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;STEP: 5 - download&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'DOWNLOAD'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       EXPORTING&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            filename                = 'C:\zshaven.xls'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            filetype                = 'DAT'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            filetype_no_show        = 'X'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            filetype_no_change      = 'X'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       TABLES&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            data_tab                = &amp;lt;ft_download&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            fieldnames              = t_download_fieldheading&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       EXCEPTIONS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            invalid_filesize        = 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            invalid_table_width     = 2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            invalid_type            = 3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            no_batch                = 4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            unknown_error           = 5&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            gui_refuse_filetransfer = 6&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            customer_error          = 7&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            OTHERS                  = 8.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;REWARD IF HELPFUL;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vivekanand&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 06 Sep 2007 07:40:44 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-09-06T07:40:44Z</dc:date>
    <item>
      <title>DYNAMIC INTERNAL TABLE -FIELDCATALOG?????</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-fieldcatalog/m-p/2732104#M634422</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts , &lt;/P&gt;&lt;P&gt;     I require urgent help on dynamic internal table creation.&lt;/P&gt;&lt;P&gt;I want  to create a  Dynamic Internal Table with &amp;gt;30 but &amp;lt;50 fields where the first 4 fields of the table are diffrent and all fields generated after that are of type QUAN with length 13 .i want to have the contents displayed as an ALV,wherein i dont have to declare 50 fields in the field catalog! how do i go about doing dis?&lt;/P&gt;&lt;P&gt;HELP Please!!!&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Goldie.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2007 07:26:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-fieldcatalog/m-p/2732104#M634422</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-06T07:26:12Z</dc:date>
    </item>
    <item>
      <title>Re: DYNAMIC INTERNAL TABLE -FIELDCATALOG?????</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-fieldcatalog/m-p/2732105#M634423</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Welcome to SDN&lt;/P&gt;&lt;P&gt;Check this blog and implement it&lt;/P&gt;&lt;P&gt;/people/rich.heilman2/blog/2005/07/27/dynamic-internal-tables-and-structures--abap&lt;/P&gt;&lt;P&gt;Its much easier to understand.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Gopi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2007 07:35:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-fieldcatalog/m-p/2732105#M634423</guid>
      <dc:creator>gopi_narendra</dc:creator>
      <dc:date>2007-09-06T07:35:29Z</dc:date>
    </item>
    <item>
      <title>Re: DYNAMIC INTERNAL TABLE -FIELDCATALOG?????</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-fieldcatalog/m-p/2732106#M634424</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI &lt;/P&gt;&lt;P&gt;just use this code and change the fields according to ur requiremnt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;STEP: 1 - get backend field catalog (currently displayed alv)&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CLEAR: tl_fieldcatalog. REFRESH: tl_fieldcatalog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL METHOD w_grid-&amp;gt;get_backend_fieldcatalog&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IMPORTING&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    et_fieldcatalog = tl_fieldcatalog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;STEP: 2 - create a new fieldcatalog for dynamic internal table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CLEAR: sl_fieldcatalog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CLEAR: t_outtab_fieldname. REFRESH: t_outtab_fieldname.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CLEAR: tl_fieldcatalog_new. REFRESH: tl_fieldcatalog_new.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CLEAR: t_download_fieldname. REFRESH: t_download_fieldname.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CLEAR: t_download_fieldheading. REFRESH: t_download_fieldheading.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT tl_fieldcatalog INTO sl_fieldcatalog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  STEP: 2.1 - populate data in T_OUTTAB_FIELDNAME&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    APPEND sl_fieldcatalog-fieldname TO t_outtab_fieldname.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  STEP: 2.2 - populate TL_FIELDCATALOG_NEW &amp;amp; T_DOWNLOAD_FIELDNAME&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    IF sl_fieldcatalog-no_out EQ ''.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      IF sl_fieldcatalog-fieldname NE 'STATUS'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      OR sl_fieldcatalog-fieldname NE 'MESG_STATUS'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      OR sl_fieldcatalog-fieldname NE 'ZLOCK'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      OR sl_fieldcatalog-fieldname NE 'T_PLANT'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      OR sl_fieldcatalog-fieldname NE 'T_CSR'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        If field is COMM_PLANT, change its length&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        IF sl_fieldcatalog-fieldname EQ 'COMM_PLANT'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          sl_fieldcatalog-outputlen = 1800.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          sl_fieldcatalog-intlen = 1800.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          sl_fieldcatalog-dd_outlen = 1800.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        ENDIF.    "comm_plant&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        sl_fieldcatalog_new = sl_fieldcatalog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        APPEND sl_fieldcatalog_new TO tl_fieldcatalog_new.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        APPEND sl_fieldcatalog-fieldname TO t_download_fieldname.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        APPEND sl_fieldcatalog-scrtext_l TO t_download_fieldheading.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        CLEAR: sl_fieldcatalog, sl_fieldcatalog_new.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;STEP: 3 - create dynamic internal table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  FREE: ref_download.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     I_STYLE_TABLE             =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      it_fieldcatalog           = tl_fieldcatalog_new&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    IMPORTING&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      ep_table                  = ref_download&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     E_STYLE_FNAME             =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    EXCEPTIONS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      generate_subpool_dir_full = 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      OTHERS                    = 2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ASSIGN ref_download-&amp;gt;* TO &amp;lt;ft_download&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CREATE DATA ref_wa LIKE LINE OF &amp;lt;ft_download&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ASSIGN ref_wa-&amp;gt;* TO &amp;lt;fs_download&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;STEP: 4 - populate data in dynamic internal table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT t_outtab INTO wa_outtab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    LOOP AT t_download_fieldname.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      ASSIGN COMPONENT t_download_fieldname OF STRUCTURE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                       &amp;lt;fs_download&amp;gt; TO &amp;lt;fs_download_field&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      IF t_download_fieldname-field EQ 'COMM_PLANT'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;            STEP: 4.1 - get long text from database table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        CLEAR: wal_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        SELECT SINGLE * FROM zshaven_plnt_txt&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                        INTO wal_table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                        WHERE vbeln   = wa_outtab-vbeln&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                        AND   posnr   = wa_outtab-posnr&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                        AND   del_no  = wa_outtab-del_no&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                        AND   del_itm = wa_outtab-del_itm.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        IF sy-subrc EQ 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                STEP: 4.2 - break long-text into separate lines&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          CLEAR: tl_text. REFRESH: tl_text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          SPLIT wal_table-plant_comm&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                AT '~'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                INTO TABLE tl_text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                STEP: 4.3 - Combine these separate lines with space in&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                            between two lines&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          CLEAR: wal_text, final_text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          LOOP AT tl_text INTO wal_text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            IF final_text IS INITIAL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              final_text = wal_text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            ELSE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              CONCATENATE final_text '-' wal_text&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                  INTO final_text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              REPLACE '-' WITH ' ' INTO final_text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;            STEP: 4.4  - move long text to work-area&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          &amp;lt;fs_download_field&amp;gt; = final_text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        ENDIF.    "subrc&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      ELSE.    "t_download_fieldname&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        READ TABLE t_outtab_fieldname&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            WITH KEY field = t_download_fieldname-field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        ASSIGN COMPONENT t_outtab_fieldname-field OF STRUCTURE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                         wa_outtab TO &amp;lt;fs_outtab_field&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        &amp;lt;fs_download_field&amp;gt; = &amp;lt;fs_outtab_field&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    STEP: 4.5 - Move data from work-area to dynamic internal table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    APPEND &amp;lt;fs_download&amp;gt; TO &amp;lt;ft_download&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CLEAR: &amp;lt;fs_download&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;STEP: 5 - download&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'DOWNLOAD'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       EXPORTING&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            filename                = 'C:\zshaven.xls'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            filetype                = 'DAT'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            filetype_no_show        = 'X'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            filetype_no_change      = 'X'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       TABLES&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            data_tab                = &amp;lt;ft_download&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            fieldnames              = t_download_fieldheading&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       EXCEPTIONS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            invalid_filesize        = 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            invalid_table_width     = 2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            invalid_type            = 3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            no_batch                = 4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            unknown_error           = 5&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            gui_refuse_filetransfer = 6&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            customer_error          = 7&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            OTHERS                  = 8.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;REWARD IF HELPFUL;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vivekanand&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2007 07:40:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-fieldcatalog/m-p/2732106#M634424</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-06T07:40:44Z</dc:date>
    </item>
    <item>
      <title>Re: DYNAMIC INTERNAL TABLE -FIELDCATALOG?????</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-fieldcatalog/m-p/2732107#M634425</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Please check the following code it willdefinitly serve your perpose. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;type-pools: slis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;field-symbols: &amp;lt;dyn_table&amp;gt; type standard table,&lt;/P&gt;&lt;P&gt;&amp;lt;dyn_wa&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: alv_fldcat type slis_t_fieldcat_alv,&lt;/P&gt;&lt;P&gt;it_fldcat type lvc_t_fcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;selection-screen begin of block b1 with frame title text-001.&lt;/P&gt;&lt;P&gt;parameters: p_flds(5) type c.&lt;/P&gt;&lt;P&gt;selection-screen end of block b1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;start-of-selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;build the dynamic internal table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;perform build_dyn_itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;write 5 records to the alv grid&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;do 5 times.&lt;/P&gt;&lt;P&gt;perform build_report.&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;call the alv grid.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;perform call_alv.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Build_dyn_itab&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;P&gt;form build_dyn_itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: new_table type ref to data,&lt;/P&gt;&lt;P&gt;new_line type ref to data,&lt;/P&gt;&lt;P&gt;wa_it_fldcat type lvc_s_fcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create fields .&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;clear wa_it_fldcat.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;wa_it_fldcat-fieldname = name1.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;wa_it_fldcat-datatype = 'mara-matnr'.&lt;/P&gt;&lt;/LI&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;wa_it_fldcat-intlen = 5.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;append wa_it_fldcat to it_fldcat .&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*clear wa_it_fldcat.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;wa_it_fldcat-fieldname = sy-index.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;wa_it_fldcat-datatype = 'CHAR'.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;wa_it_fldcat-intlen = 5.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;append wa_it_fldcat to it_fldcat .&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do p_flds times.&lt;/P&gt;&lt;P&gt;clear wa_it_fldcat.&lt;/P&gt;&lt;P&gt;wa_it_fldcat-fieldname = sy-index.&lt;/P&gt;&lt;P&gt;wa_it_fldcat-datatype = 'CHAR'.&lt;/P&gt;&lt;P&gt;wa_it_fldcat-intlen = 6.&lt;/P&gt;&lt;P&gt;append wa_it_fldcat to it_fldcat .&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create dynamic internal table and assign to FS&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;call method cl_alv_table_create=&amp;gt;create_dynamic_table&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;it_fieldcatalog = it_fldcat&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;ep_table = new_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;assign new_table-&amp;gt;* to &amp;lt;dyn_table&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create dynamic work area and assign to FS&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;create data new_line like line of &amp;lt;dyn_table&amp;gt;.&lt;/P&gt;&lt;P&gt;assign new_line-&amp;gt;* to &amp;lt;dyn_wa&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*********************************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Form build_report&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*********************************************************************&lt;/P&gt;&lt;P&gt;form build_report.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: fieldname(20) type c.&lt;/P&gt;&lt;P&gt;data: fieldvalue(5) type c.&lt;/P&gt;&lt;P&gt;data: index(3) type c.&lt;/P&gt;&lt;P&gt;field-symbols: &amp;lt;fs1&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do p_flds times.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;index = sy-index.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Set up fieldvalue&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;concatenate 'FLD' index into&lt;/P&gt;&lt;P&gt;fieldvalue.&lt;/P&gt;&lt;P&gt;condense fieldvalue no-gaps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;assign component index of structure &amp;lt;dyn_wa&amp;gt; to &amp;lt;fs1&amp;gt;.&lt;/P&gt;&lt;P&gt;&amp;lt;fs1&amp;gt; = fieldvalue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Append to the dynamic internal table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;append &amp;lt;dyn_wa&amp;gt; to &amp;lt;dyn_table&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;CALL_ALV&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;P&gt;form call_alv.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: wa_cat like line of alv_fldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*clear wa_cat.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;wa_cat-fieldname = matnr.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;wa_cat-seltext_s = sy-index.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;wa_cat-outputlen = 'ma'.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;append wa_cat to alv_fldcat.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do p_flds times.&lt;/P&gt;&lt;P&gt;clear wa_cat.&lt;/P&gt;&lt;P&gt;wa_cat-fieldname = sy-index.&lt;/P&gt;&lt;P&gt;wa_cat-seltext_s = sy-index.&lt;/P&gt;&lt;P&gt;wa_cat-outputlen = '6'.&lt;/P&gt;&lt;P&gt;append wa_cat to alv_fldcat.&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Call ABAP List Viewer (ALV)&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;call function 'REUSE_ALV_GRID_DISPLAY'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;it_fieldcat = alv_fldcat&lt;/P&gt;&lt;P&gt;tables&lt;/P&gt;&lt;P&gt;t_outtab = &amp;lt;dyn_table&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward if found use full&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ram.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2007 08:27:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-fieldcatalog/m-p/2732107#M634425</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-06T08:27:28Z</dc:date>
    </item>
    <item>
      <title>Re: DYNAMIC INTERNAL TABLE -FIELDCATALOG?????</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-fieldcatalog/m-p/2732108#M634426</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt; Gopi iv seen Rich Heilman's blog before it works fine for dict str/ db tabs...iv created the Dynamic Itab not from a dbtab , but my query is on how to display 40 fields in d ALV without Declaring each field in d field catalog!&lt;/P&gt;&lt;P&gt;If u do come across some useful info regarding my query pl do let me know ...&lt;/P&gt;&lt;P&gt;Thanks&amp;amp;Regards,&lt;/P&gt;&lt;P&gt;Goldie.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Sep 2007 05:21:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-fieldcatalog/m-p/2732108#M634426</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-07T05:21:29Z</dc:date>
    </item>
    <item>
      <title>Re: DYNAMIC INTERNAL TABLE -FIELDCATALOG?????</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-fieldcatalog/m-p/2732109#M634427</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;id like to thank u for d post &lt;/P&gt;&lt;P&gt;iv just started wid ur code ....im a lil lost wid d declaration if u could post dat part too it will b helpful!will try it out and chk if it solves my problem! &lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Goldie.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Sep 2007 05:47:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-fieldcatalog/m-p/2732109#M634427</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-07T05:47:04Z</dc:date>
    </item>
    <item>
      <title>Re: DYNAMIC INTERNAL TABLE -FIELDCATALOG?????</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-fieldcatalog/m-p/2732110#M634428</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;see this code.&lt;/P&gt;&lt;P&gt;REPORT  ZDYN_ITAB.&lt;/P&gt;&lt;P&gt;PARAMETERS:DB_TABLE(30).&lt;/P&gt;&lt;P&gt;DATA FCAT1 TYPE LVC_T_FCAT.&lt;/P&gt;&lt;P&gt;DATA:DYN_ITAB TYPE REF TO DATA,&lt;/P&gt;&lt;P&gt;     WA TYPE REF TO DATA.&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS: &amp;lt;DISP_TABLE&amp;gt; TYPE TABLE,&lt;/P&gt;&lt;P&gt;               &amp;lt;WA&amp;gt; TYPE ANY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      I_STRUCTURE_NAME = DB_TABLE&lt;/P&gt;&lt;P&gt;    CHANGING&lt;/P&gt;&lt;P&gt;      CT_FIELDCAT      = FCAT1[].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL METHOD CL_ALV_TABLE_CREATE=&amp;gt;CREATE_DYNAMIC_TABLE&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      IT_FIELDCATALOG = FCAT1[]&lt;/P&gt;&lt;P&gt;    IMPORTING&lt;/P&gt;&lt;P&gt;      EP_TABLE = DYN_ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ASSIGN DYN_ITAB-&amp;gt;* TO &amp;lt;DISP_TABLE&amp;gt;.&lt;/P&gt;&lt;P&gt;  CREATE DATA WA LIKE LINE OF &amp;lt;DISP_TABLE&amp;gt;.&lt;/P&gt;&lt;P&gt;  ASSIGN WA-&amp;gt;* TO &amp;lt;WA&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    SELECT * FROM (db_table) INTO &amp;lt;WA&amp;gt;.&lt;/P&gt;&lt;P&gt;      APPEND &amp;lt;WA&amp;gt; TO &amp;lt;DISP_table&amp;gt;.&lt;/P&gt;&lt;P&gt;    ENDSELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DESCRIBE TABLE &amp;lt;DISP_table&amp;gt;.&lt;/P&gt;&lt;P&gt;WRITE:/ SY-TFILL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rgds,&lt;/P&gt;&lt;P&gt;bharat.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Sep 2007 05:51:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-fieldcatalog/m-p/2732110#M634428</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-07T05:51:46Z</dc:date>
    </item>
  </channel>
</rss>

