<?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/6773231#M1463466</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;First populate the Fieldcatalog with  dates in selection scree as below..&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
w_date = s_datum-low. 
  DO.
    IF w_date &amp;lt;= s_datum-high.
      w_col = w_col + 1.
      is_fieldcat-col_pos = w_col.
      WRITE w_date TO w_datum USING EDIT MASK '__/__/____'.
      is_fieldcat-fieldname = w_date.
      is_fieldcat-reptext = w_datum.
      is_fieldcat-inttype    = 'P'.
      is_fieldcat-do_sum   = c_x.
      APPEND is_fieldcat TO it_fieldcat.
      CLEAR is_fieldcat.
      w_date = w_date + 1.

    ELSE.
      EXIT.
    ENDIF.
  ENDDO.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And then create Dynamic intenal Table using below function module.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table
    EXPORTING
      it_fieldcatalog           = it_fieldcat
    IMPORTING
      ep_table                  = r_dyn_table
    EXCEPTIONS
      generate_subpool_dir_full = 1
      OTHERS                    = 2.

  IF sy-subrc &amp;lt;&amp;gt; 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

  ASSIGN r_dyn_table-&amp;gt;* TO &amp;lt;t_dyn_table&amp;gt;.

  CREATE DATA r_wa_dyn_table LIKE LINE OF &amp;lt;t_dyn_table&amp;gt;.

  ASSIGN r_wa_dyn_table-&amp;gt;* TO &amp;lt;wa_dyn_table&amp;gt;.
  ASSIGN r_wa_dyn_table-&amp;gt;* TO &amp;lt;wa_dyn_table1&amp;gt;.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After this u populate the &amp;lt;t_dyn_table&amp;gt; after that display the table using &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
    EXPORTING
      i_callback_program       = sy-repid
      i_callback_pf_status_set = 'SUB_PF_STATUS'
      i_callback_user_command  = 'SUB_USER_COMMAND'
      it_sort_lvc              = it_sort
      it_events                = it_events
      i_grid_title             = w_title
      is_layout_lvc            = is_layout
      it_fieldcat_lvc          = p_fcat
    TABLES
      t_outtab                 = &amp;lt;t_dyn_table&amp;gt;
    EXCEPTIONS
      program_error            = 1
      OTHERS                   = 2.
  IF sy-subrc &amp;lt;&amp;gt; 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Srinivas&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Srininas on Apr 6, 2010 2:03 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 06 Apr 2010 08:33:02 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-04-06T08:33:02Z</dc:date>
    <item>
      <title>Dynamic ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-alv/m-p/6773229#M1463464</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Gurus,&lt;/P&gt;&lt;P&gt;I have one requirement for displaying an Dynamic Alv. I have material plant and req plan no ( PBDNR ) from table PBIM based on the material no , plant and pbdnr in the selection screen and I have to fetch data from pbim and pbed. From pbed i need to fetch plnmg ( amount ) value based on the bdzei feched on the pbim table. now there are various amnts based on the date. so when i enter a date range in the selection screen for a particular material i need to get all the amts in on single row for different dates. &lt;/P&gt;&lt;P&gt;So if that material has six amts on six different dates then six column of dates should come.if it is having 3 dates then 3 dates shld come.So the structure is not fixed .&lt;/P&gt;&lt;P&gt;Please tell me if anyone has worked on this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Abhishek.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Apr 2010 07:58:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-alv/m-p/6773229#M1463464</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-06T07:58:19Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-alv/m-p/6773230#M1463465</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if u want to know how to create dynamic structure &lt;/P&gt;&lt;P&gt;u need to use this method CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table&lt;/P&gt;&lt;P&gt;search for it u will get sample codes for it&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But in your case if one material has say 12 entries the internal table will become very large more over it will be difficult to analyze the data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;More over Populating the data logic will become complex&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can suggest you to switch to row display for multiple display &lt;/P&gt;&lt;P&gt;keeping rest of the data same&lt;/P&gt;&lt;P&gt;this should serve the purpose as well&lt;/P&gt;&lt;P&gt;more over less efforts will be required to implement the logic&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Apr 2010 08:32:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-alv/m-p/6773230#M1463465</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-06T08:32: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/6773231#M1463466</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;First populate the Fieldcatalog with  dates in selection scree as below..&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
