Custom buttons in SORT FILTER  at  ALVs

Hi all ,
Please let me  know  how to  attach  custom   push buttons to the  Standard one  ( sort  , filter  in alvs  )
Regards
Aslam..

Hi ,
Please search SDN before posting.
There are many threads on this topic.
If you are using 'REUSE_ALV_GRID_DISPLAY'  then pass your PF status with desired functions to parameter i_callback_pf_status_set .
In factory method
  CALL METHOD go_table->set_screen_status
    EXPORTING
      report        = gv_cprog
      pfstatus      = gc_gui_status
      set_functions = go_table->c_functions_all.
Hope this helps you.
Edited by: Harsh Bhalla on Jan 6, 2010 8:48 AM

Similar Messages

  • Adding custom button in standard toolbar in ALV

    Hello All,
    I need to add a customized button called "Copy" on ALV. The following code is giving me few standard buttons like "Append" "Delete" "Insert" etc. So, how can I add "Copy" button besides one of these standard buttons.
    data: l_value type ref to cl_salv_wd_config_table.
    data: lr_table_settings type ref to if_salv_wd_table_settings.
    lr_table_settings ?= l_value.
    lr_table_settings->set_read_only( abap_false ).
    Appreciate help.
    Thks & Rgds,
    Hemal

    Create One method
    And inside that method write the below code
    (Here i  am creating delete button you can create any name button you want just replace the name
      DATA lV_EDITBTN TYPE REF TO cl_salv_wd_fe_button.
      DATA lr_buttonui TYPE REF TO cl_salv_wd_fe_button.
      CREATE OBJECT lr_buttonui.
      lr_buttonui->set_text( 'Details' ).
      lr_buttonui->set_tooltip(
      'Shows Detail Screen as per the View selected' ).
    Generating Function Object for Button.*
      DATA btn_button TYPE REF TO cl_salv_wd_function.
      btn_button = lo_value->if_salv_wd_function_settings~create_function(
                              id = 'DETAILS' ).
      btn_button->set_editor( lr_buttonui ).
      DATA lr_buttonui1 TYPE REF TO cl_salv_wd_fe_button.
    After that create another method  and make it as a event ( it means now it become event )
    select event ON FUNCTION FROM THE LIST
    Inside that event   write
    CASE LV_FCODE.
        WHEN 'DETAILS'.
           wd_this->fire_OP_TODEATILS_plg( ).
    endcase.
    May be it may help

  • Custom Button in ALV Grid standard toolbar

    Hello Experts,
    I am working on the program in which i have to add custom button to standard toolbar in ALV. I have created the button using the method as below
         data: lr_functions type ref to cl_salv_functions_list.
         lr_functions = gr_table->get_functions( ).
         lr_functions->set_default( abap_true ).
         data: l_text       type string,
               l_icon       type string.
    *    l_text = text-b01.
         l_icon = icon_complete.
         try.
           lr_functions->add_function(
             name     = 'Update Equipment Cost'
             icon     = l_icon
             text     = l_text
             tooltip  = 'Update Equipment Cost'
             position = if_salv_c_function_position=>right_of_salv_functions ).
           catch cx_salv_existing cx_salv_wrong_call.
         endtry.
    I don't understand how to add functionality to this button. I want to design the functionality as when user press button then corresponding values on the screen will be automatically get updated in the table.
    Thanks,
    Avadhut

    Hi Avadhut,
    When you want to add a custom button on ALV - better copy the GUI Status of the standard ALV to your program.  So all the function codes are copied , now you can go to the GUI_STATUS which is copied and you can mention your own function code or you can let the standard function codes as it is. You can copy the GUI of standard ALV from SE80 transaction. Let me know if you need any assistance in doing it.
    Now, if you want to write the code for any of the button on ALV -  then you need to handle it is the class.
    I used CL_SALV_TABLE - if you are using same then the below code gives you an idea of it.
    1. Create a local class in your program
    *       CLASS lcl_alv_events DEFINITION
    CLASS lcl_alv_events DEFINITION FINAL.
       PUBLIC SECTION.
         METHODS: on_user_command FOR EVENT added_function OF cl_salv_events
                                  IMPORTING e_salv_function.
    ENDCLASS.                    "lcl_alv_events DEFINITION
    DATA: gv_event_handler TYPE REF TO lcl_alv_events.
    CREATE OBJECT gv_event_handler.
    * Header object
    CREATE OBJECT gr_header.
    2. Class Implementation
       CLASS lcl_alv_events IMPLEMENTATION.
          METHOD on_user_command.
         CASE e_salv_function.
         **When PROCESS Button is selected
           WHEN '&PROC'.    ***> In my program I added Process button and fcode for it - &PROC
          ***********Write your code here ******************
        ENDCASE.
       ENDMETHOD.
    ENDCLASS.                    "lcl_alv_events IMPLEMENTATION
    3. Calling events
       data: gr_events    TYPE REF TO cl_salv_events_table,
               gr_alv       TYPE REF TO cl_salv_table.
       TRY.
           CALL METHOD cl_salv_table=>factory
             IMPORTING
               r_salv_table = gr_alv
             CHANGING
               t_table      = p_in_tab[].    ***This is my internal table data.
          gr_events = gr_alv->get_event( ).
             SET HANDLER gv_event_handler->on_user_command FOR gr_events.
         CATCH cx_salv_msg INTO lv_msg.                      "#EC NO_HANDLER
         CATCH cx_salv_not_found INTO lv_excep.              "#EC NO_HANDLER
         CATCH cx_salv_data_error.                           "#EC NO_HANDLER
       ENDTRY.
    Regards,
    Rafi

  • What Custom button in ALV has been clicked?

    Hi Experts,
    I have written one WDC where in i have created an ALV with two custom buttons in it. One is to Search the company code with Function code as 'SEARCH', and the other is to export the result in to an excel file, this button function code is 'EXPORT'.
    I have created these two buttons in the WDDOINIT method of the view, say MAIN.
    I have created a method, say 'function_button' in the MAIN for the event ON_FUNCTION, to handle any events that happens on these custom buttons.
    The problem is whatever the customized button i click in the ALV the entire code of the method 'FUNCTION_BUTTON' is being executed.
    Now, I want to get the function code of the button clicked in my ALV, so that i can only execute the portion of the code that needs to be executed.
    Please let me know the ways to tackle this problem.
    Thanks in advance.
    Good day!

    Hi Shashi,
    Check the following blog to handle ALV custom function.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/101df93f-4b5c-2910-14aa-9eb0338c2110
    Regards,
    Karthick S

  • Custom button in alv and disabling all buttons in application tool bar

    Experts,
    Could you please  help me for the below requirements.
    1). How to disable all the buttons (like sorting, print, find, set filter...etc.) in tool bar using oops?
    2). Where can I add my custom download button in alv report using oops?
    Thanks in advance...
    Sridhar..

    Step1:
    Create on local class
    Class <LCL_EVENT_RECEIVER> Definition
    Define the below public methods.
    Method Name     HANDLE_TOOLBAR
    Event Name     TOOLBAR
    Event Class     CL_GUI_ALV_GRID
    Importing     E_OBJECT, E_INTERACTIVE
    Method Name     HANDLE_USER_COMMAND
    Event Name     USER_COMMAND
    Event Class     CL_GUI_ALV_GRID
    Importing     E_UCOMM
    Class <LCL_EVENT_RECEIVER> Implementation 
    .     Method HANDLE_TOOLBAR
         Declare the structure <LS_TOOLBAR> of structure type STB_BUTTON
         Append the button information as given below into table E_OBJECT->MT_TOOLBAR to         display the custom button on ALV grid.
                               LS_TOOLBAR-FUNCTION = u2018DOWNu2019
                         LS_TOOLBAR-QUICKINFO = u2018downloadu2019
                         LS_TOOLBAR-TEXT = u2018downloadu2019
         Method HANDLE_USER_COMMAND
    In this method if E_UCOMM = u2018DOWNu2019 write your logic.
    Step2:
    1.     To excluding the ALV grid buttons, fill the <LT_EXC> with function code CL_GUI_ALV_GRID=>MC_FC_EXCL_ALL
    2.     To generate the ALV Grid, call the method SET_TABLE_FOR_FIRST_DISPLAY
    Class     CL_GUI_ALV_GRID
    Method Name     SET_TABLE_FOR_FIRST_DISPLAY
    Exporting     
    I_STRUCTURE_NAME      ZDS_CM_EXT_SEL
    LS_LAYOUT                    <LS_LAYOUT>
    IT_TOOLBAR_EXCLUDING     <LT_EXC>
    Changing     
    IT_OUTTAB                    <GT_EXT_SEL>
    Create the Instance for class <LCL_EVENT_RECEIVER>
    Class     <LCL_EVENT_RECEIVER>
    Instance Name     <LO_EVENT_FNAME>
    Now set handler  <HANDLE_USER_COMMAND> and <HANDLE_TOOLBAR_FNAME> events using instance <LO_EVENT_FNAME>
    Call method 'SET_TOOLBAR_INTERACTIVE' to raise event TOOLBAR
    Class     CL_GUI_ALV_GRID
    Instance Name     <GO_GRID>
    Method Name     SET_TOOLBAR_INTERACTIVE

  • Cant use Export to Excel functionality for ALV if I add a custom button

    Hi,
      I have added a custom button the the ALV toolbar by creating a GUI status and using the USER_COMMAND event. However. Now I dont the get the standard ALV toolbar with all the options for sorting, exporting to excel etc.
      Can someone show me how I can do both, add my own button to the toolbar as well as use ALV Grid toolbar. Currently the ALV grid standard toolbar has disappeared
    Thanks for reading

    Hello,
    I am not sure how you are creating your ALV report.  If you are using FM REUSE_ALV_GRID_DISPLAY there is a parameter callled I_CALLBACK_PF_STATUS .  Read the documentation for this field from the doc for the FM.  It tells you to copy a standard PF status from fucn group SLVC_FULLSCREEN and then add your new button to that staus.
    If you are using class CL_SALV_MODEL_BASE there is a method called set_screen_status that lets you do a similar thing - copy an existing PF status and add your button.
    Hope that helps
    Regards
    Greg Kern

  • How to filter standard ALV report with custom UI element?

    Hello Expert,
    I got a requirement to filter standard ALV report based on the custom UI element (which is created in the screen before displaying the ALV report). Upon entering the values in the Custom field, the ALV report is displayed accordingly.
    Any ideas how to approach it?
    Thanks,
    Mohammed

    Hi,
    Okay, let me explain the steps in detail
    Let us say you have alv table with 10 records and alv table is shown first time with all 10 records
    Create an internal table in component controller's attribute GT_ORIGINAL_DATA and save all 10 records into this table first time
    Now, user enters value in FILTER_MATNR field 123 and press apply_filter button or press enter key
    Read the value of field filter_matnr and get the only matching records from global internal table GT_ORIGINAL_DATA into local internal table as below
              data lv_matnr type matnr.
              data lt_data   like wd_comp_controller->gt_original_data.
                   " read the value from context attribute of filter_matnr
                        lv_matnr = ???
                   " copy all data into local table
                        lt_data[] = wd_comp_controller->gt_original_data.
                   "delete the records which does not match
                     delete lt_data where matnr NP lv_matnr.
    Now, bind the data lt_data to context node of alv table
    Hope this helps you.
    Regards,
    Rama

  • How to Calculate sum for the selected rows in ALV gird using custom button

    Hi I am trying to implement an ALV Grid display where the user can select few rows in the output and if he click on some custom button he should get the sum for only those rows.
    Can anyone give me some idea regarding this.
    Thanks in advance

    While building the fieldcatalog for amount field use gt_fieldcat-do_sum = 'X'. And use the below for doc type sorting and subtotal.
    *  ALV data declarations
      data: it_sortcat   type slis_sortinfo_alv occurs 1,
            wa_sort like line of it_sortcat.
    perform build_sortcat.
    *&      Form  build_sortcat
    *       Build Sort catalog
    FORM build_sortcat .
      wa_sort-spos      = 1.
      wa_sort-fieldname = 'EBELN'.
      wa_sort-SUBTOT    = 'X'. "subtotals any totals column by this field
    *  gd_sortcat-tabname
      APPEND wa_sort TO it_sortcat.
      wa_sort-spos      = 2.
      wa_sort-fieldname = 'EBELP'.
    *  gd_sortcat-tabname
      APPEND wa_sort TO it_sortcat.
    ENDFORM.                    " build_sortcat
    call function 'REUSE_ALV_LIST_DISPLAY'
           exporting
                i_callback_program      = gd_repid
                i_callback_top_of_page   = 'TOP-OF-PAGE'
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
                it_sort                 = it_sortcat
                i_save                  = 'X'
           tables
                t_outtab                = it_ekko
           exceptions
                program_error           = 1
                others                  = 2.
    Regards,
    Chandru

  • ALV  issue - capturing user changes in editable fields using custom button?

    Hi,
    I created a custom button in ALV tool bar.   And also in my ALV grid I have couple of fields Editable option. User can change values for these 2 fields.
    My question is -
    After changing values for these editable fields(more than 1 record)  , user will click on custom button and then I have to update all the user changed values in to my internal table(lt_tab)  and then I have to process logic.
    Problem is when user click on Custom button in ALV tool bar it is not having the changed values in lt_tab table.
    Only when user clicks  some thing on ALV grid records or fields then it is getting all the changed values in to lt_tab.
    Can any one tell me how I can get changed values when user clicks on custom button?
    1. Can we place custom button in ALV Grid? instead of ALV tool bar? 
    or
    How I can capture user changes when they click on custom button?
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    TABLES
          T_OUTTAB                          = lt_tab
    Please check this logic-
    CASE r_ucomm.
        WHEN '&IC1'.
    - It_tab  having all changed field values
      WHEN 'custom button'.
          lt_tab  - not having any changed values - showing all initial lt_tab values.
    I highly appreciate your answers on this.
    Thanks.
    Rajesh.

    Hi,
    Use this code, its working:-
    *&      Form  ALV_DISPLAY
    *       SUB-ROUTINE ALV_DISPLAY IS USED TO SET THE PARAMETERS
    *       FOR THE FUNCTION MODULE REUSE_ALV_GRID_DISPLAY
    *       AND PASS THE INTERNAL TABLE EXISTING THE RECORDS TO BE
    *       DISPLAYED IN THE GRID FORMAT
    FORM alv_display .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
    *     I_INTERFACE_CHECK                 = ' '
    *     I_BYPASSING_BUFFER                = ' '
    *     I_BUFFER_ACTIVE                   = ' '
         i_callback_program                = v_rep_id       " report id
         i_callback_pf_status_set          = 'PF'           " for PF-STATUS
         i_callback_user_command           = 'USER_COMMAND' " for User-Command
    *     I_CALLBACK_TOP_OF_PAGE            = ' '
    *     I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
    *     I_CALLBACK_HTML_END_OF_LIST       = ' '
    *     I_STRUCTURE_NAME                  =
    *     I_BACKGROUND_ID                   = ' '
    *     I_GRID_TITLE                      =
    *     I_GRID_SETTINGS                   =
         is_layout                         = wa_layout      " for layout
         it_fieldcat                       = it_field       " field catalog
    *     IT_EXCLUDING                      =
    *     IT_SPECIAL_GROUPS                 =
         it_sort                           = it_sort        " sort info
    *     IT_FILTER                         =
    *     IS_SEL_HIDE                       =
    *     I_DEFAULT                         = 'X'
         i_save                            = 'A'
         is_variant                        = wa_variant     " variant name
    *     IT_EVENTS                         =
    *     IT_EVENT_EXIT                     =
    *     IS_PRINT                          =
    *     IS_REPREP_ID                      =
    *     I_SCREEN_START_COLUMN             = 0
    *     I_SCREEN_START_LINE               = 0
    *     I_SCREEN_END_COLUMN               = 0
    *     I_SCREEN_END_LINE                 = 0
    *     I_HTML_HEIGHT_TOP                 = 0
    *     I_HTML_HEIGHT_END                 = 0
    *     IT_ALV_GRAPHICS                   =
    *     IT_HYPERLINK                      =
    *     IT_ADD_FIELDCAT                   =
    *     IT_EXCEPT_QINFO                   =
    *     IR_SALV_FULLSCREEN_ADAPTER        =
    *   IMPORTING
    *     E_EXIT_CAUSED_BY_CALLER           =
    *     ES_EXIT_CAUSED_BY_USER            =
        TABLES
          t_outtab                          = it_final      " internal table
       EXCEPTIONS
         program_error                     = 1
         OTHERS                            = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                    " ALV_DISPLAY
    *&      Form  USER_COMMAND
    *       SUB-ROUTINE USER_COMMAND IS USED TO HANDLE THE USER ACTION
    *       AND EXECUTE THE APPROPIATE CODE
    *      -->LV_OKCODE   used to capture the function code
    *                     of the user-defined push-buttons
    *      -->L_SELFIELD   text
    FORM user_command USING lv_okcode LIKE sy-ucomm l_selfield TYPE slis_selfield.
    * assign the function code to variable v_okcode
      lv_okcode = sy-ucomm.
    * handle the code execution based on the function code encountered
      CASE lv_okcode.
    * when the function code is EXECUTE then process the selected records
        WHEN 'EXECUTE'. "user-defined button
    * to reflect the data changed into internal table
          DATA : ref_grid TYPE REF TO cl_gui_alv_grid. "new
          IF ref_grid IS INITIAL.
            CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
              IMPORTING
                e_grid = ref_grid.
          ENDIF.
          IF NOT ref_grid IS INITIAL.
            CALL METHOD ref_grid->check_changed_data.
          ENDIF.
    * refresh the ALV Grid output from internal table
          l_selfield-refresh = c_check.
      ENDCASE.
    ENDFORM.
    This will reflect all the changes in the internal table. Now you can include your logic as per your requirement.
    Hope this solves your problem.
    Thanks & Regards,
    Tarun Gambhir

  • 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.

  • Custom button  on ALV report for Tcode FL10G ?

    Hi All,
    I want to add custom button in the AVL report for FL10G transaction.  And then need to implement logic for that button (calling BAPI to create shipment for the selected records).
    For VL10G alv program GUI Status - STANDARD001  I think I can add button in this gui by using access key.
    But how to implement logic for this custom button?  Where I can put the code for this button logic?
    Please let me know if any one has any ideas on this issue.
    I appreciate your help and time on this.
    Thanks.
    M

    Hi Murali,
    The standard program it will not allow to copy the GUI Status. Because source and target program should not same.
    It will definitely debug will work. Yo can create the GUI Status through SE41. In SE41 Just give Program name :SAPLV50R_VIEW click the button status. here you should not give any gui status. just blindy say create the then it will popup screen appears in the screen. Here you can mention your Z GUI Status. It is not required to create all the menus manually instead of the there is button which is located in the screen next to blue i button. here you can click and select the standard interface. You can get all the menus as similar to standard. Like that you should create Menu Bar, Application Toolbar and Function Keys  Menus. Then you can add your custom button in the Application tool bar button.
    When you execute the Transaction VL10G and check your cusom menu button will appears. Once you click custom button only exit will trigger. Find the below code for your reference.
    CODE
            loop at ct_postab assigning <fs>
                    where selkz = 'X'.
    *To Fill the BAPI  Header Parameters
                  str_ordhdr-ship_cond = w_sval-value.
    *To Fill the BAPI  HeaderX Parameters
                  str_ordhdrx-updateflag = 'U'.
                  str_ordhdrx-ship_cond = 'X'.
                  call function 'BAPI_SALESORDER_CHANGE'
                    exporting
                      salesdocument    = <fs>-vbelv
                      order_header_in  = str_ordhdr
                      order_header_inx = str_ordhdrx
                    tables
                      return           = str_return.
                endloop.
                read table str_return into w_return index 1.
                if sy-subrc eq 0.
                  if not w_return-type = 'S'.
                    message w_return-message type 'E'.
                    leave to current transaction.
                  endif.
                endif.
    *Do the BAPI Commit
                call function 'BAPI_TRANSACTION_COMMIT'
                  exporting
                    wait = 'X'.
              endif.
            endif.
          endif.
    Let me know if you have anything to discuss on the same.

  • How to disable the custom button on alv?

    Hi All,
                       i created a ALV Report .I created a Custom Button on ALV.Based on the input value i need to enable/disable  that Button.
    How can i achieve?And what are the methods i need to code?
    Regards
    Ravi

    Hi Ravi,
       You create the button like this:
    Data: mr_functions type ref to IF_SALV_WD_FUNCTION_SETTINGS,
             mr_button_func type ref to CL_SALV_WD_FUNCTION
      mr_functions ?=  mr_alv_model.
      CALL METHOD mr_functions->create_function
        EXPORTING
          id    = '<<Button Id>>'
        RECEIVING
          value = mr_button_func.
      CREATE OBJECT mr_button.
      mr_button->set_text( 'some text' ).
      mr_button_func->set_editor( mr_button ).
    to sent enable/disable
    mr_button->set_enabled(abap_false).
    hope this will serve your purpose.
    Regards,
    Ritwik.

  • Custom Buttons in ALV Grid

    Hi Experts,
    I have a ALV grid. I have added some custom buttons to it.
    I want to change dynamically enable of disable some of the buttons in the ALV.
    Please help me through.
    I tried free, clear refresh for the grid object, control object and the event handler objects also.
    still I get the old buttons when i execute the program.
    Thanks.

    Hi,
    class lcl_event_receiver implementation.
      method handle_toolbar.
    IF OK_CODE EQ 'XYZ'.
    * append an icon to show booking table
        clear ls_toolbar.
        move 'BOOKINGS' to ls_toolbar-function.
        move 'Show Bookings'(111) to ls_toolbar-quickinfo.
        move 'Detail'(112) to ls_toolbar-text.
        move ' ' to ls_toolbar-disabled.                         " Enable
        append ls_toolbar to e_object->mt_toolbar.
      clear ls_toolbar.
        move 'FILGHT' to ls_toolbar-function.
        move 'Show Flight'(113) to ls_toolbar-quickinfo.
        move 'FlightDetail'(114) to ls_toolbar-text.
        move 'X' to ls_toolbar-disabled.                            " Disable
        append ls_toolbar to e_object->mt_toolbar.
    ELSE.
    * append an icon to show booking table
        clear ls_toolbar.
        move 'BOOKINGS' to ls_toolbar-function.
        move 'Show Bookings'(111) to ls_toolbar-quickinfo.
        move 'Detail'(112) to ls_toolbar-text.
        move 'X' to ls_toolbar-disabled.
        append ls_toolbar to e_object->mt_toolbar.
    * append an icon to show booking table
        clear ls_toolbar.
        move 'FILGHT' to ls_toolbar-function.
        move 'Show Flight'(113) to ls_toolbar-quickinfo.
        move 'FlightDetail'(114) to ls_toolbar-text.
        move ' ' to ls_toolbar-disabled.
        append ls_toolbar to e_object->mt_toolbar.
    ENDIF.
      endmethod.
    Endclass.
    call method grid1->set_table_for_first_display
             exporting i_structure_name = 'SFLIGHT'
                       is_layout        = gs_layout
             changing  it_outtab        = gt_sflight.
        create object event_receiver.
        set handler event_receiver->handle_user_command for grid1.
        set handler event_receiver->handle_toolbar for grid1.
        call method grid1->set_toolbar_interactive.
    call method sender->refresh_table_display.
      set handler event_receiver->handle_toolbar for grid1.
        call method grid1->set_toolbar_interactive

  • Error when Calling a BAPI in ALV custom button "could not ascertain code"

    Hi,
    I am getting the error "Could not ascertain code page" when i try to call my BAPI (to export to excel sheet) on click of a custom button in ALV.
    I have done the creation and event handling etc for the custom button.
    Kindly help if anybody knows this error.
    Thanks
    Roshan

    I am creating a custom export button(after disabling the standard export button) to download the data into an excel sheet in my own format. I have created the new button. The code is given here.
    data lr_buttonui2 type ref to cl_salv_wd_fe_button.
    data input2 type ref to cl_salv_wd_function.
    data: lr_column_settings type ref to   if_salv_wd_column_settings,
    lr_input_field type ref to cl_salv_wd_uie_input_field.
    create object lr_buttonui2.
    call method lr_buttonui2->set_text
      exporting
        value  = 'Export'
      input2 = lo_value->if_salv_wd_function_settings~create_function( id = 'EXPORT' ).
      input2->set_editor( lr_buttonui2 ).
    data lr_ref3 type ref to cl_salv_wd_fe.
      call method input2->get_editor
        receiving
          value  = lr_ref3
    I have also created the event handler for my button and written the below code thr. I am caling a BAPI to download the data into my excel format. The problem is coming here only.
    data: lt_return type table of bapiret2.
    data lo_nd_methcode type ref to if_wd_context_node.
      data lo_el_methcode type ref to if_wd_context_element.
      data ls_methcode type wd_this->element_methcode.
      data lv_methcode like ls_methcode-methcode.
    navigate from <CONTEXT> to <METHCODE> via lead selection
      lo_nd_methcode = wd_context->get_child_node( name = wd_this->wdctx_methcode ).
    get element via lead selection
      lo_el_methcode = lo_nd_methcode->get_element(  ).
    get single attribute
      lo_el_methcode->get_attribute(
        exporting
          name =  `METHCODE`
        importing
          value = lv_methcode ).
    call function 'ZBAPI_EXCEL_DLOAD_METHODOLOGY'
      exporting
        i_methcode       = lv_methcode
      tables
        et_return        = lt_return
    Plz give me a solution

  • ALV custom buttons - translations

    Hello all,
    I have added custom buttons in a ALV report which have texts like Display/Change, Refresh......  How to provide translations for these buttons. The requirement is when the user logs in Finnish language the user should see these buttons with the finnish texts. I have the finnish texts with me but dont know how to proceed.
    Thanks

    Check the pointed reply on this thread -
    PUSH BUTTON text and tooltip dynamic in module pool
    Regards,
    Amit

Maybe you are looking for