<?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 ALv in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-alv/m-p/4490744#M1062896</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Check this link&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_blogpost" href="https://community.sap.com/" __jive_macro_name="blogpost" modifiedtitle="true" __default_attr="42904"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards, &lt;/P&gt;&lt;P&gt;Anirban&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 18 Sep 2008 07:30:17 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-09-18T07:30:17Z</dc:date>
    <item>
      <title>Dynamic ALv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-alv/m-p/4490743#M1062895</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gurus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to create Dynamic Alv using Grid Layout. Can anyone sent me the sample code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Bhuvana.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2008 07:28:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-alv/m-p/4490743#M1062895</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-18T07:28:40Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic ALv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-alv/m-p/4490744#M1062896</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Check this link&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_blogpost" href="https://community.sap.com/" __jive_macro_name="blogpost" modifiedtitle="true" __default_attr="42904"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards, &lt;/P&gt;&lt;P&gt;Anirban&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2008 07:30:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-alv/m-p/4490744#M1062896</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-18T07:30:17Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic ALv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-alv/m-p/4490745#M1062897</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 run this sample code you will get an idea of how to go about while creating any type of Dynamic ALV report.&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;P&gt;&lt;/P&gt;&lt;P&gt;*build the dynamic internal table&lt;/P&gt;&lt;P&gt;perform build_dyn_itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*write 5 records to the alv grid&lt;/P&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;P&gt;&lt;/P&gt;&lt;P&gt;*call the alv grid.&lt;/P&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;P&gt;&lt;/P&gt;&lt;P&gt;*Build_dyn_itab&lt;/P&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;P&gt;&lt;/P&gt;&lt;P&gt;*Create fields .&lt;/P&gt;&lt;P&gt;clear wa_it_fldcat.&lt;/P&gt;&lt;P&gt;wa_it_fldcat-fieldname = 'name1'.&lt;/P&gt;&lt;P&gt;wa_it_fldcat-datatype = 'mara-matnr'.&lt;/P&gt;&lt;P&gt;wa_it_fldcat-intlen = 5.&lt;/P&gt;&lt;P&gt;append wa_it_fldcat to it_fldcat .&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*clear wa_it_fldcat.&lt;/P&gt;&lt;P&gt;&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 = 5.&lt;/P&gt;&lt;P&gt;append wa_it_fldcat to it_fldcat .&lt;/P&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;P&gt;&lt;/P&gt;&lt;P&gt;*Create dynamic internal table and assign to FS&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 = 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;P&gt;&lt;/P&gt;&lt;P&gt;*Create dynamic work area and assign to FS&lt;/P&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;P&gt;*Form build_report&lt;/P&gt;&lt;P&gt;*********************************************************************&lt;/P&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;P&gt;&lt;/P&gt;&lt;P&gt;*Set up fieldvalue&lt;/P&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;P&gt;&lt;/P&gt;&lt;P&gt;*Append to the dynamic internal table&lt;/P&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;endform.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;P&gt;*CALL_ALV&lt;/P&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;&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;P&gt;*Call ABAP List Viewer (ALV)&lt;/P&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;Also check the following link might help you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="6113449"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With best wishes,&lt;/P&gt;&lt;P&gt;Murthy.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2008 08:38:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-alv/m-p/4490745#M1062897</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-18T08:38:22Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic ALv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-alv/m-p/4490746#M1062898</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;Check the following steps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Steps:-&lt;/P&gt;&lt;P&gt;1. Create your field catalog either manually or automatically using the function module, LVC_FIELDCATALOG_MERGE. Add more rows to the field catalog table (T_FIELDCAT) at run time.&lt;/P&gt;&lt;P&gt;2. Use the field catalog to create a table dynamically using the method below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: T_OUTPUT TYPE REF TO DATA 
FIELD-SYMBOLS: &amp;lt;T_OUTPUT&amp;gt; TYPE TABLE 

Call Method CL_ALV_TABLE_CREATE-&amp;gt;CREATE_DYNAMIC_TABLE 
   Exporting 
      IT_FIELDCATALOG = T_FIELDCAT 
   Importing 
      EP_TABLE = T_OUTPUT. 

ASSIGN T_OUTPUT-&amp;gt;* TO &amp;lt;T_OUTPUT&amp;gt;.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now the field symbol &amp;lt;T_OUTPUT&amp;gt; is pointing to an output table of the structure that contains the fields which were determined at runtime. Now fill this table with the data and pass &amp;lt;T_OUTPUT&amp;gt; to the method SET_TABLE_FOR_FIRST_DISPLAY and the ALV grid should show the data properly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;* the content of itab will be fields of the new table
loop at itab1 into wa1.
  Gs_FIELDCAT-TABNAME     = 'itab2'.
  GS_FIELDCAT-FIELDNAME = wa1-packid.
  GS_FIELDCAT-OUTPUTLEN = 2.
  GS_FIELDCAT-KEY         = space.
  GS_FIELDCAT-SELTEXT_L = wa1-packid.
  GS_FIELDCAT-COL_POS     =  1.
  GS_FIELDCAT-JUST        = 'L'.
  APPEND GS_FIELDCAT TO GT_FIELDCAT.
endloop.

 LOOP AT GT_FIELDCAT INTO GS_FIELDCAT.
     MOVE-CORRESPONDING GS_FIELDCAT TO ls_fcat.
     APPEND ls_fcat TO lt_fieldcat.
 ENDLOOP.

CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table
       EXPORTING
            it_fieldcatalog = lt_fieldcat
       IMPORTING 
            ep_table = t_output.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Fill the dynamic internal table with the data.&lt;/P&gt;&lt;P&gt;Now pass the fieldcatalog and internal table to the FM or method. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kinshuk&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Sep 2008 16:56:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-alv/m-p/4490746#M1062898</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-19T16:56:23Z</dc:date>
    </item>
  </channel>
</rss>

