<?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 Need pushbutton in ALV in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-pushbutton-in-alv/m-p/2250012#M486209</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Friends,&lt;/P&gt;&lt;P&gt;I need to put a pushbutton in ALV List's every row. And then when user click this button, I will get the selected line of list. My application server is 4.6 and I want to implement this using the function call of CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY', not using object oriented programming. How can I put button in alv list and get the selected line when button is clicked?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 28 May 2007 15:05:58 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-05-28T15:05:58Z</dc:date>
    <item>
      <title>Need pushbutton in ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-pushbutton-in-alv/m-p/2250012#M486209</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Friends,&lt;/P&gt;&lt;P&gt;I need to put a pushbutton in ALV List's every row. And then when user click this button, I will get the selected line of list. My application server is 4.6 and I want to implement this using the function call of CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY', not using object oriented programming. How can I put button in alv list and get the selected line when button is clicked?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 May 2007 15:05:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-pushbutton-in-alv/m-p/2250012#M486209</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-28T15:05:58Z</dc:date>
    </item>
    <item>
      <title>Re: Need pushbutton in ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-pushbutton-in-alv/m-p/2250013#M486210</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="50398"&gt;&lt;/A&gt; -- For button on toolbar.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;FIEDLCATALOG-STYLE&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;STYLE&lt;/P&gt;&lt;P&gt;Displays all cells of this column with a style e.g. as pushbuttons. Constants &amp;#147;MC_STYLE&amp;#133;&amp;#148; for button on a column&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 May 2007 15:08:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-pushbutton-in-alv/m-p/2250013#M486210</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-28T15:08:39Z</dc:date>
    </item>
    <item>
      <title>Re: Need pushbutton in ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-pushbutton-in-alv/m-p/2250014#M486211</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Refer to this related thread&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="221326"&gt;&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 May 2007 15:09:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-pushbutton-in-alv/m-p/2250014#M486211</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-28T15:09:45Z</dc:date>
    </item>
    <item>
      <title>Re: Need pushbutton in ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-pushbutton-in-alv/m-p/2250015#M486212</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;You can show a field as ICON and assign the HOTSPOT option to it.&lt;/P&gt;&lt;P&gt;In this way the field should behave itself like a push button.&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;Ferry Lianto&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 May 2007 15:13:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-pushbutton-in-alv/m-p/2250015#M486212</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-28T15:13:44Z</dc:date>
    </item>
    <item>
      <title>Re: Need pushbutton in ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-pushbutton-in-alv/m-p/2250016#M486213</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;How can I put icon in ALV's one column under app. server 4.6?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 May 2007 13:51:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-pushbutton-in-alv/m-p/2250016#M486213</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-29T13:51:51Z</dc:date>
    </item>
    <item>
      <title>Re: Need pushbutton in ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-pushbutton-in-alv/m-p/2250017#M486214</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;U can not do it by 'Reuse_alv*'. You have to use class for that. Here is the example: I have created a pushbutton 'Download file'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;report  z_82235_alv_oops_pustbutton             .

tables: mara.

types: begin of t_mara,
         matnr type matnr,
         mtart type mtart,
         matkl type matkl,
         meins type meins,
       end of t_mara.

data: gt_mara type standard table of t_mara,
      gs_mara like line of gt_mara.

class lcl_event_receiver definition deferred.

*-- Global Data defenation for ALV

*---Alv Grid instance referance
data : gr_alvgrid type ref to cl_gui_alv_grid,
       event_receiver type ref to lcl_event_receiver.

*---Name of the custom control added on the screen
data gc_custom_control_name type scrfname value 'CC_ALV'
.
*---Custom container instance referance
data: gr_ccontainer type ref to cl_gui_custom_container.

*---Field catalog table
data: gt_fieldcat type lvc_t_fcat,
      gs_fieldcat type lvc_s_fcat.

*---Layout structure
data: gs_layout type lvc_s_layo.

data: g_repid like sy-repid.

select matnr
       mtart
       matkl
       meins
       from mara into table gt_mara
       up to 25 rows.

g_repid = sy-repid.


include &amp;lt;icon&amp;gt;.
*********
* Predefine a local class for event handling to allow the
* declaration of a reference variable before the class is defined.


*
*********

* Set initial dynpro
set screen 100.

****************************************************************
* LOCAL CLASSES: Definition
****************************************************************
*===============================================================
* class lcl_event_receiver: local class to
*                         define and handle own functions.
*
* Definition:
* ~~~~~~~~~~~
class lcl_event_receiver definition.

  public section.

    methods:
    handle_toolbar
        for event toolbar of cl_gui_alv_grid
            importing e_object e_interactive,

    handle_user_command
        for event user_command of cl_gui_alv_grid
            importing e_ucomm.

  private section.

