TOOLBAR Event in OOALV

Hi,
I am using OOALV to display a report. I have 3 containers in the same screen and each container contains a ALV grid.
I have to add some customized buttons in each of the ALV grid. I am using the event 'TOOLBAR' of class cl_gui_alv_grid.
I have 3 different objects for each grid i.e. Ob1, ob2 and ob3.
I have created a event handler method to handle TOOLBAR event. In this event handler method i want to know that at a particular point of execution, which object is invoking this method (i.e. method is called by ob1, ob2 or Ob3) ?
I have checked the parameter 'e_object' but it is not giving a numeric value but not the object name.
Regards,
Pankaj.

Unfortunatelly I don't have access to SAP right now so I will improvise
"event handler class
CLASS lcl_handler DEFINITION.
  PUBLIC SECTION.
    METHODS:
         "create constructor accepting three grid references on input
          constructor importing ir_grid1 type ref to cl_gui_alv_grid
                                             ir_grid2 type ref to cl_gui_alv_grid
                                             ir_grid3 type ref to cl_gui_alv_grid,
        "and your handler method with SENDER parameter
          handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
                         IMPORTING e_object e_interactive sender.
    PRIVATE SECTION.
         "create 3 attributes to store grid references
       data: mr_grid1 type ref to cl_gui_alv_grid,
                mr_grid2 type ref to cl_gui_alv_grid,
                mr_grid3 type ref to cl_gui_alv_grid.
ENDCLASS.             
CLASS lcl_handler IMPLEMENTATION.
    METHOD constructor.     
         me->mr_grid1 = ir_grid1.
         me->mr_grid2 = ir_grid2.
         me->mr_grid3 = ir_grid3.
     ENDMETHOD.
    METHOD handle_toolbar.
          "check which grid raised the event
          case sender.
             when me->mr_grid1.
                "1st alv
                 "your coding here...
              when me->mr_grid2.
                  "2nd
                   "...and here
               when me->mr_grid3.
                  "3rd
                 "...and here
          endcase.
    ENDMETHOD.
ENDCLASS.
"now when creating handler object pass all your three grid references
data lr_handler type ref to lcl_handler.
create object lr_handler exporting ir_grid1 = your_grid_ref1
ir_grid2 = your_grid_ref2
ir_grid3 = your_grid_ref3.
SET HANDLER....               
This should work
Regards
Marcin

