<?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: Does method CL_GUI_ALV_GRID-&amp;gt;SET_VARIANT work? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/does-method-cl-gui-alv-grid-gt-set-variant-work/m-p/362227#M7728</link>
    <description>&lt;P&gt;Did you also call grid-&amp;gt;refresh_table_display, also consider refreshing layout/field catalog before setting variant.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;    call method grid-&amp;gt;set_frontend_fieldcatalog
      exporting it_fieldcatalog = gt_fieldcat.
    call method grid-&amp;gt;set_frontend_layout
      exporting is_layout = g_layout.
    call method grid-&amp;gt;set_variant
      exporting is_variant = g_variant.
    call method grid-&amp;gt;refresh_table_display
      exporting
        is_stable      = stable
        i_soft_refresh = 'X'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Raymond&lt;/P&gt;</description>
    <pubDate>Fri, 14 Oct 2016 11:15:44 GMT</pubDate>
    <dc:creator>RaymondGiuseppi</dc:creator>
    <dc:date>2016-10-14T11:15:44Z</dc:date>
    <item>
      <title>Does method CL_GUI_ALV_GRID-&gt;SET_VARIANT work?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/does-method-cl-gui-alv-grid-gt-set-variant-work/m-p/362226#M7727</link>
      <description>&lt;P&gt;Dear fellow ABAP developers,&lt;/P&gt;&lt;P&gt;I am using CL_GUI_ALV_GRID to create an editable ALV grid.&lt;/P&gt;&lt;P&gt;Now, I have been asked to set a specific ALV variant (created by us before delivering this report) once the user clicks a button that I added to the toolbar.&lt;BR /&gt;I know there is standard functionality to do so (through the usual button for Chosing/Chaging/Saving/Managing Layouts), but the fact is that the button will not only set the different layout, but also set some filters (which I successfully achieved already).&lt;/P&gt;&lt;P&gt;I have seen that method CL_GUI_ALV_GRID-&amp;gt;SET_VARIANT exists. I tried to use it, to achieve my result, but calling the method did not work: the layout of the ALV grid stayed the same as before.&lt;/P&gt;&lt;P&gt;In order to be sure 100% to use a correct disvariant structure, I selected (using "INTO CORRESPONDING FIELDS) from table LTDX. Still, no result. I checked the code and actually the method is only changing value of  m_cl_variant-&amp;gt;ms_variant. &lt;BR /&gt;This is a public attribute of class CL_ALV_VARIANT, which is the type of object m_cl_variant. Unluckily, this object is private, so I cannot try to do to much with that. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Since nothing else was performed by that method, I tried also to call method CL_GUI_ALV_GRID-&amp;gt;REFRESH_TABLE_DISPLAY afterwards, but still no results. I tried both a soft and a hard refresh.&lt;/P&gt;&lt;P&gt;In the end, I managed to do what I wanted by deleting and recreating the entire grid. But I feel this is not correct  and it might raise other kind of issues.&lt;/P&gt;&lt;P&gt;So, does anybody know how to use method CL_GUI_ALV_GRID-&amp;gt;SET_VARIANT?&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2016 08:56:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/does-method-cl-gui-alv-grid-gt-set-variant-work/m-p/362226#M7727</guid>
      <dc:creator>AlbertoR</dc:creator>
      <dc:date>2016-10-14T08:56:48Z</dc:date>
    </item>
    <item>
      <title>Re: Does method CL_GUI_ALV_GRID-&gt;SET_VARIANT work?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/does-method-cl-gui-alv-grid-gt-set-variant-work/m-p/362227#M7728</link>
      <description>&lt;P&gt;Did you also call grid-&amp;gt;refresh_table_display, also consider refreshing layout/field catalog before setting variant.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;    call method grid-&amp;gt;set_frontend_fieldcatalog
      exporting it_fieldcatalog = gt_fieldcat.
    call method grid-&amp;gt;set_frontend_layout
      exporting is_layout = g_layout.
    call method grid-&amp;gt;set_variant
      exporting is_variant = g_variant.
    call method grid-&amp;gt;refresh_table_display
      exporting
        is_stable      = stable
        i_soft_refresh = 'X'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Raymond&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2016 11:15:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/does-method-cl-gui-alv-grid-gt-set-variant-work/m-p/362227#M7728</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2016-10-14T11:15:44Z</dc:date>
    </item>
    <item>
      <title>Re: Does method CL_GUI_ALV_GRID-&gt;SET_VARIANT work?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/does-method-cl-gui-alv-grid-gt-set-variant-work/m-p/362228#M7729</link>
      <description>&lt;P&gt;And also method SET_FILTER_CRITERIA.&lt;/P&gt;&lt;P&gt;The characteristics of the ALV layout variant (field catalog, filter, general attributes) can be loaded and retrieved via CL_ALV_VARIANT for instance. &lt;/P&gt;&lt;P&gt;I guess it would work even without using SET_VARIANT. It just gives a name to the current ALV layout variant, so I guess it's useful only in case the user wants to save the layout under that variant name.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2016 12:27:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/does-method-cl-gui-alv-grid-gt-set-variant-work/m-p/362228#M7729</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2016-10-14T12:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: Does method CL_GUI_ALV_GRID-&gt;SET_VARIANT work?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/does-method-cl-gui-alv-grid-gt-set-variant-work/m-p/362229#M7730</link>
      <description>&lt;P&gt;Hi, Raymond and Sandra, thank you very much for your answers.&lt;BR /&gt;I tried the above, but it did not work, unluckily.&lt;/P&gt;&lt;P&gt;I don't know why: perhaps I make something wrong somewhere else in my code.&lt;BR /&gt;Unluckily I cannot spend further time on this single aspect of the project, so even if I really would like to make things much more beautiful I will have to stuck to the "ugly but works" way, which is deleting and re-creating the ALV grid object each time.&lt;/P&gt;&lt;P&gt;If I'll have some time later I will come back to this and try to test further, but for the time being I surrender &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Once more, thank you for your help!&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Alberto&lt;/P&gt;</description>
      <pubDate>Mon, 17 Oct 2016 07:56:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/does-method-cl-gui-alv-grid-gt-set-variant-work/m-p/362229#M7730</guid>
      <dc:creator>AlbertoR</dc:creator>
      <dc:date>2016-10-17T07:56:43Z</dc:date>
    </item>
  </channel>
</rss>