endclass.
*
* lcl_event_receiver (Definition)
*===============================================================

****************************************************************
* LOCAL CLASSES: Implementation
****************************************************************
*===============================================================
* class lcl_event_receiver (Implementation)
*
*
class lcl_event_receiver implementation.

  method handle_toolbar.
* § 2.In event handler method for event TOOLBAR: Append own functions
*   by using event parameter E_OBJECT.
    data: ls_toolbar  type stb_button.
*....................................................................
* E_OBJECT of event TOOLBAR is of type REF TO CL_ALV_EVENT_TOOLBAR_SET.
* This class has got one attribute, namly MT_TOOLBAR, which
* is a table of type TTB_BUTTON. One line of this table is
* defined by the Structure STB_BUTTON (see data deklaration above).
*

* A remark to the flag E_INTERACTIVE:
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*         'e_interactive' is set, if this event is raised due to
*         the call of 'set_toolbar_interactive' by the user.
*         You can distinguish this way if the event was raised
*         by yourself or by ALV
*         (e.g. in method 'refresh_table_display').
*         An application of this feature is still unknown... :-)

* append a separator to normal toolbar
    clear ls_toolbar.
    move 3 to ls_toolbar-butn_type.
    append ls_toolbar to e_object-&amp;gt;mt_toolbar.
* append an icon to download
    clear ls_toolbar.
    ls_toolbar-function = 'DOWN'.
    ls_toolbar-icon = 'icon_generate'.
    ls_toolbar-quickinfo = 'DOWNLOAD FILE'.
    ls_toolbar-text = 'DOWNLOAD FILE'.

*    MOVE ' ' TO ls_toolbar-disabled.
    append ls_toolbar to e_object-&amp;gt;mt_toolbar.

  endmethod.
*-------------------------------------------------------------------
  method handle_user_command.
* § 3.In event handler method for event USER_COMMAND: Query your
*   function codes defined in step 2 and react accordingly.

    data: lt_rows type lvc_t_row.

    case e_ucomm.
      when 'DOWN'.

      call function 'GUI_DOWNLOAD'
        exporting
*         BIN_FILESIZE                  =
          filename                      = 'D:a.txt'
*         FILETYPE                      = 'ASC'
*         APPEND                        = ' '
*         WRITE_FIELD_SEPARATOR         = ' '
*         HEADER                        = '00'
        tables
          data_tab                      = gt_mara
       exceptions
         file_write_error              = 1
         no_batch                      = 2
         gui_refuse_filetransfer       = 3
         invalid_type                  = 4
         no_authority                  = 5
         unknown_error                 = 6
         header_not_allowed            = 7
         separator_not_allowed         = 8
         filesize_not_allowed          = 9
         header_too_long               = 10
         dp_error_create               = 11
         dp_error_send                 = 12
         dp_error_write                = 13
         unknown_dp_error              = 14
         access_denied                 = 15
         dp_out_of_memory              = 16
         disk_full                     = 17
         dp_timeout                    = 18
         file_not_found                = 19
         dataprovider_exception        = 20
         control_flush_error           = 21
         others                        = 22
                .
      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.




   endcase.
  endmethod.                           "handle_user_command
*-----------------------------------------------------------------
endclass.
*
* lcl_event_receiver (Implementation)
*===================================================================





*--------------------------------------------------------------------
* S T A R T - O F - S E L E C T I O N.
*--------------------------------------------------------------------
start-of-selection.
  set screen '100'.


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  display_alv  OUTPUT
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module display_alv output.

  if gr_alvgrid is initial.

*---Creating custom container instance
    create object gr_ccontainer
      exporting
        container_name              = gc_custom_control_name
      exceptions
        cntl_error                  = 1
        cntl_system_error           = 2
        create_error                = 3
        lifetime_error              = 4
        lifetime_dynpro_dynpro_link = 5
        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.


*---Creating ALV gris instance
    create object gr_alvgrid
      exporting
        i_parent          = gr_ccontainer
        i_appl_events     = 'X'
      exceptions
        error_cntl_create = 1
        error_cntl_init   = 2
        error_cntl_link   = 3
        error_dp_create   = 4
        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.

*---Prepare field catalog
    perform prepare_field_catalog tables gt_fieldcat.

*---Prepare layout
    perform prepare_layout changing gs_layout.


*---Call ALV grid
    call method gr_alvgrid-&amp;gt;set_table_for_first_display
      exporting