Similar Messages

  • Replicating MENU_BUTTON, TOOLBAR events

    Hi All,
    I wanted to know if the events in CL_GUI_ALV_GRID - MENU_BUTTON and TOOLBAR - are available in the new ALV Object Model. If not, is there a way to replicate them.
    I couldn't find anything matching these events in the various CL_SALV* classes.
    Thanks and Regards,
    Vidya.

    SALV Model has Functions object which does the job similar to TOOLBAR Event.
    In SALV, Add the function in the ALV grid, get the function object and call the method ADD_FUNCTION.
    *... §3.1 activate ALV generic Functions
        data: lr_functions type ref to cl_salv_functions,
              l_text       type string,
              l_icon       type string.
        lr_functions = gr_table->get_functions( ).
        lr_functions->set_all( gc_true ).
    *... §3.2 include own functions
        l_text = 'My Button'.
        l_icon = icon_complete.
        try.
          lr_functions->add_function(
            name     = 'MYFUNCTION'
            icon     = l_icon
            text     = l_text
            tooltip  = l_text
            position = if_salv_c_function_position=>right_of_salv_functions ).
          catch cx_salv_existing cx_salv_wrong_call.
        endtry.
    To handle the added function, register the event USER_COMMAND.
        data: lr_events type ref to cl_salv_events_table.
        lr_events = gr_table->get_event( ).
        create object gr_events.
        set handler gr_events->on_user_command for lr_events.
    Event handler class
    class lcl_handle_events definition.
      public section.
        methods:
          on_user_command for event added_function of cl_salv_events
            importing e_salv_function.
    endclass.                    "lcl_handle_events DEFINITION
    class lcl_handle_events implementation.
      method on_user_command.
        perform show_function_info using e_salv_function text-i08.
      endmethod.                    "on_user_command
    endclass.                    "lcl_handle_events IMPLEMENTATION
    Check program SALV_DEMO_TABLE_FUNCTIONS for more information.
    Regards,
    Naimesh Patel

  • ALV: Problem with toolbar event

    Hi ALV-experts,
    I have a dynpro with a header area where I display an ALV table. Below this I have a subscreen with a tabstrip control and two tabs.
    In the ALV toolbar I defined an own button. This button gets deactivated after pressing this button. I achieved this by the option "disabled" in the structure stb_button within the event handler for the toolbar event.
    This works all fine so far. If I start the dynpro and click on the button in the ALV-toolbar the buttons gets deactivated afterwards. But I have I jump between the tabs before I press the ALV-toolbar button, the button does not get deactivated.
    The debugger does not go into the event handler of the toolbar event. I also did system debugging of the method SET_TOOLBAR of the CL_GUI_ALV_GRID-class. Here I pass in both cases the command
    raise event toolbar e_object = m_cl_toolbar e_interactive = i_interactive.
    but in the second case (when I change the tabs before I press the button) the event handler is not executed and I don't know why. I also tried to register the event handler for all instances of the ALV still with the same result.
    The ALV method set_toolbar_interactive( ) did also not solve the problem.
    I couldn't find any SAP note about an issue for this event.
    Does anybody have an idea or a solution for this problem?
    EDIT:
    Problem solved, it was typo!
    Thanks in advance and regards,
    Martin
    Edited by: Martin Fischer on Jul 7, 2010 4:53 PM

    The problem was a typo!

  • ToolBar Event OpenPopUp() How to find the Javascript?

    Hello,
    In the Toolbar at BP_HEAD (Overview) there is a button for the PDF Fact Sheet.
    The Button-on_client_click = 'OpenPopUp()'.
    As far as I understood -> this is a Javascript event/function somewhere in /bc/bsp/sap/bsp_wd_base/bspwdpopupscripts.js
    (The sourcecode of the generated HTML Page points to this)
    HOW can I have a look into this Javascript?
    Or how to debugg this Event?!
    Or is "ls_button-page_id  = me->component_id." pointing to the Service of the PDF Fact sheet?
    Any help is highly recommended...
    Thanks
    /Chris
    PS: the Sourcecode of the whole Toolbar...
       IF lr_partner IS BOUND AND lv_enabled = abap_true.
            lr_partner->get_property_as_value( EXPORTING iv_attr_name = 'BP_GUID'"#EC NOTEXT
                                               IMPORTING ev_result    = lv_partner_guid ).
            IF lv_partner_guid IS NOT INITIAL.
    *       ICF handler class prepares java script
              CALL METHOD cl_crm_afs_print=>get_url
                EXPORTING
                  iv_object   = lv_object
                  iv_key      = lv_partner_guid
                  iv_role     = lv_business_role
                  iv_language = sy-langu
                  iv_form     = ' '     "read from customizing
                  iv_format   = lv_format
                IMPORTING
                  ev_url      = lv_url.
              IF lv_url IS INITIAL.
                lv_enabled = abap_false.
              ELSE.
                lr_cuco_head ?= get_custom_controller( 'BP_HEAD/Lifecycle' )."#EC NOTEXT
                IF lr_cuco_head IS BOUND.
    *              CONCATENATE '"' lv_url '"' INTO lr_cuco_head->gv_preview_url.
                  lr_cuco_head->gv_preview_url = lv_url.
                ENDIF.
              ENDIF.
            ENDIF.
            ls_button-text  = cl_wd_utilities=>get_otr_text_by_alias( 'CRM_UIU_BP/BP_PDF' )."#EC NOTEXT
            ls_button-tooltip  = cl_wd_utilities=>get_otr_text_by_alias( 'CRM_UIU_BP/BP_FS_PREVIEW' )."#EC NOTEXT
    *        ls_button-on_click = 'PREVIEW'.
            ls_button-on_client_click = 'OpenPopUp()'.          "#EC NOTEXT
            ls_button-page_id  = me->component_id.
            ls_button-enabled = lv_enabled.
            ls_button-icon_src = '/sap/bc/bsp/sap/crm_ppm/w_pdf__s.gif' ."#EC NOTEXT
            APPEND ls_button TO rt_buttons.
            CLEAR ls_button.
          ENDIF.
        ENDIF.
      ENDIF.
    From ... Re: Display PDF document in web browser

    Chris, Did you find out how to edit this java script?.
    I need to look at the code as I suspect it accesses table CRMV_PRN_CONTROL, looking for a particular Role and it identifies the Smartform for the PDF Factssheet and the Class/interface. We have TWO PDF factsheets displayed on the 'More' tab on the Account screen and need to therefore have two Smartforms/interfaces per Role. This is not possible due to the keys of this table, so we may need to point it to a Ztable when the PDF form option is chosen.
    Therefore I might need to change the code in the Java script OpenPopUp() if that's where this table lookup takes place.
    Almost 300 reads of this posting and no comments made. That's unusual.
    Jason

  • ALV OO toolbar event of  cl_gui_alv_grid - problem

    I have defined a Button in ALV grid toolbar in my program using Event Toolbar OF cl_gui_alv_grid.
    I have also disabled/Excluded some of the buttons on Standard Grid toolbar.
    My requirement is when i click on Button defined on ALV grid toolbar..i have to trigger a Perform in which code for submit the changes done on the grid is written..
    I tried to use event user_command and this method is not getting trigerred when i click on button defined on toolbar, Probably since i have mutiple grids in my output..
    suggest me appropriate event handler method or proper approach to go about this?

    Hello Ksiva
    Have you set the event handler for USER_COMMAND? You can do this either for all or a specific grid instance.
    SET HANDLER: lcl_eventhandler=>handle_user_command    FOR ALL INSTANCES.
    SET HANDLER: lcl_eventhandler=>handle_user_command    FOR go_grid1.
    Within your event handler method you can easily distinguish between the different grid instance.
    CLASS lcl_eventhandler DEFINITION.
    METHODS: handle_user_command FOR EVENT user_command
                                                         OF cl_gui_alv_grid
                        IMPORTING
                           e_ucomm
                           sender.    " !!! Optional parameter, instance which raised the event
    CLASS lcl_eventhandler IMPLEMENTATION.
    METHOD handle_user_command.
      CASE sender.
         WHEN go_grid1.
             " handle user command
         WHEN others.
               RETURN.
      ENDCASE.
    ENDMETHOD.
    Regards
      Uwe

  • Handling standard toolbar event in CL_SALV_TABLE

    Hi Experts,
    I have created a ALV report using class CL_SAL_TABLE. I have created some buttons in the application toolbar of ALV by which I can jump to other ALV views. Now my requirement is if I click on the Exit (Shift+F3) button on the standard toolbar at that time, I'd be taken back to the selection screen. Currently both the back and exit button behaves the same way (i.e. set screen 0. leave screen.). I want to change the behaviour for exit button.
    Can anybody help me how to implement that?
    Thanks,
    Mainak

    Hi Mainak,
    Call the screen number that you wish to. (Selection-screen number).
    CASE sy-ucomm.
    WHEN EXIT.
    CALL SCREEN 'xxxx'.

  • OOP ALV event on standard toolbar

    Hi everyone,
    I'm using a method SET_TABLE_FOR_FIRST_DISPLAY to create an ALV grid.
    After making it editable I get these "Append", "Insert", "Delete" and "Duplicate Row" buttons in the toolbar by default.
    Is there a way to override the functionality of these buttons?
    My requirement is to make some cells (key fields) editable if a row has been duplicated or a new row has been inserted.
    Thanks in advance,
    Yasantha

    If you implement the toolbar event handler for the class, you can remove icons from the toolbar that you don't want. 
    *   Set up event handlers.
        CREATE OBJECT event_receiver.
        SET HANDLER event_receiver->toolbar for g_grid.
    METHODS:
          toolbar FOR EVENT toolbar OF cl_gui_alv_grid
                  IMPORTING e_object e_interactive.
    DATA: ls_toolbar type stb_button.
      LOOP AT p_e_object->mt_toolbar INTO ls_toolbar.
        IF ls_toolbar-function = '&REFRESH' OR
           ls_toolbar-function = '&LOCAL&CUT' OR
           ls_toolbar-function = '&LOCAL&COPY' OR
           ls_toolbar-function = '&LOCAL&PASTE' OR
           ls_toolbar-function = '&LOCAL&APPEND' OR
           ls_toolbar-function = '&LOCAL&INSERT_ROW' OR
           ls_toolbar-function = '&LOCAL&DELETE_ROW' OR
           ls_toolbar-function = '&LOCAL&COPY_ROW'.
           DELETE p_e_object->mt_toolbar.
        ENDIF.
      ENDLOOP.

  • Push button in ooalv

    i want a push button in containar. is this possible?
    first i have placed the container and named it . then i clicked on push button and trying to place it on container , but it is not allowing to place on it.
    i have written a toolbar event , once the push button is clicked , then i want to handle it. But i am unable to put the pushbutton on the screen while doing ooalv .
    please tell me how to place the push button .

    SORRY I AM TRYING TO ARRANGE MY CODE BUT I AM NOT ABLE TO ARRANGE IT PROPERLY
    i have placed a push both ITEM and if i click it will fetch the item details of purchase order.
    when i click the ITEM ,the details are displayed on the grid. Here the ITEM button is still comming,
    I dont want this button to appear also i dont want to dislay the toolbar when i click the ITEM button .Please tell me where i need to change the code.
    REPORT  zdemo_ooalv_user_command                .
    DATA : o_container TYPE REF TO cl_gui_custom_container,
           o_grid TYPE REF TO cl_gui_alv_grid.
    DATA : it_ekko LIKE TABLE OF ekko,
    wa_ekko LIKE ekko,
    it_ekpo LIKE TABLE OF ekpo.
    DATA : wa_layout TYPE lvc_s_layo.
    CLASS lcl_event_handler 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.
    ENDCLASS.                    "lcl_event_handler DEFINITION
    CLASS lcl_event_handler IMPLEMENTATION.
      METHOD : handle_toolbar.
        DATA : wa_toolbar TYPE stb_button.
        CLEAR wa_toolbar.
    wa_toolbar-function = 'ITEM'.
        wa_toolbar-icon = 'ICON_DETAIL'.
        wa_toolbar-text = 'PREVIOUS'.
        APPEND wa_toolbar TO e_object->mt_toolbar.
      ENDMETHOD.                    ":
      METHOD handle_user_command.
        CASE e_ucomm.
          WHEN 'ITEM'.
    SELECT * INTO TABLE
                 it_ekpo FROM ekpo FOR ALL ENTRIES IN it_ekko
                  WHERE ebeln = it_ekko-ebeln.
            CALL METHOD o_grid->set_table_for_first_display
              EXPORTING
                i_structure_name = 'EKPO'
              CHANGING
                it_outtab        = it_ekpo.
        ENDCASE.
      ENDMETHOD.                    "handle_user_command
    ENDCLASS.                    "lcl_event_handler IMPLEMENTATION
    START-OF-SELECTION.
      CALL SCREEN 100.
    MODULE read_data OUTPUT.
      SELECT * INTO TABLE it_ekko FROM ekko
      UP TO 10 ROWS.
    ENDMODULE.                 " read_data  OUTPUT
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'ZSTATUS'.
      SET TITLEBAR 'Handle the toolbar events'.
      CREATE OBJECT o_container
        EXPORTING
         PARENT                      =
          container_name              = 'CONTAINER'.
      IF sy-subrc = 0.
        CREATE OBJECT o_grid
          EXPORTING
    *    I_SHELLSTYLE      = 0
    *    I_LIFETIME        =
            i_parent          = o_container.
        IF sy-subrc = 0.
          wa_layout-sel_mode = 'D'.
          CALL METHOD o_grid->set_table_for_first_display
      EXPORTING
        i_structure_name               =  'EKKO'
        is_layout                      = wa_layout
            CHANGING
              it_outtab                = it_ekko
    *CREATE an object for the event handler class
          DATA : o_handler TYPE REF TO lcl_event_handler.
          CREATE OBJECT:  o_handler.
    *Regestring the events
          SET HANDLER : o_handler->handle_toolbar FOR o_grid,
                         o_handler->handle_user_command FOR o_grid.
    *To trigger the toolbar event
          CALL METHOD o_grid->set_toolbar_interactive.
        ENDIF.
      ENDIF.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    MODULE user_command_0100 INPUT.
      CASE sy-ucomm.
        WHEN 'BACK'.
          LEAVE TO SCREEN 0.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT>

  • To display the typ, key field,info in the top-of -page event in OO ALV

    Hi all,
    I need to display the heading and the other select option details in the top-of-page  event in ooalv.How can the key ,typ and the info of top of event  in alv grid be passed in ooalv grid display.
    Regards,
    Arpita

    Check the blog.
    TOP_OF_PAGE in ALV  Using CL_GUI_ALV_GRID
    Now you have to use the method ADD_TEXT to populate the Select options details.
    I hope you know the Function to get the selection details
    RS_REFRESH_FROM_SELECTOPTIONS,. it will give into a table. so use that table and populate the TOP_OF_PAGE uisng the class CL_DD_DOCUMENT.

  • Calling external url like 'GOOGLE'  when user clicks on toolbar button

    Hi All,
           I have done the following steps for url creation:
       1. I have created an event and assigned it to newly created toolbar grp.Then in 'Define Application Layout' I have created an entry specifying name of application, toolbar, event, tab grp and version.
       2. Then in navigation for url generation I have created a method with blank object name. This method I have then assigned to a role.Here i have specified path for extenal link say 'google'.
       3. I have assigned same role to me in su01 transaction.
       4. when i run my application ,toolbar is getting displayed but when I click on toolbar nothing is getting open up.
               Is this the correct way for url generation or do i need to do something else?Is there any coding needs to be done?I have provided with steps done by me.Please help me further.
    Regards,
    vikas

    Hi.
    That's not possible in the PCUI since when the button is pressed a PCUI event is triggered and handle by the PCUI framework and we don't have access to the layout in order to react to such event (like placing javascript windows.open or kind of). The events defined in the PCUI are only supported by the PCUI framework. You could create an HTML container and then start the external web application (www.google.com or whatever) in this container (there is a good blog written by Gregor Wolf at <a href="/people/gregor.wolf3/blog/2005/05/27/use-crm-pcui-html-viewer-to-call-a-custom-url:///people/gregor.wolf3/blog/2005/05/27/use-crm-pcui-html-viewer-to-call-a-custom-url) or as Raj said you can use "Object Link Navigation" in order to start a new window with the PCUI layout where you can create another container with the web application you want to display (for more details have a look to the PCUI cookbook).
    Best regards.
    Armando Rodriguez.

  • Problem with Toolbars in LVC_S_LAYO

    Dear all,
    i am using structure LVC_S_LAYO.
    Here in my toolbar some icons like show next,summation are inactive.
    Also i am using LVC_T_FCAT where i have set DO_SUM = 'X'.
    When i see in debugging the value X is getting passed from my it_fieldcatalog table but still
    the sum of the desired column is not displayed.what must be the problem?
    Why are these icons inactive in the toolbar.?What should i do to Activate them?

    If you are using the OO model cl_gui_alv_grid you won´t need any of the fcat models as the sum facility is included on the standard toolbar.
    Just select the column and then press the SUM button.
    If  you switch to the OO model you don`t need to do very much coding and there are a lot less chances of getting errors.
    However if you DO program the toolbar then you will need some code like
    1)  in the constructor set the handler for the ON TOOLBAR event.
    SET HANDLER z_object->on_toolbar FOR grid1.
    also have one for ON_USER_COMMAND
      SET HANDLER z_object->on_user_command FOR grid1.
    2) in the the toolbar method activate the buttons you need
    For example
    method ON_TOOLBAR.
    type-pools icon.
    CLEAR ls_toolbar.
        MOVE 0 TO ls_toolbar-butn_type.
        MOVE 'EXIT' TO ls_toolbar-function.
        MOVE space TO ls_toolbar-disabled.
        MOVE icon_system_end TO ls_toolbar-icon.
        MOVE 'Click2Exit' TO ls_toolbar-quickinfo.
        APPEND ls_toolbar TO e_object->mt_toolbar.
        CLEAR ls_toolbar.
        MOVE  0 TO ls_toolbar-butn_type.
        MOVE 'SAVE' TO ls_toolbar-function.
        MOVE space TO ls_toolbar-disabled.
        MOVE  icon_system_save TO ls_toolbar-icon.
        MOVE 'Save data' TO ls_toolbar-quickinfo.
        APPEND ls_toolbar TO e_object->mt_toolbar.
        CLEAR ls_toolbar.
        MOVE  0 TO ls_toolbar-butn_type.
        MOVE 'EDIT' TO ls_toolbar-function.
        MOVE  space TO ls_toolbar-disabled.
        MOVE  icon_toggle_display_change TO ls_toolbar-icon.
        MOVE 'Edit data' TO ls_toolbar-quickinfo.
        MOVE  'EDIT' TO ls_toolbar-text.
        APPEND ls_toolbar TO e_object->mt_toolbar.
        CLEAR ls_toolbar.
        MOVE  0 TO ls_toolbar-butn_type.
        MOVE 'PROC' TO ls_toolbar-function.
        MOVE  space TO ls_toolbar-disabled.
        MOVE   icon_businav_process TO ls_toolbar-icon.
        MOVE 'Process.' TO ls_toolbar-quickinfo.
        MOVE  'PROC' TO ls_toolbar-text.
        APPEND ls_toolbar TO e_object->mt_toolbar.
        CLEAR ls_toolbar.
        MOVE  0 TO ls_toolbar-butn_type.
        MOVE 'EXCEL' TO ls_toolbar-function.
        MOVE  space TO ls_toolbar-disabled.
        MOVE  icon_xxl TO ls_toolbar-icon.
        MOVE 'Excel' TO ls_toolbar-quickinfo.
        MOVE  'EXCEL' TO ls_toolbar-text.
        APPEND ls_toolbar TO e_object->mt_toolbar.
        MOVE  0 TO ls_toolbar-butn_type.
        MOVE 'REFR' TO ls_toolbar-function.
        MOVE  space TO ls_toolbar-disabled.
        MOVE  icon_refresh TO ls_toolbar-icon.
        MOVE  'Refresh' TO ls_toolbar-quickinfo.
        MOVE  'REFR' TO ls_toolbar-text.
        APPEND ls_toolbar TO e_object->mt_toolbar.
    endmethod.
    What the above code does is set the variable E_UCOMM with the value in the toolbar function for example if I press the EXCEL button E_UCOMM is set to EXCEL.
    Now the method ON_USER_COMMAND is called where you can then choose your method / action for the toolbar.
    method ON_USER_COMMAND.
           FOR EVENT before_user_command OF cl_gui_alv_grid
           IMPORTING
             e_ucomm
             sender.
    CASE e_ucomm.
          WHEN 'EXIT'.
            LEAVE PROGRAM.
          WHEN 'EXCEL'.
            CALL METHOD me->download_to_excel.
          WHEN 'SAVE'.
          WHEN 'PROC'.
            CALL METHOD me->process.
          WHEN 'REFR'.
            CALL METHOD me->refresh.
        ENDCASE.
    endmethod.
    Note that the routine ON Data Changed Finished is always called before the user command handling if you set a handler for the event data changed finished;
    Your data of course must still be correct  for summing it must be NUMERIC.
    Cheers
    jimbo

  • Handling the Standard Toolbar Button click of an ALV

    Hi Experts,
    I have created an ALV grid output using CL_GUI_ALV_GRID with standard buttons(default) on the toolbar. When I click on any of these standard buttons, say '+' button to insert records, my custom program is not hit.
    I know there is a protected event 'TOOLBAR_BUTTON_CLICK' which I tried to handle in my program but it did not work. However, I am able to handle the public event 'DOUBLE_CLICK' of the same class 'CL_GUI_ALV_GRID'.
    So..can anyone tell how to handle this protected event OR how to handle the STANDARD buttons on ALV toolbar so that they hit my custome code.
    Thanks very much.
    Regards,
    Rudresh

    Hello Rudresh
    The point is to "re-define" the standard ok-codes of toolbar buttons:
    " Make toolbar interactive
    CALL METHO go_grid->set_toolbar_interactive( ).  " raises event TOOLBAR
    " Event handler method
    METHOD handle_toolbar.
    * define local data
      DATA: ls_button    TYPE stb_button.
    " Redefine function code
      LOOP AT e_object->mt_toolbar INTO ls_button
                      WHERE ( function = cl_gui_alv_grid=>MC_FC_LOC_INSERT_ROW ).
        ls_button-function = 'MY_FCODE'.  " triggers USER_COMMAND
        MODIFY e_object->mt_toolbar FROM ls_button INDEX syst-tabix.
      ENDLOOP.
    ENDMETHOD.
    Regards
      Uwe

  • Edit Toolbar of CL_GUI_ALV_TREE

    Hi everyone,
    I'm wondering how to edit the toolbar of the CL_GUI_ALV_TREE. There is no toolbar event like in CL_GUI_ALV_GRID.
    In case of CL_GUI_ALV_GRID you have the attribute 'mt_toolbar' which is an internal table, containing the toolbar buttons.
    In case of CL_GUI_ALV_TREE there is only the attribute 'mr_toolbar' which is a reference to CL_GUI_TOOLBAR. So I thought about editing the internal table M_TABLE_BUTTON from CL_GUI_TOOLBAR(should be the same as mt_toolbar), but it's read-only
    Any idea how to edit/personalize the toolbar of CL_GUI_ALV_TREE?

    For solution check program BCALV_TREE_DEMO, form: change_toolbar!

  • ALV events for data_change  executing multiple times

    Hello Experts,
    I am using the event "data_changed" of cl_gui_alv_grid and its getting triggred multiple times based on
    no. of rows in my ALV grid output.
    For ex: if i have 5 rows and if i input a field in any cell in a new row, in data_changed event is triggered 2 times.
    The  LOOP AT er_data_changed->mt_mod_cells INTO ls_modified is executing 6 times as in above example
    even though is having only 1 entry.
    Can some one pls help me with this?
    Also i see the  toolbar event is often getting excuted multiples no of times making the application slow.
    Please suggest.
    Thanks
    Dan

    Dan,
    Maybe you've placed or doing something wrong, take this report as a pattern "BCALV_EDIT_03".
    Best regards,
    Alexandre

  • ALV scroll event ?

    Hello,
    I need to display a long list using a ALV display.  For each line, there are data to be fetched from multiple tables so this can take quite long to accomplish.  To avoid having users to wait while gathering the data for the whole list I would like to be able to gather only data for the lines visible at each time.  So if a user scrolls down, I would select the data for the new lines displayed.
    So I was wondering if anyone would know if there is an event in the ALV object which allows me to catch which lines are being displayed ?  The method get_scroll_info_via_id would allow me to know which lines are displayed in the beginning but if a user scrolls down I have no information about this as an PBO event is not triggered.
    So if anyone could advise me or has an alternative approach to this problem I would be very grateful.
    Regards,
    Sigurjon

    Hi,
      One solution I can think of is to add your own button to the ALV Toolbar (Like "Show Next Page") and then limit the initial display to certain N number of lines..
      And when user clicks on this button, you read next N number of records and then <b>add</b> these entries to the internal table that is used for ALV display and call REFRESH_TABLE_DISPLAY method..
      Once you reach the end, just disable the button..
      Since you are always adding the lines, if he wants to see previous page he can simply use paging keys or scrollbar...
      Hope this helps..
      May be you already know..but just..FYI, you can handle TOOLBAR event of ALV Grid to add your own buttons to the ALV Toolbar.. Please take a look at sample program BCALV_GRID_05 just in case you need reference on how to add the button..
    Sri
    Message was edited by: Srikanth Pinnamaneni

Maybe you are looking for

  • Unable to capture Action_Success event during update

    Hi I am using SAP-B1 2004. Using UIAPI, i am trying to do something when an item information in item master is updated. On update button click i am capturing the Before_Action =True event to do something. If the Item information is successfully updat

  • ALV Top of Page Date format problem?

    Dear All Abapper,                     I have placed date(12.12.2007) format in ALV Top of Page, but it displayed                   <u> <b> 20071212</b></u> in this format.                     Pls, give me the suggestion to reclaim my problem.

  • Fireworks cs4 will not launch after accepting license agreement

    fireworks cs4 will not launch after accepting license agreement

  • Windows xp not responding when browsing leopard shares

    im having a problem with windows xp and file sharing on leopard server 10.5.4. im wondering if anyone else has experienced this issue or can provide some details on what i could try. when i use windows xp there is no problem in authenticating to and

  • Production Order - Segregating Costs for different cost elements.

    Hi Experts, I am a QM Key User and have been asked to look into improving our current Non-conformance / re-work process. My plan is to include the rework operations within the original PP01 Production Order. So far: Three Work Centres have been creat