<?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 columns adding in alv in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-columns-adding-in-alv/m-p/5740248#M1301484</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;put all fields in your final internal table.&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;u can create the field catalog dynamically.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and as per the field catalog dynamic columns will be displayed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 26 May 2009 07:17:37 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-05-26T07:17:37Z</dc:date>
    <item>
      <title>dynamic columns adding in alv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-columns-adding-in-alv/m-p/5740247#M1301483</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have an existing  ZALV report whic is developed by Function modules (not the OO -ALV).&lt;/P&gt;&lt;P&gt;now i have to add few dynamic columns to the existing report. is it possible to add in the existing report?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have searched in SDN, i have few with oo-alv, if possible to with function modules , can any one send me a sample code?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Vimala&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 May 2009 07:15:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-columns-adding-in-alv/m-p/5740247#M1301483</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-26T07:15:48Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic columns adding in alv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-columns-adding-in-alv/m-p/5740248#M1301484</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;put all fields in your final internal table.&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;u can create the field catalog dynamically.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and as per the field catalog dynamic columns will be displayed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 May 2009 07:17:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-columns-adding-in-alv/m-p/5740248#M1301484</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-26T07:17:37Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic columns adding in alv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-columns-adding-in-alv/m-p/5740249#M1301485</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We can do it using normal ALV.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use this FM  &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;First we need to find out the total number of columns.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Keep the loop to the number of columsn and create one fieldcatalog.&lt;/P&gt;&lt;P&gt;Pass that field catalog to the call function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Refer this link.&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.sdn.sap.com/irj/scn/directforumsearch?threadid=&amp;amp;q=dynamic" target="test_blank"&gt;https://www.sdn.sap.com/irj/scn/directforumsearch?threadid=&amp;amp;q=dynamic&lt;/A&gt;&lt;EM&gt;AND&lt;/EM&gt;internal&lt;EM&gt;AND&lt;/EM&gt;table&amp;amp;objID=f50&amp;amp;dateRange=all&amp;amp;numResults=15&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 May 2009 07:22:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-columns-adding-in-alv/m-p/5740249#M1301485</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-26T07:22:07Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic columns adding in alv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-columns-adding-in-alv/m-p/5740250#M1301486</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Please find the below code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;type-pools: slis.                    " ALV Global Types*data declaration for dynamic internal table and alv&lt;/P&gt;&lt;P&gt;DATA:     l_structure   TYPE REF TO data,&lt;/P&gt;&lt;P&gt;          l_table    TYPE REF TO data,&lt;/P&gt;&lt;P&gt;          struc_desc   TYPE REF TO cl_abap_structdescr,&lt;/P&gt;&lt;P&gt;          lt_layout   TYPE slis_layout_alv,&lt;/P&gt;&lt;P&gt;          ls_lvc_fieldcatalogue  TYPE lvc_s_fcat,&lt;/P&gt;&lt;P&gt;          lt_lvc_fieldcatalogue  TYPE lvc_t_fcat,&lt;/P&gt;&lt;P&gt;          ls_fieldcatalogue TYPE slis_fieldcat_alv,&lt;/P&gt;&lt;P&gt;          lt_fieldcatalogue TYPE slis_t_fieldcat_alv.&lt;/P&gt;&lt;P&gt;*field symbols declaration&lt;/P&gt;&lt;P&gt;field-symbols :&lt;/P&gt;&lt;P&gt;&amp;lt;it_table&amp;gt;    type standard table,&lt;/P&gt;&lt;P&gt;&amp;lt;dyn_str&amp;gt;         type any,&lt;/P&gt;&lt;P&gt;&amp;lt;str_comp&amp;gt; type abap_compdescr.&lt;/P&gt;&lt;P&gt;*declarations for grid title&lt;/P&gt;&lt;P&gt;data : t1(30),&lt;/P&gt;&lt;P&gt;t2(10),&lt;/P&gt;&lt;P&gt;t3(50).&lt;/P&gt;&lt;P&gt;*selection screen declaration for table input&lt;/P&gt;&lt;P&gt;parameters : p_table like dd02l-tabname.&lt;/P&gt;&lt;P&gt;*initialization event&lt;/P&gt;&lt;P&gt;initialization.&lt;/P&gt;&lt;P&gt;*start of selection event&lt;/P&gt;&lt;P&gt;start-of-selection.&lt;/P&gt;&lt;P&gt;*texts for grid title&lt;/P&gt;&lt;P&gt;t1 = 'Dynamic ALV display for table'.&lt;/P&gt;&lt;P&gt;t2 = p_table.  CONCATENATE t1 t2 INTO t3 SEPARATED BY space.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;dynamic creation of a structure&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;create data l_structure type (p_table).&lt;/P&gt;&lt;P&gt;ASSIGN l_structure-&amp;gt;* TO &amp;lt;dyn_str&amp;gt;.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;fields structure&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;struc_desc ?= cl_abap_typedescr=&amp;gt;describe_by_data( &amp;lt;dyn_str&amp;gt; ).&lt;/P&gt;&lt;P&gt;LOOP AT struc_desc-&amp;gt;components ASSIGNING &amp;lt;str_comp&amp;gt;.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Build Fieldcatalog&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  ls_lvc_fieldcatalogue-fieldname = &amp;lt;str_comp&amp;gt;-name.&lt;/P&gt;&lt;P&gt;  ls_lvc_fieldcatalogue-ref_table = p_table.&lt;/P&gt;&lt;P&gt;  APPEND ls_lvc_fieldcatalogue TO lt_lvc_fieldcatalogue.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Build Fieldcatalog&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  ls_fieldcatalogue-fieldname = &amp;lt;str_comp&amp;gt;-name.&lt;/P&gt;&lt;P&gt;  ls_fieldcatalogue-ref_tabname = p_table.&lt;/P&gt;&lt;P&gt;  APPEND ls_fieldcatalogue TO lt_fieldcatalogue.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create internal table dynamic&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 = lt_lvc_fieldcatalogue&lt;/P&gt;&lt;P&gt;  IMPORTING&lt;/P&gt;&lt;P&gt;    ep_table        = l_table.&lt;/P&gt;&lt;P&gt;ASSIGN l_table-&amp;gt;* TO &amp;lt;it_table&amp;gt;.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Read data from the table selected.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt; SELECT * FROM (P_TABLE)&lt;/P&gt;&lt;P&gt;into corresponding fields of table &amp;lt;it_table&amp;gt;.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;ALV Layout&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;lt_layout-zebra = 'X'.&lt;/P&gt;&lt;P&gt;lt_layout-colwidth_optimize = 'X'.&lt;/P&gt;&lt;P&gt;lt_layout-window_titlebar = t3.&lt;/P&gt;&lt;P&gt;*ALV  output&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;    is_layout     = lt_layout&lt;/P&gt;&lt;P&gt;    it_fieldcat   = lt_fieldcatalogue&lt;/P&gt;&lt;P&gt;  TABLES&lt;/P&gt;&lt;P&gt;    t_outtab      = &amp;lt;it_table&amp;gt;&lt;/P&gt;&lt;P&gt;  EXCEPTIONS&lt;/P&gt;&lt;P&gt;    program_error = 1&lt;/P&gt;&lt;P&gt;    OTHERS        = 2.&lt;/P&gt;&lt;P&gt;IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 May 2009 07:32:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-columns-adding-in-alv/m-p/5740250#M1301486</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-26T07:32:42Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic columns adding in alv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-columns-adding-in-alv/m-p/5740251#M1301487</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;While defining the Field Catalog mention things as shown below: And add all the fields to the internal table whichever you want to display..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CLEAR g_t_fcat.&lt;/P&gt;&lt;P&gt;  g_t_fcat-fieldname = 'FLD_1'.                  &lt;/P&gt;&lt;P&gt;  g_t_fcat-tabname   = 'G_T_DATA'.&lt;/P&gt;&lt;P&gt;  g_t_fcat-seltext_l = 'Field 1'.                              &lt;/P&gt;&lt;P&gt;  APPEND g_t_fcat TO g_t_fcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CLEAR g_t_fcat.&lt;/P&gt;&lt;P&gt;  g_t_fcat-fieldname = 'FLD_2'.                       &lt;/P&gt;&lt;P&gt;  g_t_fcat-tabname   = 'G_T_DATA'.&lt;/P&gt;&lt;P&gt;  g_t_fcat-seltext_l = 'Field 2'.                        &lt;/P&gt;&lt;P&gt;  g_t_fcat-no_out    = 'X'.&lt;/P&gt;&lt;P&gt;  APPEND g_t_fcat TO g_t_fcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;no_out field stands for not to be displayed on ALV on first go.. &lt;/P&gt;&lt;P&gt;then once u display ALV for basic fields and you want to add the new fields to ALV use the button 'Change Layout' To dynamically change the layout of ALV...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kanchan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 May 2009 08:00:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-columns-adding-in-alv/m-p/5740251#M1301487</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-26T08:00:09Z</dc:date>
    </item>
    <item>
      <title>Re: dynamic columns adding in alv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-columns-adding-in-alv/m-p/5740252#M1301488</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Generally use the grid display since, sometimes the list display FM gives error&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*    CREATE THE DYNAMIC INTERNAL TABLE
  data: NEW_TABLE type ref to DATA,
        NEW_LINE type ref to DATA.


  clear WA_FLDCAT.
  WA_FLDCAT-FIELDNAME   = 'CUOBJ_BM'.
  WA_FLDCAT-DATATYPE    = 'CHAR'.
  WA_FLDCAT-INTLEN      = 18.
  WA_FLDCAT-DD_OUTLEN   = 18.
  WA_FLDCAT-SELTEXT     = 'Int.obj.no'.
  append WA_FLDCAT to IT_FLDCAT .


