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

Similar Messages

  • 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

  • How to add Custom button to existing ALV toolbar

    Hi,
    I want to add custom buttons for varaints in the existing row PRINT VERSION/EXPORT
    How do we do that?
    Rgds
    Vara

    I have used the standard component u2018salv_wd_tableu2019 in my application and will be able to give example by adding a button named 'NEW__BUTTON' .
    In the WDDOINIT method of the component controller, use the following code to define column name, your own buttons, visible column for the same component usage.
    DATA:
    lr_salv_wd_table_usage TYPE REF TO if_wd_component_usage,
    lr_salv_wd_table TYPE REF TO iwci_salv_wd_table.
    *Check ALV component usage
    lr_salv_wd_table_usage = wd_this->wd_cpuse_alv( ).
    IF lr_salv_wd_table_usage->has_active_component( ) IS INITIAL.
    lr_salv_wd_table_usage->create_component( ).
    ELSE.
    lr_salv_wd_table_usage->delete_component( ).
    lr_salv_wd_table_usage->create_component( ).
    ENDIF.
    *Get ALV component
    lr_salv_wd_table = wd_this->wd_cpifc_alv( ).
    wd_this->mr_table type ref to CL_SALV_WD_CONFIG_TABLE.
    *Get ConfigurationModel from ALV Component
    wd_this->mr_table = lr_salv_wd_table->get_model( ).
    *Set table settings
    DATA:
    lr_table_settings TYPE REF TO if_salv_wd_table_settings.
    lr_table_settings ?= wd_this->mr_table .
    lr_table_settings->set_visible_row_count( '5' ).
    lr_table_settings->set_width( '100%' ).
    DATA:
    lr_header TYPE REF TO cl_salv_wd_header,
    l_header_text TYPE string.
    lr_header = lr_table_settings->get_header( ).
    l_header_text = cl_wd_utilities=>get_otr_text_by_alias( 'NEW__BUTTON' ).
    lr_header->set_text( l_header_text ).
    lr_header->set_tooltip( l_header_text ).
    "lr_table_settings->set_selection_mode( cl_wd_table=>e_selection_mode-multi_no_lead ).
    *Set functions
    IF wd_this->mb_no_maintain NE abap_true.
    DATA:
    lr_function TYPE REF TO cl_salv_wd_function,
    lr_fe_button TYPE REF TO cl_salv_wd_fe_button,
    l_btn_text TYPE string.
    *Add the button here for validation on the top of the ALV
    *This is where you add the buttons on the same ROW.
    lr_function = lr_functions->create_function( 'NEW__BUTTON' ).
    CREATE OBJECT lr_fe_button.
    l_btn_text = cl_wd_utilities=>get_otr_text_by_alias( 'NEW__BUTTON' ).
    lr_fe_button->set_text( l_btn_text ).
    lr_fe_button->set_tooltip( l_btn_text ).
    lr_function->set_editor( lr_fe_button ).
    After defining the buttons 'NEW__BUTTON' , handle the actions for the same using the method u2018LIST_ACTIONu2019 which should have the event as u2018ON_FUNCTIONu2019, controller as u2018interface controlleru2019 and component use as the name you have given say u2018ALVu2019.
    In the method u2018LIST_ACTIONu2019, handle the actions as below. This method will have the following importing parameters.
    WDEVENT Importing CL_WD_CUSTOM_EVENT
    R_PARAM Importing IF_SALV_WD_TABLE_FUNCTION
    method list_action .
    case r_param->id .
    when  'NEW__BUTTON'.
    "Do the validation here-"
    endcase.
    endmethod.
    Thanks,
    Rajkumar.S

  • Help on Button Choice of alv tool bar

    Hai , i created a button choice on the ALV tool bar .
    and now problem is how to capture the choices i.e how to check which choice is selected on the button?
    i defined an event handler methos with refernce to the event ON_FUNCTION of the alv.
    Please help me , its urgent,
    Madhuh

    Hi Madhuh,
    could you help me? I have a similar issue. It seems that you are one step ahead cause for me it is not possible to see the button choice in ALV.
    How did you set the button choice object to the ALV toolbar?
    I tried following:
      DATA: lr_interfacecontroller TYPE REF TO iwci_salv_wd_table,
            lr_alv_conf            TYPE REF TO cl_salv_wd_config_table,
            lr_func_settings       TYPE REF TO if_salv_wd_function_settings,
            lr_function            TYPE REF TO cl_salv_wd_function,
            lr_menu_action         TYPE REF TO cl_salv_wd_menu_action_item,
            lr_button_choice       TYPE REF TO cl_salv_wd_fe_button_choice,
    * create button choice
      CREATE OBJECT lr_button_choice.
    * function ID (need for field propeties?!)
      lr_function = lr_func_settings->create_function( 'BTN_CREATE_ETA' ).
    * set text
      lv_text = cl_wd_utilities=>get_otr_text_by_alias( '/SCMTMS/UI_COMMON/CREATE_ETA' ).
      lr_button_choice->set_text( lv_text ).
    * create menu objects for the categories depending on allowed categories:
      LOOP AT lt_value_set INTO ls_value_set.
        CONCATENATE 'CREATE_ETA' ls_value_set-key INTO lv_id.
        lv_text = ls_value_set-value.
    *   create menu action now
        CREATE OBJECT lr_menu_action
          EXPORTING
            id = lv_id.
        lr_menu_action->set_text( lv_text ).
    *   Add action menu to button choice
        lr_button_choice->add_choice( lr_menu_action ).
      ENDLOOP.
      lr_function->set_editor( lr_button_choice ).
    But that dumps in my case inside wd salv coding because of last statement. Is that the right way to do?
    Do you have a context mapping to the interface controller of ALV for that function? If yes how does it look like.
    Thanks in advance for your help!
    Regards Rico

  • 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

  • How to add multiple button/choices in  button choice

    HI all ,
            How to add multiple button/choices in  button choice ?

    Initialize a cluster array (CrsrList type) with as many cursors as you think you would ever need.   Setup your cursors dynamically, then delete the unused cursors (array elements) and then update your CursorList property.
    Message Edited by vt92 on 03-20-2009 04:04 PM
    "There is a God shaped vacuum in the heart of every man which cannot be filled by any created thing, but only by God, the Creator, made known through Jesus." - Blaise Pascal
    Attachments:
    cursors.PNG ‏5 KB

  • How to add a button on the ALV LIST pop up

    Hi ,
    Can any one help me to add a button on the ALV list which is a pop up using ABAP Objects.
    Thanks in advance.
    Regards,
    Kavya.

    HI ,
    I want to add a push button on the ALV list out put which is comming as a pop up and I want this using classes and methods.
    I have got a method IF_SREL_BROWSER_COMMANDS~ADD_BUTTONS from class cl_gos_attachment_list  but still I am unable to get any additional button on the output ALV popup.
    Please help.
    Regards,
    Kavya.

  • Why are Add-on Buttons along with the Toolbar keep disappearing in the Firefox4,5&9?

    I arrange all the Add-on Buttons on a Toolbar created for this specific purpose(Options - Toolbar Layout - Add New Toolbar). I recently upgraded from Firefox 3.6 to Firefox 12 and that's when the trouble started.All the Add-on Buttons along with the Toolbar started disappearing.I checked if any of the add-on (one by one)is causing this problem but found nothing.But the Add-on Buttons work fine when arranged on the Status Bar(now the so called Addon Bar).
    Later I found out that this particular problem exists in all the Browsers based on Firefox's latest version(Pale Moon,Cometbird,Wyzo,Epic etc). That means something is causing this toolbar to disappear in the latest versions of Firefox(i.e., Firefox 4,5,10 and Firefox 12). So please help me to rectify this problem.I am impressed by the improvements made in the latest versions of Firefox but due to this problem Firefox has become useless for me.
    Don't tell me about "places.sqlite" "localstore.rdf" and all that shit.I've searched the whole God damned Web,Tried changing to new Profile,Deleted localstore.rdf and saw whether it will work.This is my last resort. Firefox 3.6 was a great browser.Within a span of one year you morons have jumped from Firefox v3.6 to Firefox v12! Not allowing the Extension ecosystem to stabilize.Giving no time to apps developers to catchup.The App developers have fallen behind and half of my addons are not working.You people have become an example on how to kill a great product.The guys at MS might be watching in delight the Firefox's harakiri!
    Thank You,
    Helme.

    Since I only ever put add-on buttons on the main Navigation toolbar (or the Add-ons bar) rather than my own custom bar, I haven't experienced this myself.
    Can you detect a pattern with particular add-ons' buttons (or native Firefox buttons) being removed time and again?
    In your new profile test, did you add extensions one at a time (one per restart of Firefox), or otherwise try to isolate particular add-ons as the issue? (Bugzilla has at least one example of an extension causing a problem with custom toolbars: [https://bugzilla.mozilla.org/show_bug.cgi?id=667627 667627 – divx html5 removes added toolbars]. I don't see this particular extension on your list.)
    I wonder whether some extensions now include some kind of grooming function or incompatibility that removes their buttons from custom toolbars? It would be easier to investigate with some problem examples.

  • How  to add a button to the Standard Toolbar in ALV ?

    Hi All,
          If i add a button it should be displayed along with
          the  standard icons of the toolbar.
          Plz guide me.
          Thx in advance.

    Hi Albert.
    You need to do a few things for that :
    - Create your own GUI status by copying STANDARD_FULLSCREEN from function group SLVC_FULLSCREEN.
    - Set your own PF-Status using the Exclude table because otherwise your exclude table would become meaningless.
    - define a subroutine to handle the user commands.
    Sample implementation :
    FORM pf_status USING extab TYPE slis_t_extab.
      extab = pf_exclude.   
      SET PF-STATUS 'STANDARD' EXCLUDING extab.       
    ENDFORM.                    "PF_STATUS
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program       = repid
          i_callback_user_command  = 'USER_COMMAND'
          i_callback_pf_status_set = 'PF_STATUS'
          is_layout                = layout
          it_fieldcat              = fieldcat
          it_excluding             = pf_exclude
        TABLES
          t_outtab                 = itab
        EXCEPTIONS
          OTHERS                   = 0.
            FORM user_command  USING r_ucomm LIKE sy-ucomm
                                       rs_selfield TYPE slis_selfield.
    ENDFORM.
    Please reward points if found helpful.

  • How to add a button to an alv standar report

    Hi all,
    I've got a requiremnt to modify the behaviour of the edit button of the ALV in TX vfx3.
    When the edit button pressed, the requiered behaviour is to navigate to a Z TX. Is it possible to edit the ALV without creating a new Z alv? Just changing the standard?
    Edited by: Iñaki Nolte Usparicha on Dec 29, 2010 12:18 PM

    Hi Iñaki, you have to copy (using transaction SE41) Status-GUI "standard" from program SAPLSALV, with the same name as our program. Delete all unnecessary components and add your custom button.
    In the program you have to add:
    Form F_SET_PF_STATUS USING rt_extab TYPE slis_t_extab.
         SET PF-STATUS 'STANDARD'.
    Endform.
    Form f_user_command USING      r_ucomm LIKE sy-ucomm
                                                                  rs_selfield TYPE slis_selfield.
         CASE r_ucomm.
                  WHEN '%NF'. "NF is the name of the button
                        PERFORM f_do_something.
           ENDCASE.
    Endform.

  • Why can't I add a button to my Bookmarks toolbar?

    I'm trying to add the Flipboard bookmarklet to my Bookmarks toolbar as per Flipboard's instructions (see: http://share.flipboard.com). My Bookmarks toolbar is visible but I can't get Firefox to let me drag and drop the bookmarklet onto the toolbar. I'm at a loss so any suggestions would be welcome. Thanks!

    The bookmarklet tries to open a pop-up window.
    I get a pop-up that opens the login page.
    *https://share.flipboard.com/u/login?done=/bookmarklet/popout?v=2&title=Flipboard&url=https://share.flipboard.com/&t=1390930979228&fromBookmarklet=1
    It is possible that you run into this pop-up maximum (the default value is 20).
    * http://kb.mozillazine.org/dom.popup_maximum
    You can open the <b>about:config</b> page via the location bar
    *http://kb.mozillazine.org/about:config
    You can inspect and manage the permissions for all domains on the <b>about:permissions</b> page or for the domain in the currently selected tab via these steps:
    *Click the "Site Identity Button" (globe/padlock) on the location bar
    *Click "More Information" to open "Page Info > Security"
    *Go to the Permissions tab (Tools > Page Info > Permissions) to check the permissions for the domain in the currently selected tab

  • How we can add the 2 buttons on the alv out screen.

    I have a requirement, i want to add two buttons on the application bar on the ALV report out.
    with the use of grid functional module.
    for example: i want to buttons details and balance on the ALV output screen. if i click on detail it will display the details and if i click on balance it will show the balance data in report.
    and if i use the back and exit that time it will come out the selection screen.
    please send me any exiting report its very urgent.

    Hi frnd,
    To add additional button in the application toolbar,
    First copy the std toolbar from std sap program,
    In se 41 give
    program name = SAPLKKBL
    copy staus.
    Use own status (Copy STANDARD from SAPLKKBL)
      SET PF-STATUS 'STANDARD_NEW' .(in this new user defined status add ur buttons)
    steps:
    then in the ''REUSE_ALV_GRID_DISPLAY' function module
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                i_callback_program       = gv_repid
                i_callback_user_command  = EVENT_USER_COMMAND
                i_callback_pf_status_set = EVENT_SET_STATUS_01
                i_grid_title             = gc_tit
                is_layout                = gt_layout
                it_fieldcat              = gt_fieldcat[]
           TABLES
                t_outtab                 = gt_lfa1
           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.
    FORM     event_set_status_01  USING  lt_excl  TYPE  slis_t_extab.
    Use own status (Copy STANDARD from SAPLKKBL)
      SET PF-STATUS 'STANDARD' .
    ENDFORM.                    "EVENT_SET_STATUS_01
    *& Form Name:  event_user_command                                      *
    *& Form Desc:  For Handling USER_COMMAND                               *
    FORM     event_user_command  USING
                                        if_ucomm     TYPE  sy-ucomm
                                        is_selfield  TYPE  slis_selfield.
      CASE if_ucomm.
        WHEN 'PRINT'.
      endcase.
    endform

  • Need to Add a button in ALV Tool Bar

    Hi,
    I have a requirement where in i need to add a button to a standard ALV report. Its using the class CL_GUI_ALV_GRID. There is a Badi for the report. The Report is co05n and the Badi is WORKORDER_INFOSYSTEM . I am getting the handle of
    CL_GUI_ALV_GRID object reference before screen display. Any guidance on how to add new button now to that toolbar?
    Any help will be rewarded.
    Thank you.
    regards,
    Deepthi lakshmi.A.

    Dear Deepthi Lakshmi.A.,
    Refer the standard program BCALV_GRID_05                  Add a Self-Defined Button to the Toolbar.
    PROGRAM BCALV_GRID_05.
    Purpose:
    ~~~~~~~~
    Demonstrate the creation of an own toolbar button.
    To check program behavior
    ~~~~~~~~~~~~~~~~~~~~~~~~~
    The report shows a list of flights of one airline.
    Select one or more lines and press the 'Detail'-Button to popup
    a dialog window with related bookings.
    Essential steps (Search for '§')
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1.Apply steps for event handling for events TOOLBAR and
      USER_COMMAND (see example for print events)
    2.In event handler method for event TOOLBAR: Append own functions
      by using event parameter E_OBJECT.
    3.In event handler method for event USER_COMMAND: Query your
      function codes defined in step 2 and react accordingly.
    4.Call method 'set_toolbar_interactive' to raise event TOOLBAR.
    INCLUDE .
    Predefine a local class for event handling to allow the
    declaration of a reference variable before the class is defined.
    CLASS lcl_event_receiver DEFINITION DEFERRED.
    DATA: ok_code LIKE sy-ucomm,
          gt_sflight TYPE TABLE OF sflight,
          gt_sbook TYPE TABLE OF sbook,
          g_repid LIKE sy-repid,
          g_max type i value 100,
          gs_layout   TYPE lvc_s_layo,
          cont_on_main   TYPE scrfname VALUE 'BCALVC_TOOLBAR_D100_C1',
          cont_on_dialog TYPE scrfname VALUE 'BCALVC_TOOLBAR_D101_C1',
          grid1  TYPE REF TO cl_gui_alv_grid,
          grid2  TYPE REF TO cl_gui_alv_grid,
          custom_container1 TYPE REF TO cl_gui_custom_container,
          custom_container2 TYPE REF TO cl_gui_custom_container,
          event_receiver TYPE REF TO lcl_event_receiver.
    Set initial dynpro
    SET SCREEN 100.
    LOCAL CLASSES: Definition
    *===============================================================
    class lcl_event_receiver: local class to
                            define and handle own functions.
    Definition:
    ~~~~~~~~~~~
    CLASS lcl_event_receiver DEFINITION.
      PUBLIC SECTION.
        METHODS:
        handle_toolbar
            FOR EVENT toolbar OF cl_gui_alv_grid
                IMPORTING e_object e_interactive,
        handle_user_command
            FOR EVENT user_command OF cl_gui_alv_grid
                IMPORTING e_ucomm.
      PRIVATE SECTION.
    ENDCLASS.
    lcl_event_receiver (Definition)
    *===============================================================
    LOCAL CLASSES: Implementation
    *===============================================================
    class lcl_event_receiver (Implementation)
    CLASS lcl_event_receiver IMPLEMENTATION.
      METHOD handle_toolbar.
    § 2.In event handler method for event TOOLBAR: Append own functions
      by using event parameter E_OBJECT.
        DATA: ls_toolbar  TYPE stb_button.
    E_OBJECT of event TOOLBAR is of type REF TO CL_ALV_EVENT_TOOLBAR_SET.
    This class has got one attribute, namly MT_TOOLBAR, which
    is a table of type TTB_BUTTON. One line of this table is
    defined by the Structure STB_BUTTON (see data deklaration above).
    A remark to the flag E_INTERACTIVE:
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            'e_interactive' is set, if this event is raised due to
            the call of 'set_toolbar_interactive' by the user.
            You can distinguish this way if the event was raised
            by yourself or by ALV
            (e.g. in method 'refresh_table_display').
            An application of this feature is still unknown...
    append a separator to normal toolbar
        CLEAR ls_toolbar.
        MOVE 3 TO ls_toolbar-butn_type.
        APPEND ls_toolbar TO e_object->mt_toolbar.
    append an icon to show booking table
        CLEAR ls_toolbar.
        MOVE 'BOOKINGS' TO ls_toolbar-function.
        MOVE icon_employee TO ls_toolbar-icon.
        MOVE 'Show Bookings'(111) TO ls_toolbar-quickinfo.
        MOVE 'Detail'(112) TO ls_toolbar-text.
        MOVE ' ' TO ls_toolbar-disabled.
        APPEND ls_toolbar TO e_object->mt_toolbar.
      ENDMETHOD.
      METHOD handle_user_command.
    § 3.In event handler method for event USER_COMMAND: Query your
      function codes defined in step 2 and react accordingly.
        DATA: lt_rows TYPE lvc_t_row.
        CASE e_ucomm.
          WHEN 'BOOKINGS'.
            CALL METHOD grid1->get_selected_rows
                     IMPORTING et_index_rows = lt_rows.
            CALL METHOD cl_gui_cfw=>flush.
            IF sy-subrc ne 0.
    add your handling, for example
              CALL FUNCTION 'POPUP_TO_INFORM'
                   EXPORTING
                        titel = g_repid
                        txt2  = sy-subrc
                        txt1  = 'Error in Flush'(500).
            else.
                      perform show_booking_table tables lt_rows.
            ENDIF.
        ENDCASE.
      ENDMETHOD.                           "handle_user_command
    ENDCLASS.
    lcl_event_receiver (Implementation)
    *===================================================================
          FORM EXIT_PROGRAM                                             *
    FORM exit_program.
    The instance grid2 is freed not until the program exits from the
    main screen.
    (It is created only once during the first selection of SBOOK,
    no matter how many times the second window is called).
      CALL METHOD custom_container1->free.
      IF not custom_container2 is initial.
        CALL METHOD custom_container2->free.
      ENDIF.
      CALL METHOD cl_gui_cfw=>flush.
      IF sy-subrc ne 0.
    add your handling, for example
        CALL FUNCTION 'POPUP_TO_INFORM'
             EXPORTING
                  titel = g_repid
                  txt2  = sy-subrc
                  txt1  = 'Error in Flush'(500).
      ENDIF.
      LEAVE PROGRAM.
    ENDFORM.
    *&      Module  PBO_100  OUTPUT
          text
    MODULE pbo_100 OUTPUT.
      SET PF-STATUS 'MAIN100'.
      SET TITLEBAR 'MAIN100'.
      g_repid = sy-repid.
      IF custom_container1 is initial.
    select data from table SFLIGHT
        PERFORM select_table_sflight CHANGING gt_sflight.
    create a custom container control for our ALV Control
        CREATE OBJECT custom_container1
            EXPORTING
                container_name = cont_on_main
            EXCEPTIONS
                cntl_error = 1
                cntl_system_error = 2
                create_error = 3
                lifetime_error = 4
                lifetime_dynpro_dynpro_link = 5.
        IF sy-subrc ne 0.
    add your handling, for example
          CALL FUNCTION 'POPUP_TO_INFORM'
               EXPORTING
                    titel = g_repid
                    txt2  = sy-subrc
                    txt1  = 'The control could not be created'(510).
        ENDIF.
    create an instance of alv control
        CREATE OBJECT grid1
               EXPORTING i_parent = custom_container1.
    Set a titlebar for the grid control
        gs_layout-grid_title = 'Flights'(100).
    allow to select multiple lines
        gs_layout-sel_mode = 'A'.
        CALL METHOD grid1->set_table_for_first_display
             EXPORTING i_structure_name = 'SFLIGHT'
                       is_layout        = gs_layout
             CHANGING  it_outtab        = gt_sflight.
    ->Create Object to receive events and link them to handler methods.
    When the ALV Control raises the event for the specified instance
    the corresponding method is automatically called.
        CREATE OBJECT event_receiver.
        SET HANDLER event_receiver->handle_user_command FOR grid1.
        SET HANDLER event_receiver->handle_toolbar FOR grid1.
    § 4.Call method 'set_toolbar_interactive' to raise event TOOLBAR.
        CALL METHOD grid1->set_toolbar_interactive.
      ENDIF.                               "IF grid1 IS INITIAL
      CALL METHOD cl_gui_control=>set_focus EXPORTING control = grid1.
    ENDMODULE.                             " PBO_100  OUTPUT
    *&      Module  PAI_100  INPUT
          text
    MODULE pai_100 INPUT.
      CASE ok_code.
        WHEN 'EXIT'.
          PERFORM exit_program.
      ENDCASE.
      CLEAR ok_code.
    ENDMODULE.                             " PAI_100  INPUT
    *&      Module  PBO_0101  OUTPUT
          text
    MODULE pbo_0101 OUTPUT.
      IF custom_container2 is initial.
    (the data from sbook is already selected)
    create a custom container control for our ALV Control
        CREATE OBJECT custom_container2
            EXPORTING
                container_name = cont_on_dialog
            EXCEPTIONS
                cntl_error = 1
                cntl_system_error = 2
                create_error = 3
                lifetime_error = 4
                lifetime_dynpro_dynpro_link = 5.
        IF sy-subrc ne 0.
    add your handling, for example
          CALL FUNCTION 'POPUP_TO_INFORM'
               EXPORTING
                    titel = g_repid
                    txt2  = sy-subrc
                    txt1  = 'The control could not be created'(510).
        ENDIF.
    create an instance of alv control
        CREATE OBJECT grid2
               EXPORTING i_parent = custom_container2.
    change title
        gs_layout-grid_title = 'Bookings'(101).
        gs_layout-sel_mode = ' '.
        CALL METHOD grid2->set_table_for_first_display
             EXPORTING i_structure_name = 'SBOOK'
                       is_layout        = gs_layout
             CHANGING  it_outtab        = gt_sbook.
      ELSE.
        CALL METHOD grid2->refresh_table_display.
      ENDIF.                               "IF custom_container2 IS INITIAL.
      CALL METHOD cl_gui_control=>set_focus EXPORTING control = grid2.
      CALL METHOD cl_gui_cfw=>flush.
      IF sy-subrc ne 0.
    add your handling, for example
        CALL FUNCTION 'POPUP_TO_INFORM'
             EXPORTING
                  titel = g_repid
                  txt2  = sy-subrc
                  txt1  = 'Error in Flush'(500).
      ENDIF.
    ENDMODULE.                             " PBO_0101  OUTPUT
    *&      Form  SELECT_TABLE_SFLIGHT
          text
         <--P_GT_SFLIGHT  text
    FORM select_table_sflight CHANGING p_gt_sflight LIKE gt_sflight[].
      SELECT * FROM sflight INTO TABLE p_gt_sflight up to g_max rows.
    ENDFORM.                               " SELECT_TABLE_SFLIGHT
    *&      Form  SELECT_TABLE_SBOOK
          text
         -->P_LS_SFLIGHT  text
         <--P_GT_SBOOK  text
    FORM select_table_sbook USING    p_ls_sflight LIKE LINE OF gt_sflight
                            CHANGING p_gt_sbook LIKE gt_sbook[].
      DATA: lt_sbook LIKE gt_sbook[].
    Select data from sbook according to a line of sflight
    and append that data to table p_gt_sbook
      SELECT * FROM  sbook INTO TABLE lt_sbook
             WHERE  carrid  = p_ls_sflight-carrid
             AND    connid  = p_ls_sflight-connid
             AND    fldate  = p_ls_sflight-fldate.
      APPEND LINES OF lt_sbook TO p_gt_sbook.
    ENDFORM.                               " SELECT_TABLE_SBOOK
    *&      Module  PAI_0101  INPUT
          text
    MODULE pai_0101 INPUT.
      CASE ok_code.
        WHEN 'RETURN'.
          LEAVE TO SCREEN 0.
      ENDCASE.
      CLEAR ok_code.
    ENDMODULE.                             " PAI_0101  INPUT
    *&      Form  show_booking_table
          text
         -->P_ET_INDEX_ROWS  text
    FORM show_booking_table TABLES p_et_index_rows
                                    STRUCTURE lvc_s_row.
      DATA: ls_selected_line LIKE lvc_s_row,
            lf_row_index TYPE lvc_index,
            ls_sflight LIKE LINE OF gt_sflight.
      CLEAR gt_sbook[].
      LOOP AT p_et_index_rows INTO ls_selected_line.
        lf_row_index = ls_selected_line-index.
    read selected row from internal table gt_sflight
        READ TABLE gt_sflight INDEX lf_row_index INTO ls_sflight.
    select corresponding lines of table sbook
    and append new lines to global table
        PERFORM select_table_sbook USING ls_sflight
                                   CHANGING gt_sbook.
      ENDLOOP.
    call dialog screen and display new alv control
      CALL SCREEN 101 STARTING AT 10 5.
    ENDFORM.                               " show_booking_table
    Regards,
    Naveen.

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

Maybe you are looking for

  • Quad with 7800GT boot time longer than other cards?

    my quad with raptor 74gb and 3gb of ram plus 7800gt takes 49 seconds to boot consistently. fresh system. I saw over at barefeats.com that theirs boots in 29 seconds but without the 7800gt. can anyone who has both or has access to both confirm that th

  • Business Model and Mapping layer

    I am trying to create a logical dimension table by dragging the corresponding table from the physical layer. However, in the business model layer it shows up with a yellow icon indicating it is a logical fact table. Please help me how I create a logi

  • Datatable multible column sort labels

    How can i change labels of multible column sort panel to another language (Turkish). For example i want to convert "Primary Sort Column:" to "Birincil Sıralama Sütunu" . Thanks for your helps. Edited by: m4erler on 15.Tem.2008 13:39

  • Custom step type revision

    I have created several custom step types, but the names are not displayed correctly when I insert a step in a sequence. This worked fine in TS 2.0, but not in 3.0. Is there something that needs to be done with the version of the step type to be corre

  • Fetching  Employee List  For  A WBS For A Given Date Range

    Hello Friends, I need to fetch  list of employees assigned for the WBS for  a particular month . The Transaction code is PPSM . Is there any standard report available. Otherwise any other way. Regards, Rohini.K.