Adding buttons in ABAP WD ALV toolbar

Hi,
  Currently, on the ABAP WD ALV grid toolbar, there are the "Excel" and "Print Version" buttons by default. 
  I would like to know how can I add my own custom buttons to the toolbar (or remove the default ones)?  I've looked in the documentation, but I can't seem to find any examples.
Thank you in advance for your help,
Christian

Hi Christian,
use Interface IF_SALV_WD_STD_FUNCTIONS. There are a few methods included to control the buttons on the
tool bar, e.g. SET_PDF_ALLOWED or SET_EDIT_DELETE_ROW_ALLOWED.
Use the ALV configuration model to control this. There are a couple of tutorials available on SDN on how to implement it. Just do a search.
regards, Ulli

Similar Messages

  • Radio button in ALV toolbar

    Hi experts,
    I have a requirement to add 2 radio buttons on ALV toolbar.
    I try to implement the toolbar event of class cl_gui_alv_grid, and add 2 radio buttons using the following code:
           move 'RAD' to ls_toolbar-function. 
           move 'RADIO1' to ls_toolbar-quickinfo.
           move 'RADIO1' to ls_toolbar-text.
           move '4' to ls_toolbar-butn_type.
           move ' ' to ls_toolbar-disabled.
           move 'X' to ls_toolbar-checked .
           append ls_toolbar to e_object->mt_toolbar.
           clear ls_toolbar.
           move 'RAD' to ls_toolbar-function.
           move 'RADIO2' to ls_toolbar-quickinfo.
           move 'RADIO2' to ls_toolbar-text.
           move '4' to ls_toolbar-butn_type.
           move ' ' to ls_toolbar-disabled. "#EC NOTEXT
           append ls_toolbar to e_object->mt_toolbar.
    But when I run this program,I find these 2 radio buttons look like normal button, is this correct?
    And I don't know how to catch which radio button is checked or not.
    Anyone having code for it or any suggestion for it, kindly let me know...
    Thank you
    Edited by: jie Wu on Nov 26, 2010 3:33 AM

    hello,
    I visit this address, but it does't meet my needs....
    I want to add radio button(button type 4) in ALV toolbar not the normal button(button type 0).
    The more important is I want to find a way to get properity of toolbar in ALV grid.
    Thank you.

  • Checkbox problem in ALV toolbar

    Hello all,
    I hv added a checkbox in my alv toolbar using classes.
    i.e. MOVE 'NO_DEFECTS' TO ls_toolbar-function.
          MOVE 'No Defects' TO ls_toolbar-quickinfo.
          MOVE 'No Defects' TO ls_toolbar-text.
          MOVE 5 TO ls_toolbar-butn_type.
          MOVE ' ' TO ls_toolbar-disabled.
          APPEND ls_toolbar TO e_object->mt_toolbar.
    Alv is displaying in one subscreen.
    My problem is my checkbox is displaying as a button instead of a check box and also i want to know how can i check whether my checkbox is active or not.
    I want to disable some buttons in the alv toolbar based on this checkbox.
    Thanks in advance.
    regards,
    Lokesh

    Hi,
    To disable the buttons in the toolbar, In the ALV events exclude the fcodes of the buttons you want to disable and pass it to the
    to the program like the below statement
      set pf-status 'STDPOPBX_FULLSCREEN' excluding lt_extab
                              of program 'SAPLKKBL'.
    To use the check box pass the ls_toolbar-ICON as ICON_WD_CHECK_BOX.
    Regards,
    Kranthi

  • How to create multiple buttons in ALV Toolbar in Webdynpro ABAP

    Hi all,
    I am trying to create multiple buttons in Webdynpro  ALV toolbar, please go through the code.
    What happening is, second button is replacing the first one.
    DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.
       lo_cmp_usage =   wd_this->wd_cpuse_alv_table( ).
       IF lo_cmp_usage->has_active_component( ) IS INITIAL.
         lo_cmp_usage->create_component( ).
       ENDIF.
       DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
       lo_interfacecontroller =   wd_this->wd_cpifc_alv_table( ).
        DATA lv_value TYPE REF TO cl_salv_wd_config_table.
       lv_value = lo_interfacecontroller->get_model(
       DATA lr_buttonui1 TYPE REF TO cl_salv_wd_fe_button.
       DATA lr_buttonui2 TYPE REF TO cl_salv_wd_fe_button.
       DATA button1 TYPE REF TO cl_salv_wd_function.
       DATA button2 TYPE REF TO cl_salv_wd_function.
    **First button
       CREATE OBJECT lr_buttonui1.
       lr_buttonui1->set_text('Button')."setting the text of the button on alv toolbar
       button1 = lv_value->if_salv_wd_function_settings~create_function( id = 'BUTTON')."creating the function for alv button
       button1->set_editor( lr_buttonui1 ).
    **Second button
       CREATE OBJECT lr_buttonui2.
         lr_buttonui2->set_text('Button1')."setting the text of the button on alv toolbar
       button2 = lv_value->if_salv_wd_function_settings~create_function( id = 'BUTTON' )."creating the function for alv button
       button2->set_editor( lr_buttonui2 ).
    How can I overcome this??
    Thanks
    Eshwar

    Hi Eshwar,
    The button Ids are same for both the buttons in your code. You need to change it as BUTTON1, BUTTON2.
    **First button
       CREATE OBJECT lr_buttonui1.
       lr_buttonui1->set_text('Button')."setting the text of the button on alv toolbar
       button1 = lv_value->if_salv_wd_function_settings~create_function( id = 'BUTTON1')."creating the function for alv button
       button1->set_editor( lr_buttonui1 ).
    **Second button
       CREATE OBJECT lr_buttonui2.
         lr_buttonui2->set_text('Button1')."setting the text of the button on alv toolbar
       button2 = lv_value->if_salv_wd_function_settings~create_function( id = 'BUTTON2' )."creating the function for alv button
       button2->set_editor( lr_buttonui2 ).

  • Adding an EXIT button in  ALV toolbar

    Hi,
        i want to add an exit button in my ALV toolbar wherein it should exit the browser or the URL which displays the output. Plzz help me on this.
    Thanks.

    Hi,
    the following code may help you:
    DATA:
    l_ref_cmp_usage          TYPE REF TO if_wd_component_usage,
    l_interface                    TYPE REF TO iwci_salv_wd_table,
    lr_table                        TYPE REF TO cl_salv_wd_config_table.
    create alv component
    l_ref_cmp_usage = wd_this->wd_cpuse_<name_of_alv_comp>( ).
    IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
    l_ref_cmp_usage->create_component( ).
    ENDIF.
    get config models
      l_interface = wd_this->wd_cpifc_alv_activities_prdstd( ).
      lr_table = l_interface->get_model( ).
    create the toolbar button
    DATA:
    lr_functions TYPE REF TO if_salv_wd_function_settings,
    lr_function  TYPE REF TO cl_salv_wd_function,
    lr_fe_button TYPE REF TO cl_salv_wd_fe_button.
    lr_functions ?= lr_table.
    lr_function = lr_functions->create_function( 'MYBUTTON' ).
    CREATE OBJECT lr_fe_button.
    lr_fe_button->set_text( 'MyButton' ).
    lr_function->set_editor( lr_fe_button ).
    After that add an event handler for the ON_FUNCTION event of the alv. In this method you can do whatever you want.
    Kind Regards,
    Anika

  • How to display standard ALV toolbar function in Webdynpro ABAP

    Hi All,
    Could any one please let me know that how to display the standard ALV functions. What I tried is as follows:
    data :lr_config_table type ref to cl_salv_wd_config_table.
    data lr_function type ref to cl_salv_wd_function_std
    Got the reference by calling the get_model().
    Now tried to display a standard button say :
      CALL METHOD lr_config_table ->if_salv_wd_function_settings~get_function_std
        EXPORTING
          id    = 'SALV_WD_INPUT_INSERT_ROW'
        RECEIVING
          value = lr_function.
      CALL METHOD lr_function->set_visible
        EXPORTING
          value = cl_wd_uielement=>e_visible-visible.
    But I can't see the button added to my ALV toolbar! Could any one please help me out on this if I am missing something.
    Many Thanks!
    Somnath

    Hi..
    ALV report which when displayed normally allows users to insert and delete rows using the methods below from class Cl_Salv_Wd_Config_Table:
    I think add these lines to your code and check..
    IF_SALV_WD_TABLE_SETTINGS~SET_READ_ONLY (false)
    IF_SALV_WD_STD_FUNCTIONS~SET_EDIT_INSERT_ROW_ALLOWED (true).
    DATA: l_ref_cmp_usage TYPE REF TO if_wd_component_usage.
      l_ref_cmp_usage =   wd_this->wd_cpuse_alv_basic( ).
      IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
        l_ref_cmp_usage->create_component( ).
      ENDIF.
      DATA l_salv_wd_table TYPE REF TO iwci_salv_wd_table.
      l_salv_wd_table = wd_this->wd_cpifc_alv_basic( ).
      DATA l_table TYPE REF TO cl_salv_wd_config_table.
      l_table = l_salv_wd_table->get_model( ).
      l_table->if_salv_wd_table_settings~set_read_only( abap_false ). 
      l_table->if_salv_wd_std_functions~set_edit_append_row_allowed( abap_false ).
      l_table->if_salv_wd_std_functions~set_edit_insert_row_allowed( abap_false ).
      l_table->if_salv_wd_std_functions~set_edit_delete_row_allowed( abap_false ).
    Cheers,
    Kris.

  • Standard buttons not displaying ALV when added button by creating PF status

    Hi  All,
    I have added a button(using SE41) in application toolbar for ALV grid using Factory method.But the problem is I am unable to see the standard tool bar buttons(Layout,Download,Mail etc).
    Even I tried adding buttons(using standard FCODES) to the PFstatus.Now the buttons are visible but the functionality is not working for all buttons.Its working only for Graphic and Change layout buttons.
    Can any one suggest...??
    -Phaniram

    Disregard DKS's response...that's the older stuff and you're using NetWeaver ALV.
    In SALV you can cause those buttons to appear, but you may need to copy the SALV_STANDARD GUI from one of the SALV* named program using SE80...sounds like you have that part, but you may need to turn functions ON...
    Perhaps something like this would help:
    data:  gr_f_list  type ref to cl_salv_functions_list,
             gr_alv     type ref to cl_salv_table,
    SALV toolbar & GUI functions
      gr_f_list = gr_alv->get_functions( ).     "Get Toolbar functions
      gr_f_list->set_all( abap_true ).          "All On
      gr_f_list->set_view_lotus( abap_false ).  "Lotus 123 off
      gr_f_list->set_view_excel( abap_false ).  "Excel in Place Off
      gr_f_list->set_graphics( abap_false ).    "Graph tool off
    For undesired buttons, set each tool OFF after turning all ON.

  • Add on custom button to ALV toolbar in std tcode ME51N, ME52N and ME53N.

    Hi All,
    I have the requirement to add on the custom button to ALV toolbar in ITEM OVERVIEW for standard transaction ME51N, ME52N and ME53N. Does anyone know what enhancement point or user exit i should apply and how i can add on the custom button?
    Thanks.

    There are no user exits or badi's for COOIS. You may have to make copy of the PPIO_ENTRY to ZPPIO_ENTRY including all the varians without changing their names like copy SAP&COOIS to SAP&COOIS. Create a T-Code ZCOOIS and replace COOIS in variant SAP&COOIS to ZCOOIS not in the name of the variant but in the field "Check Authorization for".
    The PF-Status is found in the include LCOISOUTPUTF16 which is located in the function group COISOUTPUT you may have to copy that too. Finally you need to copy SAPLCOISOUTPUT with its GUI status GENERAL and add your custom button there.

  • Menu Button in ALV toolbar (multiple choices for a button)

    Hi abapers,
    I would like to have a button with multiple choices in the toolbar;
    at the moment I have created a menu button with just one function.
    Here is my code:
    CLASS lcl_event_receiver (Definition)
    CLASS lcl_event_receiver DEFINITION.
      PUBLIC SECTION.
        METHODS:
        handle_toolbar
            FOR EVENT toolbar OF cl_gui_alv_grid
                IMPORTING e_object e_interactive.
    ENDCLASS.                    "lcl_event_receiver DEFINITION
    CLASS lcl_event_receiver (Implementation)
    CLASS lcl_event_receiver IMPLEMENTATION.
      METHOD handle_toolbar.
        DATA: ls_toolbar  TYPE stb_button.
    *Separator
        CLEAR ls_toolbar.
        MOVE 3 TO ls_toolbar-butn_type.
        APPEND ls_toolbar TO e_object->mt_toolbar.
    *Button
        CLEAR ls_toolbar.
        MOVE 1 TO ls_toolbar-butn_type.
        MOVE 'EDIT' TO ls_toolbar-function.
        MOVE icon_change TO ls_toolbar-icon.
        MOVE ' Modifica'(l02) TO ls_toolbar-text.
        MOVE ' ' TO ls_toolbar-disabled.
        MOVE 'Modifica' TO ls_toolbar-quickinfo.
        APPEND ls_toolbar TO e_object->mt_toolbar.
      ENDMETHOD.                    "handle_toolbar
    ENDCLASS.                    "lcl_event_receiver IMPLEMENTATION

    hi,
    check this code and reward me if it helps you..
    TYPE-POOLS : slis,icon.
    *Structure declaration for tcodes
    TYPES : BEGIN OF ty_table,
            tcode TYPE tcode,
            pgmna TYPE progname,
            END OF ty_table.
    *Structure for tocde text
    TYPES : BEGIN OF ty_itext,
            tcode TYPE tcode,
            ttext TYPE ttext_stct,
            sprsl TYPE sprsl,
            END OF ty_itext.
    *Structure for output display
    TYPES : BEGIN OF ty_output,
            tcode TYPE tcode,
            pgmna TYPE progname,
            ttext TYPE ttext_stct,
           END OF ty_output.
    *internal table and work area declarations
    DATA : it_table TYPE STANDARD TABLE OF ty_table INITIAL SIZE 0,
           it_output TYPE STANDARD TABLE OF ty_output INITIAL SIZE 0,
           it_ittext TYPE STANDARD TABLE OF ty_itext INITIAL SIZE 0,
           wa_table TYPE ty_table,
           wa_output TYPE ty_output,
           wa_ittext TYPE ty_itext.
    *Class definition for ALV toolbar
    CLASS:      lcl_alv_toolbar   DEFINITION DEFERRED.
    *Declaration for toolbar buttons
    DATA : ty_toolbar TYPE stb_button.
    Data declarations for ALV
    DATA: c_ccont TYPE REF TO cl_gui_custom_container,   "Custom container object
          c_alvgd         TYPE REF TO cl_gui_alv_grid,   "ALV grid object
          it_fcat            TYPE lvc_t_fcat,            "Field catalogue
          it_layout          TYPE lvc_s_layo,            "Layout
          c_alv_toolbar    TYPE REF TO lcl_alv_toolbar,           "Alv toolbar
          c_alv_toolbarmanager TYPE REF TO cl_alv_grid_toolbar_manager.  "Toolbar manager
    *Initialization event
    INITIALIZATION.
    *Start of selection event
    START-OF-SELECTION.
    *Subroutine to get values from tstc table
      PERFORM fetch_data.
    *subroutine for alv display
      PERFORM alv_output.
          CLASS lcl_alv_toolbar DEFINITION
          ALV event handler
    CLASS lcl_alv_toolbar DEFINITION.
      PUBLIC SECTION.
    *Constructor
        METHODS: constructor
                   IMPORTING
                     io_alv_grid TYPE REF TO cl_gui_alv_grid,
    *Event for toolbar
        on_toolbar
           FOR EVENT toolbar
           OF  cl_gui_alv_grid
           IMPORTING
             e_object.
    ENDCLASS.                    "lcl_alv_toolbar DEFINITION
          CLASS lcl_alv_toolbar IMPLEMENTATION
          ALV event handler
    CLASS lcl_alv_toolbar IMPLEMENTATION.
      METHOD constructor.
      Create ALV toolbar manager instance
        CREATE OBJECT c_alv_toolbarmanager
          EXPORTING
            io_alv_grid      = io_alv_grid.
       ENDMETHOD.                    "constructor
      METHOD on_toolbar.
      Add customized toolbar buttons.
      variable for Toolbar Button
          ty_toolbar-icon      =  icon_generate.
        ty_toolbar-butn_type = 0.
        ty_toolbar-text = 'Button1'.
          APPEND ty_toolbar TO e_object->mt_toolbar.
          ty_toolbar-icon      =  icon_voice_output.
        ty_toolbar-butn_type = 0.
        ty_toolbar-text = 'Button2'.
           APPEND ty_toolbar TO e_object->mt_toolbar.
         ty_toolbar-icon      =  icon_phone.
        ty_toolbar-butn_type = 0.
        ty_toolbar-text = 'Button3'.
           APPEND ty_toolbar TO e_object->mt_toolbar.
         ty_toolbar-icon      =  icon_mail.
        ty_toolbar-butn_type = 0.
        ty_toolbar-text = 'Button4'.
           APPEND ty_toolbar TO e_object->mt_toolbar.
       ty_toolbar-icon      =  icon_voice_input.
        ty_toolbar-butn_type = 0.
        ty_toolbar-text = 'Button5'.
         APPEND ty_toolbar TO e_object->mt_toolbar.
      Call reorganize method of toolbar manager to
      display the toolbar
         CALL METHOD c_alv_toolbarmanager->reorganize
          EXPORTING
            io_alv_toolbar = e_object.
       ENDMETHOD.                    "on_toolbar
    ENDCLASS.                    "lcl_alv_toolbar IMPLEMENTATION
    *&      Form  fetch_data
          text
    -->  p1        text
    <--  p2        text
    FORM fetch_data .
    Select the tcodes upto 200 rows from TSTC
       SELECT   tcode
               pgmna
               FROM tstc
               INTO CORRESPONDING FIELDS OF TABLE it_table
               UP TO 200 ROWS
               WHERE dypno NE '0000'.
    *Select the tcode textx
       IF it_table[] IS NOT INITIAL.
         SELECT ttext
               tcode
               sprsl
               FROM tstct
               INTO CORRESPONDING FIELDS OF TABLE it_ittext
               FOR ALL ENTRIES IN it_table
               WHERE tcode = it_table-tcode
               AND sprsl = 'E'.
       ENDIF.
    Apppending the data to the internal table of ALV output
       LOOP AT it_table INTO wa_table.
        wa_output-tcode = wa_table-tcode.
        wa_output-pgmna = wa_table-pgmna.
       For texts
        READ TABLE it_ittext INTO wa_ittext WITH KEY tcode = wa_table-tcode.
        wa_output-ttext = wa_ittext-ttext.
         APPEND wa_output TO it_output.
        CLEAR wa_output.
       ENDLOOP.
       ENDFORM.                    " fetch_data
    *&      Form  alv_output
          text
    -->  p1        text
    <--  p2        text
    FORM alv_output .
    *Calling the ALV
      CALL SCREEN 0600.
      ENDFORM.                    " alv_output
    Calling the ALV screen with custom container
    On this statement double click  it takes you to the screen painter SE51.Enter the attributes
    *Create a Custom container and name it CC_CONT and OK code as OK_CODE.
    *Save check and Activate the screen painter.
    Now a normal screen with number 600 is created which holds the ALV grid. PBO of the actual screen , Here we can give a title and *customized menus
    *&      Module  STATUS_0600  OUTPUT
          text
    MODULE status_0600 OUTPUT.
    SET PF-STATUS 'xxxxxxxx'.
    SET TITLEBAR 'xxx'.
    ENDMODULE.                 " STATUS_0600  OUTPUT
    calling the PBO module ALV_GRID.
    *&      Module  ALV_GRID  OUTPUT
          text
    MODULE alv_grid OUTPUT.
    *create object for custom container
      CREATE OBJECT c_ccont
           EXPORTING
              container_name = 'CC_CONT'.
    *create object of alv grid
      CREATE OBJECT c_alvgd
          EXPORTING
              i_parent = c_ccont.
    create ALV event handler
      CREATE OBJECT c_alv_toolbar
        EXPORTING
          io_alv_grid = c_alvgd.
    Register event handler
      SET HANDLER c_alv_toolbar->on_toolbar FOR c_alvgd.
    Fieldcatalogue for ALV
       PERFORM alv_build_fieldcat.
    ALV attributes FOR LAYOUT
      PERFORM alv_report_layout.
       CHECK NOT c_alvgd IS INITIAL.
    Call ALV GRID
       CALL METHOD c_alvgd->set_table_for_first_display
        EXPORTING
          is_layout                     = it_layout
        CHANGING
          it_outtab                     = it_output
          it_fieldcatalog               = it_fcat
        EXCEPTIONS
          invalid_parameter_combination = 1
          program_error                 = 2
          too_many_lines                = 3
          OTHERS                        = 4.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDMODULE.                 " ALV_GRID  OUTPUT
    *&      Form  alv_build_fieldcat
          text
         <--P_IT_FCAT  text
    FORM alv_build_fieldcat.
       DATA lv_fldcat TYPE lvc_s_fcat.
      CLEAR lv_fldcat.
      lv_fldcat-row_pos   = '1'.
      lv_fldcat-col_pos   = '1'.
      lv_fldcat-fieldname = 'TCODE'.
      lv_fldcat-tabname   = 'IT_OUTPUT'.
      lv_fldcat-outputlen = 8.
      lv_fldcat-scrtext_m = 'TCODE'.
      APPEND lv_fldcat TO it_fcat.
      CLEAR lv_fldcat.
       lv_fldcat-row_pos   = '1'.
      lv_fldcat-col_pos   = '2'.
      lv_fldcat-fieldname = 'PGMNA'.
      lv_fldcat-tabname   = 'IT_OUTPUT'.
      lv_fldcat-outputlen = 15.
      lv_fldcat-scrtext_m = 'PROGNAME'.
      APPEND lv_fldcat TO it_fcat.
      CLEAR lv_fldcat.
      lv_fldcat-row_pos   = '1'.
      lv_fldcat-col_pos   = '3'.
      lv_fldcat-fieldname = 'TTEXT'.
      lv_fldcat-tabname   = 'IT_OUTPUT'.
      lv_fldcat-outputlen = 60.
      lv_fldcat-scrtext_m = 'Description'.
      APPEND lv_fldcat TO it_fcat.
      CLEAR lv_fldcat.
    ENDFORM.                    " alv_build_fieldcat
    *&      Form  alv_report_layout
          text
         <--P_IT_LAYOUT  text
    FORM alv_report_layout.
       it_layout-cwidth_opt = 'X'.
       it_layout-zebra = 'X'.
    ENDFORM.                    " alv_report_layout
    PAI module of the screen created. In case we use an interactive ALV or
    *for additional functionalities we can create OK codes
    *and based on the user command we can do the coding.
    *&      Module  USER_COMMAND_0600  INPUT
          text
    MODULE user_command_0600 INPUT.
    ENDMODULE.                 " USER_COMMAND_0600  INPUT
    thanks,
    gupta

  • Add a button choice on alv toolbar in wd4a

    Hy everyone i've to add a button choice on alv toolbar. I create a node 'MY_TOOLBAR_FUNCTIONS' where add node and attributes to bind in external mapping in function_elements of alv interface controller.For button_choice I made a node 'CHOICE' and attribute 'WA_VALUE' type string. But the application dumps when create object lr_choice ; the error is WebDynpro Exception: IDs Can Only Contain Characters of Syntactical Character Set .
    May you help me? Thanks in advance.
    data:  ls_choice TYPE ig_componentcontroller=>element_choice,
              nd_choice TYPE REF TO if_wd_context_node,
    nd_choice = nd_my_functions->get_child_node( name = wd_this->wdctx_choice ).
      el_choice = nd_choice->get_element(  ).
    ls_choice-wa_value = '01'.
      APPEND ls_choice TO lt_choice.
      nd_choice->bind_table( lt_choice ).
      DATA:lr_button_choice TYPE REF TO cl_salv_wd_fe_button_choice.
      DATA:lr_choice TYPE REF TO cl_salv_wd_menu_action_item.
      lr_function = l_value->if_salv_wd_function_settings~create_function_right( id = 'MYBUTTONCHOICE' ).
      CREATE OBJECT lr_button_choice.
              EXPORTING
                sel_action_item_elementname = 'CHOICE.WA_VALUE'.
      lr_button_choice->set_text( value = 'Filter' ).
      lr_button_choice->set_tooltip( value = 'Filter').
      lr_button_choice->set_sel_action_itm_elementname( 'CHOICE.WA_VALUE' ).
      CREATE OBJECT lr_choice
        EXPORTING
          id = ls_CHOICE-WA_VALUE.
      lr_choice->set_text( 'Esito Positivo' ).
      lr_choice->set_image_source( value = 'ICON_GREEN_LIGHT').
      lr_button_choice->add_choice( lr_choice ).
      lr_function->set_editor( lr_button_choice ).

    in   CREATE OBJECT lr_choice the object id have to refer to name of node.
      CREATE OBJECT lr_choice
         EXPORTING
           id = 'CHOICE'.

  • In OO Alv toolbar, sum and subsum buttons are disable as default, WHY ?

    i want to enable sum and subsum buttons in alv toolbar. However, as default those buttons are disable. How can i solve ?

    i defined ref_table and ref_field for quantity field in fieldcat  such as  
    ls_fcat-ref_table = 'V03RB'.
    ls_fcat-ref_field = 'KWMENG'.
    so i solve it. thank you for your help.

  • 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

  • Applying ALV toolbar button funtionality in user developed button .

    Can any body tell me the step by step approch of getting  ALV toolbar button funtionality in user developed button in application toolbar ?  That is i develop one button on application toolbar and on click on this i want any one toolbar button  funtionality  on my developed button . how can i do this?

    Hi,
    To create a button on ALV list display, Like to create a "BACK" button on your ALV tool bar,, you need to first define & create a pf status then call it in your REUSE.. fm,,
    below code will explain you all the things,,
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
          EXPORTING
            i_callback_program       = sy-repid
            i_callback_pf_status_set = 'SET_PF_STATUS'   
            i_callback_user_command  = 'USER_COMMAND'
            i_grid_title             = text-001
            is_layout                = s_layout
            it_fieldcat              = i_fcat
            i_save                   = lf_save
            is_variant               = s_disvariant
          TABLES
            t_outtab                 = i_pernr[]
          EXCEPTIONS
            program_error            = 1
            OTHERS                   = 2.
    *       FORM USER_COMMAND                                             *
    FORM user_command USING ucomm LIKE sy-ucomm
    selfield TYPE slis_selfield.
      CASE ucomm.
        WHEN 'BACK'.
          leave to screen 0.
      ENDCASE.
    ENDFORM.                    "user_command                              " USER_COMMAND
    * 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 'BACK_BUTTON'.
    ENDFORM. "Set_pf_status
    First you shuld to create a GUI status for your screen dispalying the list (For this copy a GUI status from a standard program and paste it in 'BACK_BUTTON')
    then in Application Toolbar ,, Just create a button as BACK ,, Keep the FUNCTION CODE as BACK ..
    I think you got the idea, how to use any GUI for ALV list ..

  • Buttons on ALV toolbar

    Hi all,
    I have developed an ALV Grid with a button SAVE.
    The list that is displayed in ALV  will be saved to ZTABLE when user clicks the SAVE button.
    My requirement is after that , I need to add a DISPLAY to the same ALV GRID TOOLBAR.
    How can I do it? do I have to CALL METHOD g_grid->set_table_for_first_display again?
    Thanks
    MH

    Hello
    The sample report for dealing with ALV toolbar buttons is BCALV_GRID_05.
    I assume that as long as your ALV grid is editable the user should see the SAVE button. As soon as the user has saved the data the grid changes to Display-only (non-editable) and the DISPLAY button should appear.
    If so then you can use method go_grid->IS_READY_FOR_INPUT( ) within the event handler method handle_toolbar.
    The sample report explaining this method is BCALV_EDIT_01.
    Regards
      Uwe
    PS: There is no need to call go_grid->set_table_for_first_display again, simply use go_grid->refresh_table_display.

  • Add a button choice on alv toolbar in wda

    Hello Experts,
    I want add a button choice on alv toolbar. I already insert the choice button indeed I see the button correctly.
    Now I want insert the list of action with the following code:
    <<
    >>
    With this code my web-interface retuns this message: "500 SAO INTERNAL SERVER ERROR. ERROR ACCESS via null object reference not possible. (termination rabax_state)". The dump is in "cl_wdr_utilities=>construct_mime_url".
    Do you have any ideas? Do you have any examples?
    Thanks in advance.
    Best Regards,
    Marino

    Hello,
    the problem isn't "the line set_image_source". The problem was the order, the correct order is:
    <<
    CREATE OBJECT lr_button_choice.
         lr_button_choice->set_image_source( 'ICON_CHANGE' ).    "#EC *
         lr_button_choice->set_text( value = 'Modifica' ).
         lr_button_choice->set_tooltip( value = 'Modifica Attributi').
    CREATE OBJECT lr_menu_action_item
           EXPORTING
             id = 'MOD_NOTE'." TYPE REF TO cl_salv_wd_menu_action_item.
         lr_menu_action_item->set_text( 'Note').
         lr_button_choice->add_choice( EXPORTING  value = lr_menu_action_item ).
         CREATE OBJECT lr_menu_action_item
           EXPORTING
             id = 'MOD_CONTO'." TYPE REF TO cl_salv_wd_menu_action_item.
         lr_menu_action_item->set_text( 'Conto').
         lr_button_choice->add_choice( EXPORTING  value = lr_menu_action_item ).
         lr_function = wd_this->salv_incassi->if_salv_wd_function_settings~create_function( id = 'MOD')."creating the function for alv button
         lr_function->set_editor( lr_button_choice ).
    >>
    Thanks very much.
    Best Regards,
    Marino

Maybe you are looking for