w_date = s_datum-low. 
  DO.
    IF w_date &amp;lt;= s_datum-high.
      w_col = w_col + 1.
      is_fieldcat-col_pos = w_col.
      WRITE w_date TO w_datum USING EDIT MASK '__/__/____'.
      is_fieldcat-fieldname = w_date.
      is_fieldcat-reptext = w_datum.
      is_fieldcat-inttype    = 'P'.
      is_fieldcat-do_sum   = c_x.
      APPEND is_fieldcat TO it_fieldcat.
      CLEAR is_fieldcat.
      w_date = w_date + 1.

    ELSE.
      EXIT.
    ENDIF.
  ENDDO.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And then create Dynamic intenal Table using below function module.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table
    EXPORTING
      it_fieldcatalog           = it_fieldcat
    IMPORTING
      ep_table                  = r_dyn_table
    EXCEPTIONS
      generate_subpool_dir_full = 1
      OTHERS                    = 2.

  IF sy-subrc &amp;lt;&amp;gt; 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

  ASSIGN r_dyn_table-&amp;gt;* TO &amp;lt;t_dyn_table&amp;gt;.

  CREATE DATA r_wa_dyn_table LIKE LINE OF &amp;lt;t_dyn_table&amp;gt;.

  ASSIGN r_wa_dyn_table-&amp;gt;* TO &amp;lt;wa_dyn_table&amp;gt;.
  ASSIGN r_wa_dyn_table-&amp;gt;* TO &amp;lt;wa_dyn_table1&amp;gt;.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After this u populate the &amp;lt;t_dyn_table&amp;gt; after that display the table using &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
    EXPORTING
      i_callback_program       = sy-repid
      i_callback_pf_status_set = 'SUB_PF_STATUS'
      i_callback_user_command  = 'SUB_USER_COMMAND'
      it_sort_lvc              = it_sort
      it_events                = it_events
      i_grid_title             = w_title
      is_layout_lvc            = is_layout
      it_fieldcat_lvc          = p_fcat
    TABLES
      t_outtab                 = &amp;lt;t_dyn_table&amp;gt;
    EXCEPTIONS
      program_error            = 1
      OTHERS                   = 2.
  IF sy-subrc &amp;lt;&amp;gt; 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Srinivas&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Srininas on Apr 6, 2010 2:03 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Apr 2010 08:33:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-alv/m-p/6773231#M1463466</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-06T08:33:02Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-alv/m-p/6773232#M1463467</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks srinivas for ur valuable inputs. I have tried to implement this logic in my program and i am stuck in populating the internal table. The table created through the fiedcat is empty. and my final table has data row wise. So please help me how to fill the internal table.&lt;/P&gt;&lt;P&gt;my coding goes like this.&lt;/P&gt;&lt;P&gt;this is how my final internal table is filled.&lt;/P&gt;&lt;P&gt;  LOOP AT gt_pbim INTO gwa_pbim.&lt;/P&gt;&lt;P&gt;    LOOP AT gt_pbed INTO gwa_pbed WHERE bdzei = gwa_pbim-bdzei.&lt;/P&gt;&lt;P&gt;      gwa_final-matnr = gwa_pbim-matnr.&lt;/P&gt;&lt;P&gt;      gwa_final-werks = gwa_pbim-werks.&lt;/P&gt;&lt;P&gt;      gwa_final-bedae = gwa_pbim-bedae.&lt;/P&gt;&lt;P&gt;      gwa_final-versb = gwa_pbim-versb.&lt;/P&gt;&lt;P&gt;      gwa_final-pbdnr = gwa_pbim-pbdnr.&lt;/P&gt;&lt;P&gt;      gwa_final-bdzei = gwa_pbim-bdzei.&lt;/P&gt;&lt;P&gt;      gwa_final-vervs = gwa_pbim-vervs.&lt;/P&gt;&lt;P&gt;      gwa_final-pdatu = gwa_pbed-pdatu.&lt;/P&gt;&lt;P&gt;      gwa_final-meins = gwa_pbed-meins.&lt;/P&gt;&lt;P&gt;      gwa_final-plnmg = gwa_pbed-plnmg.&lt;/P&gt;&lt;P&gt;      APPEND gwa_final TO gt_final.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AND NOW I NEED TO FILL &amp;lt;LT_DESTINATION&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at gt_final into gwa_final.&lt;/P&gt;&lt;P&gt;  loop at gt_fieldcat_ce112 INTO IS_FIELDCAT.&lt;/P&gt;&lt;P&gt;if IS_FIELDCAT-fieldname &amp;lt;&amp;gt; 'MATNR'&lt;/P&gt;&lt;P&gt;  AND IS_FIELDCAT-FIELDNAME &amp;lt;&amp;gt; 'WERKS' .&lt;/P&gt;&lt;P&gt;  read table gt_final into gwa_final1 with key matnr = gwa_final-matnr&lt;/P&gt;&lt;P&gt;                                               werks = gwa_final-werks&lt;/P&gt;&lt;P&gt;                                               pdatu = IS_FIELDCAT-fieldname.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    append &amp;lt;wa&amp;gt; to &amp;lt;lt_destination&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Apr 2010 07:16:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-alv/m-p/6773232#M1463467</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-07T07:16:03Z</dc:date>
    </item>
  </channel>
</rss>