*    CREATE DYNAMIC INTERNAL TABLE AND ASSIGN TO FS
  call method CL_ALV_TABLE_CREATE=&amp;gt;CREATE_DYNAMIC_TABLE
    exporting
      IT_FIELDCATALOG = IT_FLDCAT
    importing
      EP_TABLE        = NEW_TABLE.

  assign NEW_TABLE-&amp;gt;* to &amp;lt;DYN_TABLE&amp;gt;.

*    CREATE DYNAMIC WORK AREA AND ASSIGN TO FS
  create data NEW_LINE like line of &amp;lt;DYN_TABLE&amp;gt;.
  assign NEW_LINE-&amp;gt;* to &amp;lt;DYN_WA&amp;gt;.



* filling the dynamic internal table
   assign component 'VAL_CODE' of structure &amp;lt;DYN_WA&amp;gt; to &amp;lt;FS1&amp;gt;.
    &amp;lt;FS1&amp;gt; = WA_BTCH_VALUATION_SUMM-VAL_CODE.
append &amp;lt;DYN_WA&amp;gt; to &amp;lt;DYN_TABLE&amp;gt;.

displaying the dynamic ALV

  loop at IT_FLDCAT1 into WA_FLDCAT1.
    FIELDCAT_LN-FIELDNAME = WA_FLDCAT1-FIELDNAME.
    FIELDCAT_LN-SELTEXT_M = WA_FLDCAT1-SELTEXT.
    FIELDCAT_LN-SELTEXT_L = WA_FLDCAT1-SCRTEXT_L.
    FIELDCAT_LN-OUTPUTLEN = WA_FLDCAT1-DD_OUTLEN.
    FIELDCAT_LN-DDICTXT = 'L'.
    append FIELDCAT_LN to FIELDCAT.
  endloop.

  call function 'REUSE_ALV_GRID_DISPLAY'
    exporting
      I_CALLBACK_PROGRAM      = V_REPID
      I_CALLBACK_TOP_OF_PAGE  = 'TOP_OF_PAGE'
      I_CALLBACK_USER_COMMAND = 'USER_COMMAND_1'
      IS_LAYOUT               = GS_LAYOUT_DTL
      I_GRID_TITLE            = I_TITLE_DETAILS
      IT_FIELDCAT             = FIELDCAT
      I_SAVE                  = 'A'
      IS_PRINT                = GS_PRINT
    tables
      T_OUTTAB                = &amp;lt;DYN_TABLE&amp;gt;
    exceptions
      PROGRAM_ERROR           = 1
      others                  = 2.



&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 May 2009 08:21:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-columns-adding-in-alv/m-p/5740252#M1301488</guid>
      <dc:creator>Madhurivs23</dc:creator>
      <dc:date>2009-05-26T08:21:27Z</dc:date>
    </item>
  </channel>
</rss>

