How to add a push button on an ALV grid  ?

Hi,
How to add a push button on an ALV grid, using ON_TOOLBAR, ON_USERCOMMAND Methods. Clicking on that push button, a new screen has to be displayed.

Hi,
        Assuming that you want to have a "push-button" column, i.e. push-buttons within an ALV grid then you need to implement the following steps:
(1) Set the style of the column as button
  ls_fcat-style = CL_GUI_ALV_GRID => MC_STYLE_BUTTON.
(2) When the user pushes the button event BUTTON_CLICK is triggered. Thus, define an appropriate event handler method.
<b>Reward points</b>
Regards

Similar Messages

  • How to add the REFRESH button in OOPs ALV grid

    how to add the REFRESH button in OOPs ALV grid

    Hi Naidu.
    Check the below code:
    Local Class Definition and implementation For events handeling
    CLASS LCL_EVENT DEFINITION .
      PUBLIC SECTION.
        METHODS :TOOLBAR FOR EVENT TOOLBAR OF  CL_GUI_ALV_GRID
                         IMPORTING E_OBJECT,
                 USER_COMMAND FOR EVENT USER_COMMAND OF CL_GUI_ALV_GRID
                         IMPORTING E_UCOMM.
    ENDCLASS.    
    CLASS LCL_EVENT IMPLEMENTATION.
      METHOD TOOLBAR.
        WA_TOOL-FUNCTION = 'ZFC1'.
        WA_TOOL-TEXT     = 'TEST'.
        WA_TOOL-ICON     = '@EA@'.
        APPEND WA_TOOL TO E_OBJECT->MT_TOOLBAR.
      ENDMETHOD.             "DISPLAY
      METHOD USER_COMMAND.
        IF E_UCOMM = 'ZFC1'.
              ENDIF.
      ENDMETHOD.                    "USER_COMMAND
    ENDCLASS.                    "LCL_EVENT IMPLEMENTATION
    MODULE STATUS_0200 OUTPUT.
      SET PF-STATUS 'ZALV_BTON'.
      SELECT * FROM VBAK INTO TABLE GT_VBAK
               UP TO 30 ROWS.
    **** CREATE CONTAINER OBJECT
      CREATE OBJECT MY_CONTAINER
        EXPORTING
          CONTAINER_NAME              = 'CC1'
         EXCEPTIONS
          CNTL_ERROR                  = 1
          CNTL_SYSTEM_ERROR           = 2
          CREATE_ERROR                = 3
          LIFETIME_ERROR              = 4
          LIFETIME_DYNPRO_DYNPRO_LINK = 5
          OTHERS                      = 6 .
    ****** GRID TO CONTAINER
      CREATE OBJECT ALV
          EXPORTING
          I_PARENT          = MY_CONTAINER
         EXCEPTIONS
          ERROR_CNTL_CREATE = 1
          ERROR_CNTL_INIT   = 2
          ERROR_CNTL_LINK   = 3
          ERROR_DP_CREATE   = 4
          OTHERS            = 5.
      CREATE OBJECT OBJ.
      SET HANDLER : OBJ->TOOLBAR FOR ALV.
      SET HANDLER : OBJ->USER_COMMAND FOR ALV.
    ****** ALV DISPLAY
      CALL METHOD ALV->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
          I_STRUCTURE_NAME              = 'VBAK'
        CHANGING
          IT_OUTTAB                     = GT_VBAK[]
        EXCEPTIONS
          INVALID_PARAMETER_COMBINATION = 1
          PROGRAM_ERROR                 = 2
          TOO_MANY_LINES                = 3
          OTHERS                        = 4.
    ENDMODULE.                 " STATUS_0200  OUTPUT
    *&      Module  USER_COMMAND_0200  INPUT
    *       text
    MODULE USER_COMMAND_0200 INPUT.
      IF SY-UCOMM EQ 'BACK'.
        LEAVE PROGRAM.
      ENDIF.
    ENDMODULE.                 " USER_COMMAND_0200  INPUT
    Regards
    Kumar M

  • Can we disable the default push buttons on the ALV Grid

    Hi,
        Can we disable the default push buttons on the ALV
    Grid Control...
        If so, pls send me the procedure...
    thanks and regards
       raghu

    Hi,
    In the PBO:
      PERFORM f9100_exclude_functions USING :
                             i_exclude[]  '&CHECK',
                             i_exclude[]  '&REFRESH',
                             i_exclude[]  '&LOCAL&CUT' ,
                             i_exclude[]  '&LOCAL&COPY',
                             i_exclude[]  '&LOCAL&PASTE',
                             i_exclude[]  '&LOCAL&PASTE_NEW_ROW',
                             i_exclude[]  '&LOCAL&UNDO' ,
                             i_exclude[]  '&LOCAL&APPEND',
                             i_exclude[]  '&LOCAL&INSERT_ROW',
                             i_exclude[]  '&LOCAL&DELETE_ROW',
                             i_exclude[]  '&SORT_ASC',
                             i_exclude[]  '&SORT_DSC',
                             i_exclude[]  '&FIND',
                             i_exclude[]  '&SUMC',
                             i_exclude[]  '&SUBTOT',
                             i_exclude[]  '&MINIMUM',
                             i_exclude[]  '&MAXIMUM' ,
                             i_exclude[]  '&VGRID' ,
                             i_exclude[]  '&VEXCEL' ,
                             i_exclude[]  '&VCRYSTAL',
                             i_exclude[]  '&HTML',
                             i_exclude[]  '&MAINTAIN',
                             i_exclude[]  '&SAVE',
                             i_exclude[]  '&GRAPH',
                             i_exclude[]  '&HELP',
                             i_exclude[]  '&ALL' ,
                             i_exclude[]  '&SAL' .
    *                         i_exclude[]  '&EXCLALLFC'.
    *&      Form  f9100_exclude_functions
    * This form exclude buttons  from the toolbar.
    *      -->P_IEXCLUDE  text
    *      -->P_1150   text
    FORM f9100_exclude_functions USING   pexclude LIKE i_exclude
                                   value(pfunction).
      DATA: l_exclude TYPE ui_func.
      l_exclude = pfunction.
      APPEND l_exclude TO pexclude.
    ENDFORM.                    " f9100_exclude_functions
    This will exculde the default push buttons.
    Let us know if it works for you.
    Regards,
    Anjali

  • How to add a push button in ALV Grid Top-of-page

    Is it possible to add a push button to the top-of-page in Alv grid display?if yes, then how? I am not using OO ABAP and am using reuse_alv_grid_display with top-of-page event.

    Hi,
    I am not sure whether we can add push button in top-of -page or not. But instead of that if you want to add button on toolbar as per your requirement then follow below link. it will useful.
    http://www.sap-img.com/abap/example-of-a-simple-alv-grid-report.htm
    Ram.

  • How to add the push button on the apllication tollbar of IL02 tcode

    Hi Friends,
    I have to add the push button on the application tool bar of the IL02.when that push button is pressed then some operation to be performed.Could you please suggest how to add.Is there any screen exit if yes what is that.
    With out screen exits if there is any way ?
    Thanks and regards,
    shyla

    HI Vicky ,
                      if u want an interactive ALV report , there are lot of forums already having the solution for that , but let me give u the solution anyway.
    In the function module "REUSE_ALV_GRID_DISPLAY" , import parameters
         I_CALLBACK_PF_STATUS_SET          = 'FLIGHT'
         I_CALLBACK_USER_COMMAND           = 'BUTTON_CLICK'
    has to be supplied to this function module . The PF status is where u hav created the two buttons , that PF status has to be given here .If the user clicks on the button then it is handled by the form routines . Inside the sub-routine based on the button the user has selected u could perform the action.
    FORM FLIGHT    USING RT_EXTAB TYPE SLIS_T_EXTAB.
      SET PF-STATUS 'FLIGHT' EXCLUDING RT_EXTAB.
    ENDFORM.
    Here the "Flight" is the PF_status .
    FORM BUTTON_CLICK USING UCOMM type SY-UCOMM
                           SELFIELD type SLIS_SELFIELD.
      CASE UCOMM.
        WHEN 'BUTTON!' .
    write ur code for button 1.
      WHEN "BUTTON"
      *Write ur code for button2 .
    end case.
    endform.
    for any queries reply back.
    regards

  • How to add a push button(download) to my ALV Report to download report data

    Hi,
    I developed a normal alv report and now i want to add a push button ex.. download in the report output and then whwnever I am clicking this download button then download functionality will work.Please don't take it as simple from my point of view it is very imp. for me please help me.
    Thanks.

    Hi,
    Please check the below thread
    Re: ADD button to ALV Grid
    Thanks
    Arul

  • How to add left push button column in REUSE_ALV_GRID

    Hi,
    I need to add the push button on the left most part of the grid which will enable the user to select multiple lines and do further processing. I'm currently using REUSE_ALV_GRID.
    I've tried to search but I only saw suggestions for ALV using OO.
    Please help. Thanks.

    Hi,
    If you ar eusing OO ABAP
    declare : ls_layo TYPE lvc_s_layo,
    You have to set...   ls_layo-sel_mode = 'A'.
    If you are using 'REUSE_ALV_GRID_DISPLAY'..
    go for the following ..
    sp_group(4)    type c,        " group specification or,
    reprep(1)      type c,        " selection for rep/rep

  • How to add an editable checkbox to an alv grid

    Hi..
    I need to add an editable checkbox to a alv grid.
    I wouls appreciatet it if anyone could provide some sample code.
    The standard example  BCALV_EDIT_05 is an oops example... I need a simple example
    Please help
    thanks
    Karen

    hi
    after you pass a field as checkbox in fieldcat
    then in layout populate edit
    ex wa_layout-edit = 'X'.
    try the following code
    REPORT  ZALV5.
    TYPE-POOLS: slis.
    tables: mara.
    DATA: begin of it_mara OCCURS 0,
          matnr like mara-matnr,
          mbrsh like mara-mbrsh,
          matkl like mara-matkl,
          meins like mara-meins,
          ersda like mara-ersda,
          ernam like mara-ernam,
          W_CHK type c ,
         END OF it_mara.
    *data: it_mara like  mara occurs 0 with header line.
    data:it_feildtab type slis_t_fieldcat_alv,
         wa_fieldcat type slis_fieldcat_alv.
    *DATA: i_private TYPE slis_data_caller_exit,
    data:     i_selfield TYPE slis_selfield,
          W_exit(1) TYPE c.
    PARAMETERS: p_title TYPE sy-title default 'ALV'.
    START-OF-SELECTION.
      SELECT matnr mbrsh matkl meins  ersda ernam FROM mara
        INTO corresponding fields of  table it_mara.
    wa_fieldcat-col_pos   = '1'.
    wa_fieldcat-fieldname = 'W_CHK'.
    *wa_FIELDCAT-KEY = 'X'.
    *wa_fieldcat-tabname   = 'IT_MARA'.
    *wa_fieldcat-seltext_s = 'units of measure'.
    wa_fieldcat-checkbox = 'X'.
    APPEND wa_fieldcat TO it_feildtab.
    CLEAR wa_fieldcat .
    CLEAR wa_fieldcat.
    wa_fieldcat-col_pos   = '2'.
    wa_fieldcat-tabname   = 'IT_MARA'.
    wa_fieldcat-fieldname = 'MATNR'.
    wa_fieldcat-key = 'X'.
    wa_fieldcat-hotspot = 'X'.
    wa_fieldcat-seltext_s = 'no'.
    APPEND wa_fieldcat TO it_feildtab.
    CLEAR wa_fieldcat .
    wa_fieldcat-col_pos   = '3'.
    wa_fieldcat-fieldname = 'MBRSH'.
    *wa_FIELDCAT-KEY = 'X'.
    wa_fieldcat-tabname   = 'IT_MARA'.
    wa_fieldcat-seltext_s = 'Ind.sec'.
    APPEND wa_fieldcat TO it_feildtab.
    CLEAR wa_fieldcat .
    wa_fieldcat-col_pos   = '4'.
    wa_fieldcat-fieldname = 'MATKL'.
    *wa_FIELDCAT-KEY = 'X'.
    wa_fieldcat-tabname   = 'IT_MARA'.
    wa_fieldcat-seltext_s = 'Description'.
    APPEND wa_fieldcat TO it_feildtab.
    CLEAR wa_fieldcat .
    wa_fieldcat-col_pos   = '5'.
    wa_fieldcat-fieldname = 'MEINS'.
    *wa_FIELDCAT-KEY = 'X'.
    wa_fieldcat-tabname   = 'IT_MARA'.
    wa_fieldcat-edit      = 'X'.
    wa_fieldcat-seltext_s = 'units of measure'.
    APPEND wa_fieldcat TO it_feildtab.
    CLEAR wa_fieldcat .
      CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
           EXPORTING
                i_title                 = p_title
                i_selection             = 'X'
                i_zebra                 = 'X'
               I_SCREEN_START_COLUMN   = 0
               I_SCREEN_START_LINE     = 0
                I_SCREEN_END_COLUMN     = 0
               I_SCREEN_END_LINE       = 0
                i_checkbox_fieldname    = 'W_CHK'
              I_LINEMARK_FIELDNAME    =
              I_SCROLL_TO_SEL_LINE    = 'X'
                i_tabname               = 'IT_MARA'
              i_structure_name        = 'IT_MARA'
               IT_FIELDCAT             = it_feildtab
              IT_EXCLUDING            =
              I_CALLBACK_PROGRAM      =
              I_CALLBACK_USER_COMMAND =
               IS_PRIVATE             = I_PRIVATE
         IMPORTING
                es_selfield             = i_selfield
                e_exit                  = w_exit
           TABLES
                t_outtab                = it_mara
           EXCEPTIONS
                program_error           = 1
                OTHERS                  = 2.
      IF sy-subrc <> 0.
       MESSAGE i000(0k) WITH sy-subrc.
      ENDIF.
      LOOP AT it_mara WHERE W_CHK = 'X'.
        WRITE: /  it_mara-ersda, it_mara-ernam.
      ENDLOOP.
    reward if helpful
    prasanth

  • How to add a new button in an ALV using factory method

    im using factory method to creat an ALV
    The reason why I'm doing this is because I want the ALV and the selection screen in the same screen like exemplified here http://help-abap.blogspot.com/2008/10/dispaly-alv-report-output-in-same.html
    CALL METHOD cl_salv_table=>factory
                EXPORTING
                  list_display   = if_salv_c_bool_sap=>false
                  r_container    = lo_cont
                  container_name = 'DOCK_CONT'
                IMPORTING
                  r_salv_table   = lo_alv
                CHANGING
                  t_table        = me->t_data.
    The above code already uses every parameter that method as to offer.
    Is it possible to add extra buttons to an ALV using that method?

    Hi Ann,
    The reason you are not able to see any of the new columns as a option to select in your web service block is because when you have published that block, they were not present. Add these two new objects in your block and publish it again. You will be prompted for duplication content. Select the highlighted block for duplicate and now you can see the new added objects in the filter option. Update and this will overwrite your published block. Please note, web services do appear to behave weirdly when used with dashboards so I request you to please try it in a separate test report first.
    Hope that helps.
    Regards,
    Tanisha

  • How to remove the select button from the alv grid

    Hi,
    I am using the Function modules for alv report,
    My 1st field in the list is checkbox,
    User can select the checkbox for further process.
    My problem is I want to remove the standards select option from alv.
    I have searched in slis_layout_alv for any option, but I could not.
    Please help me.
    Regards
    Rajan

    HI
      Exclude process options from ALV
        PERFORM alv_excl. ( g_r_excl     TYPE  ui_functions  . )
    FORM alv_excl.
      APPEND cl_gui_alv_grid=>mc_mb_sum          TO  g_r_excl.
      APPEND cl_gui_alv_grid=>mc_mb_subtot       TO  g_r_excl.
      APPEND cl_gui_alv_grid=>mc_fc_graph        TO  g_r_excl.
      APPEND cl_gui_alv_grid=>mc_fc_info         TO  g_r_excl.
      APPEND cl_gui_alv_grid=>mc_fc_print_back   TO  g_r_excl.
    ENDFORM.                    " alv_excl
    CALL METHOD g_r_grid->set_table_for_first_display
              EXPORTING
                is_layout                     = g_r_layo
                is_variant                    = g_r_variant
                it_toolbar_excluding       = g_r_excl
                i_save                        = 'X'
              CHANGING
                it_outtab        = g_t_yetprint[]
                it_fieldcatalog  = g_t_fieldcat.
    Options appended in g_r_excl, will be excluded from ALV
    Praveen

  • Adding push buttons in standard ALV

    Hi ,
    Is there any possiblity to add custom push buttons to standard ALV in Webdynpro for ABAP.
    If so, please provide me the solution.
    Thanks in Advance.
    cheers,
    sravan.

    I got the answer .

  • Add custom Push button in ME21N T-Code?

    Dear ABAP Experts,
                    I have a requirement , when the user will create PO(in Standard ME21N t-code) Delivery/Invoice tab user want to add new push button 'NEW_DATA' . When the user click on 'NEW_DATA' Push button then one new screen will appear. In that new screen(which had some input and check box fields which are field manually).
    At the end ,whenever the user click on SAVE Icon then all these new screen details will save in custom (Z or Y) table. 
    How can i do this Issue ?
    Thanks & Regards,
    K.Chinna..

    Dear Sreekanth,
    In SAPLMEGUI program you suggested me that do SHD0 and add GUIXT to add new button.
    What is SHD0 and GUIXT ?
    How can i do this ? please explain me step by step ?
    Regards,
    K.Chinna

  • How to add excel download button to ALV grid toolbar?

    Hi,
        Im generating ALV output through the method "SET_TABLE_FOR_FIRST_DISPLAY".But in the output,I cant see a direct excel download button,just like how it used to come when we use FM "REUSE_ALV_GRID_DISPLAY". Here, the excel download option comes as part of a drop down on top.But is there any way that I can have a separate excel download button which will be more user friendly for the customer?
    Thanks,
    Mahesh

    Create your own GUI status and add a push button there. In PAI write code for Excel download for that button.
    Regards,
    Amit

  • How to add a custom button in WD screen to call a workflow in siebel?

    Hi All,
    We have a requirement to have a custom button at the summary screen(after the rule execution) "Create Opportunity", on clicking on it a new opportunity record should be created in Siebel. As we know the "Save" link calls "PolicyAutomationSaveSession" inbound web service method and saves the information in session table and we can modify the PreSession and PostSession workflows. But we are not sure how it calls the service method and where is the mapping defined.
    Can you please help me on how to add a custom button and how to invoke a workflow in siebel side to implement this requirement?
    Also is there any document which can help me to add a custom button in screen and to add the code behind the button?
    Thanks in advance!!
    Regards,
    Subhradeep

    Subhradeep,
    Closing a Web Determinations window is essentially the same as closing any HTML window. It involves javascript, which you would have to add to the Web Determinations templates.
    Essentially the javascript command to close a window is {{window.close}} or {{top.close}}
    For timing, you might be able to use the setTimeout function of Javascript (see: http://www.w3schools.com/jsref/met_win_settimeout.asp)
    At the risk of exposing exactly how bad my javascript skills are, I have attached a super-simple html fragment, a page that closes itself after 3 seconds. It may help you get started in the right direction. In general closing a window is a fairly dubious activity and is often not permitted by certain browsers. This html page at least works in Internet Explorer.
    <html>
         <head>
         <script language="JavaScript">
              setTimeout(closeMe, 3000);
              function closeMe() {
                   alert("This window will close");
                   top.close();
         </script>
         </head>
         <body><B>This window will close in three seconds</B></body>
    </html>
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How can we add a button on our ALV Grid

    Hello,
    I need to add a button on the ALV Grid and write a code on that button to download a file on the desktop of the user's machine.
    How can we write a code for the same and what would be the syntax of that code.

    Hi,
    you should copy the 'STANDARD' GUI status from program SAPLKKBL using transaction SE90 >Programming SubObjects> Gui Status.
    ENTER SAPLKKBL PROGRAM
    STATUS STANDARD.
    exexute.
    select standard  check box. copy to your zprogram and your gui status.
    Enter your Z program name and the name you what for this status - you can keep it as 'STANDARD' to be simple.
    then go to se 38 double click on pf status .it goes to me41 screen .
    there you can add your button along with predefined buttons on application toolbar.
    then write code for button using user command event.
    Code:
    Form Set_pf_status
    Notes: Called by FM REUSE_ALV_GRID_DISPLAY
    FORM set_pf_status USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'ZSTANDARD'.
    ENDFORM. "Set_pf_status
    In the above case the GUI status copied was named ZSTANDARD and adjusted accordingly, adding and removing the desired buttons. A button was added called '%DELETE'.
    3). Create the following report:
    Code:
    Form User_command
    Notes: Called by FM REUSE_ALV_GRID_DISPLAY
           Detects whether the icon/button for
           'Return Tag Deletion' has been pressed. If it has then
           detect whether any rows have been highlighted and then
           set the delete flag.
    FORM user_command USING r_ucomm     LIKE sy-ucomm
                            rs_selfield TYPE slis_selfield.
    DATA: li_count TYPE I.
    IF r_ucomm EQ '%DELETE'.
      LOOP AT %g00 WHERE mark EQ 'X'.
        ADD 1 TO li_count.
      ENDLOOP.
      IF li_count GT 0.
        gc_delete_flag = 'X'.
        r_ucomm = '&F03'. "Back arraow
      ELSE.
        MESSAGE W000 WITH 'Please highlight the rows to be deleted!'.
      ENDIF.
    ENDIF.
    ENDFORM.  "User_command
    *reward points if usefull

Maybe you are looking for

  • Illustrator CC 2014 Crashing on Launch (error -1712)

    After installing Illustrator CC 2014 on an iMac running OS 10.7.5, it won't open. An error pops up that says, "Illustrator CC 2014 can't be opened. -1712". Any ideas why this would be happening? I have two other iMacs running the same program on the

  • Audio/Video not matching when converting with Videora...

    I have some TV shows already on my computer that I've put through Videora to try and get on my ipod...but the audio and video is not matching up. I have checked and double checked and am defineltly using the mpeg4 format and not the H ones...this is

  • Configuring data guard: how many standby redolog do I need?

    Hi all, I want to add a standby databse to my RAC test environment but I don't understanad how many redolog I need. The main db is a 2 node RAC (10.2.0.4.0); every node has 3 log groups; every log group has 2 logfile (every log group is multiplexed o

  • No RCH file to view when I generate

    When I generate and publish my webhelp file I get no viewable result. I click the view results button and nothing happens. I do not have the file with the rhc at the end. any advise would be appreciated.

  • Learner access in different level

    Dear We are on 11.5.10. I have defined course OAF TRAINING and selected "human resource" as organization for learner, while offering i defined and the same function "learner" menu appearing. However, in offering i select 'Finance deparment' for learn