<?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: ALV Grid - Layout in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-layout/m-p/2402225#M535221</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Does anybody know the auhtorization object for this alv grid?&lt;/P&gt;&lt;P&gt;I heard that it is possible to check if somebody has the authorization to save the layout.&lt;/P&gt;&lt;P&gt;Now i am looking for the auth. and how we can implement it in the transaction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any hint is welcome...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Florian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 06 Jun 2007 11:42:44 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-06-06T11:42:44Z</dc:date>
    <item>
      <title>ALV Grid - Layout</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-layout/m-p/2402223#M535219</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;got a question regarding the selection of layout formats.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it possible to modify the alv grid layout, that no other users than the one, who created the layout can change the format?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Currently it is possible to define a layout and provide it to all users, but all the other user are able to change the columns. Is there a way to make this impossible?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Florian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jun 2007 11:06:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-layout/m-p/2402223#M535219</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-06T11:06:27Z</dc:date>
    </item>
    <item>
      <title>Re: ALV Grid - Layout</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-layout/m-p/2402224#M535220</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;chk the standard program BCALV_EDIT_05 with the same functionality&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;u have to use OO ALV .&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;sudheer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jun 2007 11:16:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-layout/m-p/2402224#M535220</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-06T11:16:27Z</dc:date>
    </item>
    <item>
      <title>Re: ALV Grid - Layout</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-layout/m-p/2402225#M535221</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Does anybody know the auhtorization object for this alv grid?&lt;/P&gt;&lt;P&gt;I heard that it is possible to check if somebody has the authorization to save the layout.&lt;/P&gt;&lt;P&gt;Now i am looking for the auth. and how we can implement it in the transaction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any hint is welcome...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Florian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jun 2007 11:42:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-layout/m-p/2402225#M535221</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-06T11:42:44Z</dc:date>
    </item>
    <item>
      <title>Re: ALV Grid - Layout</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-layout/m-p/2402226#M535222</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Florian&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The important parameter is I_SAVE of method SET_TABLE_FOR_FIRST_DISPLAY. This parameter allows the following values:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;I_SAVE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Determines the options available to the user for saving a layout:&lt;/EM&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&amp;#149; 'X': global saving only
&amp;#149; 'U': user-specific saving only
&amp;#149; 'A': corresponds to 'X' and 'U'
&amp;#149; SPACE: no saving&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you set I_SAVE = 'A' any user can maintain all global and his or her user-specific layouts.&lt;/P&gt;&lt;P&gt;If you set I_SAVE = 'U' any user can maintain only his or her user-specific layouts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you have not got a copy of &lt;SPAN __default_attr="html" __jive_macro_name="code"&gt;&amp;lt;a href="http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907"&amp;gt;An Easy Reference For ALV Grid Control&amp;lt;/a&amp;gt;&lt;/SPAN&gt; I highly recommend to read this document.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jun 2007 13:38:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-layout/m-p/2402226#M535222</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2007-06-06T13:38:28Z</dc:date>
    </item>
    <item>
      <title>Re: ALV Grid - Layout</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-layout/m-p/2402227#M535223</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Florian&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have forgotten to add my sample report. Run this report with UserA and save several global and user-specific layouts. Next run the same report with UserB and check which layouts this user can manage.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Report  ZUS_SDN_ALVGRID_EVENTS_6
*&amp;amp;
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;
*&amp;amp;

* Flow logic of screen '100' (no elements, ok-code =&amp;gt; gd_okcode ):
**PROCESS BEFORE OUTPUT.
**  MODULE STATUS_0100.
***
**PROCESS AFTER INPUT.
**  MODULE USER_COMMAND_0100.
*&amp;amp;---------------------------------------------------------------------*

REPORT  zus_sdn_alvgrid_events_6.


TYPE-POOLS: abap.


DATA:
  gd_okcode        TYPE ui_func,
*
  gt_fcat          TYPE lvc_t_fcat,
  gs_layout        TYPE lvc_s_layo,
  gs_variant       TYPE disvariant,
  go_docking       TYPE REF TO cl_gui_docking_container,
  go_grid1         TYPE REF TO cl_gui_alv_grid.


DATA:
  gt_knb1          TYPE STANDARD TABLE OF knb1.


PARAMETERS:
  p_bukrs      TYPE bukrs  DEFAULT '2000'  OBLIGATORY.



*---------------------------------------------------------------------*
*       CLASS lcl_eventhandler DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
CLASS lcl_eventhandler DEFINITION.
  PUBLIC SECTION.

    CLASS-METHODS:
      handle_user_command  FOR EVENT user_command  OF cl_gui_alv_grid
        IMPORTING
          e_ucomm
          sender.