*    I_BUFFER_ACTIVE               =
*    I_BYPASSING_BUFFER            =
*    I_CONSISTENCY_CHECK           =
*    I_STRUCTURE_NAME              =
*    IS_VARIANT                    =
*    I_SAVE                        =
*    I_DEFAULT                     = 'X'
        is_layout                     = gs_layout
*    IS_PRINT                      =
*    IT_SPECIAL_GROUPS             =
*    IT_TOOLBAR_EXCLUDING          =
*    IT_HYPERLINK                  =
*    IT_ALV_GRAPHICS               =
*    IT_EXCEPT_QINFO               =
      changing
        it_outtab                     = gt_mara[]
        it_fieldcatalog               = gt_fieldcat
*    IT_SORT                       =
*    IT_FILTER                     =
      exceptions
        invalid_parameter_combination = 1
        program_error                 = 2
        too_many_lines                = 3
        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.




********
* -&amp;gt;Create Object to receive events and link them to handler methods.
* When the ALV Control raises the event for the specified instance
* the corresponding method is automatically called.
*
    create object event_receiver.
    set handler event_receiver-&amp;gt;handle_user_command for gr_alvgrid.
    set handler event_receiver-&amp;gt;handle_toolbar for gr_alvgrid.
*
********

* § 4.Call method 'set_toolbar_interactive' to raise event TOOLBAR.
    call method gr_alvgrid-&amp;gt;set_toolbar_interactive.

*  endif.                               "IF grid1 IS INITIAL
*  call method cl_gui_control=&amp;gt;set_focus exporting control = gr_alvgrid.

*--- the instance is present
  else .

    call method gr_alvgrid-&amp;gt;refresh_table_display
*      EXPORTING
*        IS_STABLE      =
*        I_SOFT_REFRESH =
      exceptions
        finished       = 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.


  endif.

endmodule.                 " display_alv  OUTPUT

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  prepare_field_catalog
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      &amp;lt;--P_GT_FIELDCAT  text
*----------------------------------------------------------------------*
form prepare_field_catalog  tables gt_fieldcat.

  clear : gs_fieldcat.
  gs_fieldcat-fieldname = 'MATNR'.
  gs_fieldcat-col_pos   = 1.
  gs_fieldcat-emphasize = 'X'.
  gs_fieldcat-outputlen = 10.
  gs_fieldcat-coltext   = 'Material No'.
  gs_fieldcat-edit      = 'X'.
  append gs_fieldcat to gt_fieldcat.

  clear : gs_fieldcat.
  gs_fieldcat-fieldname = 'MTART'.
  gs_fieldcat-col_pos   = 2.
  gs_fieldcat-outputlen = 6.
  gs_fieldcat-coltext   = 'Material Type'.
  append gs_fieldcat to gt_fieldcat.

  clear : gs_fieldcat.
  gs_fieldcat-fieldname = 'MATKL'.
  gs_fieldcat-col_pos   = 3.
  gs_fieldcat-outputlen = 5.
  gs_fieldcat-coltext   = 'Material Grp'.
  append gs_fieldcat to gt_fieldcat.


  clear : gs_fieldcat.
  gs_fieldcat-fieldname = 'MEINS'.
  gs_fieldcat-col_pos   = 4.
  gs_fieldcat-outputlen = 4.
  gs_fieldcat-coltext   = 'Unit'.
  append gs_fieldcat to gt_fieldcat.





endform.                    " prepare_field_catalog

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  prepare_layout
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      &amp;lt;--P_GS_LAYOUT  text
*----------------------------------------------------------------------*
form prepare_layout  changing p_gs_layout type lvc_s_layo.

  p_gs_layout-zebra = 'X'.
  p_gs_layout-grid_title = 'Material'.
  p_gs_layout-smalltitle = 'X'.


endform.                    " prepare_layout
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  STATUS_0100  OUTPUT
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module status_0100 output.
  set pf-status 'STATUS1'.
*  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 sy-ucomm.

    when 'BACK' or 'UP' or 'CANCEL'.
      leave program.

        when '&amp;amp;DETAIL'.
      leave program.

  endcase.


endmodule.                 " USER_COMMAND_0100  INPUT&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 May 2007 14:04:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-pushbutton-in-alv/m-p/2250017#M486214</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-29T14:04:52Z</dc:date>
    </item>
    <item>
      <title>Re: Need pushbutton in ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-pushbutton-in-alv/m-p/2250018#M486215</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;It not true when Abhishek Sarkar say "U can not do it by 'Reuse_alv"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- but his solution can also work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jun 2007 08:44:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-pushbutton-in-alv/m-p/2250018#M486215</guid>
      <dc:creator>TMNielsen</dc:creator>
      <dc:date>2007-06-26T08:44:26Z</dc:date>
    </item>
  </channel>
</rss>