ENDCLASS.                    "lcl_eventhandler DEFINITION


*---------------------------------------------------------------------*
*       CLASS lcl_eventhandler IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
CLASS lcl_eventhandler IMPLEMENTATION.


  METHOD handle_user_command.

    BREAK-POINT.

    CHECK ( e_ucomm = cl_gui_alv_grid=&amp;gt;mc_fc_save_variant        OR
            e_ucomm = cl_gui_alv_grid=&amp;gt;mc_fc_maintain_variant ).



  ENDMETHOD.                    "handle_user_command




ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION


START-OF-SELECTION.

  SELECT        * FROM  knb1 INTO TABLE gt_knb1
         WHERE  bukrs  = p_bukrs.



* Create docking container
  CREATE OBJECT go_docking
    EXPORTING
      parent                      = cl_gui_container=&amp;gt;screen0
      ratio                       = 90
    EXCEPTIONS
      OTHERS                      = 6.
  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.


* Create ALV grid
  CREATE OBJECT go_grid1
    EXPORTING
      i_parent          = go_docking
    EXCEPTIONS
      OTHERS            = 5.
  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.

* Set event handler
  SET HANDLER:
    lcl_eventhandler=&amp;gt;handle_user_command FOR go_grid1.


* Build fieldcatalog and set hotspot for field KUNNR
  PERFORM build_fieldcatalog_knb1.

  PERFORM set_layout_and_variant.


* Display data
  CALL METHOD go_grid1-&amp;gt;set_table_for_first_display
    EXPORTING
      is_layout       = gs_layout
      is_variant      = gs_variant
      i_save          = 'A'
    CHANGING
      it_outtab       = gt_knb1
      it_fieldcatalog = gt_fcat
    EXCEPTIONS
      OTHERS          = 4.
  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.

* NOTE:
* Documenation of I_SAVE ("An Easy Reference for ALV Grid Control")
*I_SAVE
*Determines the options available to the user for saving a layout:
*&amp;#149; 'X': global saving only
*&amp;#149; 'U': user-specific saving only
*&amp;#149; 'A': corresponds to 'X' and 'U'
*&amp;#149; SPACE: no saving



* Link the docking container to the target dynpro
  CALL METHOD go_docking-&amp;gt;link
    EXPORTING
      repid                       = syst-repid
      dynnr                       = '0100'
*      CONTAINER                   =
    EXCEPTIONS
      OTHERS                      = 4.
  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.


* ok-code field = GD_OKCODE
  CALL SCREEN '0100'.


END-OF-SELECTION.

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  STATUS_0100  OUTPUT
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
  SET PF-STATUS 'STATUS_0100'.
*  SET TITLEBAR 'xxx'.


ENDMODULE.                 " STATUS_0100  OUTPUT

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  USER_COMMAND_0100  INPUT
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.

  CASE gd_okcode.
    WHEN 'BACK' OR
         'END'  OR
         'CANC'.
      SET SCREEN 0. LEAVE SCREEN.


    WHEN OTHERS.
  ENDCASE.

  CLEAR: gd_okcode.

ENDMODULE.                 " USER_COMMAND_0100  INPUT


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  BUILD_FIELDCATALOG_KNB1
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
FORM build_fieldcatalog_knb1 .
* define local data
  DATA:
    ls_fcat        TYPE lvc_s_fcat.

  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
*     I_BUFFER_ACTIVE              =
      i_structure_name             = 'KNB1'
*     I_CLIENT_NEVER_DISPLAY       = 'X'
*     I_BYPASSING_BUFFER           =
*     I_INTERNAL_TABNAME           =
    CHANGING
      ct_fieldcat                  = gt_fcat
    EXCEPTIONS
      inconsistent_interface       = 1
      program_error                = 2
      OTHERS                       = 3.
  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.


  LOOP AT gt_fcat INTO ls_fcat
          WHERE ( fieldname = 'KUNNR'  OR
                  fieldname = 'ERNAM' ).
    ls_fcat-hotspot = abap_true.
    MODIFY gt_fcat FROM ls_fcat.
  ENDLOOP.


ENDFORM.                    " BUILD_FIELDCATALOG_KNB1


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  SET_LAYOUT_AND_VARIANT
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
FORM set_layout_and_variant .

  CLEAR: gs_layout,
         gs_variant.

  gs_layout-cwidth_opt = abap_true.
  gs_layout-zebra      = abap_true.

  gs_variant-report = syst-repid.
  gs_variant-handle = 'GRID'.

ENDFORM.                    " SET_LAYOUT_AND_VARIANT&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jun 2007 13:42:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-layout/m-p/2402227#M535223</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2007-06-06T13:42:38Z</dc:date>
    </item>
  </channel>
</rss>

