Skip to Content
avatar image
Former Member

Double click functionality in Webdynpro ABAP ALV

Hello!

I have web dynpro application with ALV Table.

I need to reproduce the standard R/3 functionality: after the double clicking on the table row the new window with content of that row's fields should appear in the form layout .

For example, such functionality we have in the RSDMD transaction.

So I have two questions:

1. How to catch double click in the alv table of the Web dynpro application;

2. How to represent information from the alv table row in the form layout?

Could you please help me?

Thanks,

Mariya

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • Best Answer
    Aug 03, 2009 at 10:36 AM

    Hi Mariya,

    We dont have the double click functionality for ALV in WDA. Here is the complete listing of events which are possible in WDA:

    [http://help.sap.com/saphelp_nw70ehp1/helpdata/en/dd/b943f7f11e47e3838675aac9b13d16/frameset.htm|http://help.sap.com/saphelp_nw70ehp1/helpdata/en/dd/b943f7f11e47e3838675aac9b13d16/frameset.htm]

    What you can do instead is have 1 of your ALV's cells to be displayed as an LinkToAction UI element. Whent he user clicks up on this LinkToAction then he would have triggered the ALV's ON_CLICK event. You can fetch the information corresponding to the cell in which the user had clicked using the R_PARAM parameter passed by the framework.

    Regards,

    Uday

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 03, 2009 at 11:48 AM

    >

    >

    > I have web dynpro application with ALV Table.

    > I need to reproduce the standard R/3 functionality: after the double clicking on the table row the new window with content of that row's fields should appear in the form layout .

    You have to remember that with Web Dynpro, you are running in a web browser now. There are certain rules and limtations to the user interaction that the web browser enforces. Double clicking is one of those such constructs that is really replace by hyperlinks within the browser.

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 03, 2009 at 10:44 AM

    Hi Maria,

    Say suppose I am displaying the information from SFLIGHT in an ALV format & when I click on any 1 row's CARRID I would like to fetch the corresponding BOOKING details for that particular combination of CARRID, CONNID & FLDATE then I can proceed as follows:

    1) Make the CARRID cell of your ALV to appear as an LinkToAction

    2) Create an event handler for the ON_CLICK event of the ALV & within this event handler fetch the information about the row's CARRID, CONNID & FLDATE. Call a popup window and display the corresponding information in this row.

    Below is the code to make your CARRID field as an LinkToAction:

    METHOD wddomodifyview .
      wd_this->build_alv( ).
    ENDMETHOD.

    METHOD build_alv .
      DATA:
        lr_alv_usage       TYPE REF TO if_wd_component_usage,
        lr_if_controller   TYPE REF TO iwci_salv_wd_table,
        lr_config          TYPE REF TO cl_salv_wd_config_table,
        lr_column_settings TYPE REF TO if_salv_wd_column_settings,
        lt_columns         TYPE        salv_wd_t_column_ref,
        lr_link            TYPE REF TO cl_salv_wd_uie_link_to_action,
        lr_checkbox        TYPE REF TO cl_salv_wd_uie_checkbox,
        lr_image           TYPE REF TO cl_salv_wd_uie_image.
      FIELD-SYMBOLS
        <fs_column> LIKE LINE OF lt_columns.
    
    * Instantiate the ALV Component
      lr_alv_usage = wd_this->wd_cpuse_alv( ).
      IF lr_alv_usage->has_active_component( ) IS INITIAL.
        lr_alv_usage->create_component( ).
      ENDIF.
    
    * Get reference to model
      lr_if_controller = wd_this->wd_cpifc_alv( ).
      lr_config        = lr_if_controller->get_model( ).
    
    * Set the UI elements.
      lr_column_settings ?= lr_config.
      lt_columns = lr_column_settings->get_columns( ).
    
      LOOP AT lt_columns ASSIGNING <fs_column>.
        if <fs_column>-id = 'CARRID'.
          CREATE OBJECT lr_link.
          lr_link->set_text_fieldname( <fs_column>-id ).
          <fs_column>-r_column->set_cell_editor( lr_link ).
        ENDif.
      ENDLOOP.
    ENDMETHOD.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Uday,

      Nice Input.

      I'm thinking perhaps the ON_CLICK EVENT could be better implemented in METHOD 'wddoinit'?

      It is sometimes difficult deciding which method to use and when to go for custom controllers.

      cheers,

      mike

  • Aug 03, 2009 at 10:47 AM

    Now I create an eventhandler method for the event ON_CLICK of the ALV. Now within this method R_PARAM->INDEX would contain the row number in which the user had clicked. So now I can do a normal GET_STATIC_ATTRIBUTES by specifying this as my index & retreieve the corresponding details. I hope that you are able to grasp what am saying.

    Regards,

    Uday

    METHOD on_click .
      DATA: lr_node TYPE REF TO if_wd_context_node,
            ls_sflight TYPE wd_this->element_node,
            lt_sbook TYPE wd_this->elements_sbook.
    
      lr_node = wd_context->get_child_node( name = wd_this->wdctx_node ).
    
      CALL METHOD lr_node->get_static_attributes
        EXPORTING
          index             = r_param->index
        IMPORTING
          static_attributes = ls_sflight.
      SELECT * FROM sbook INTO CORRESPONDING FIELDS OF TABLE lt_sbook WHERE carrid = ls_sflight-carrid AND
                                                                            connid = ls_sflight-connid AND
                                                                            fldate = ls_sflight-fldate.
      lr_node = wd_context->get_child_node( name = wd_this->wdctx_sbook ).
      lr_node->bind_table( lt_sbook ).
    
      DATA lo_window_manager TYPE REF TO if_wd_window_manager.
      DATA lo_api_component  TYPE REF TO if_wd_component.
      DATA lo_window         TYPE REF TO if_wd_window.
    
      lo_api_component  = wd_comp_controller->wd_get_api( ).
      lo_window_manager = lo_api_component->get_window_manager( ).
      lo_window         = lo_window_manager->create_window(
                         window_name            = 'BOOKINGS'
                         message_display_mode   = if_wd_window=>co_msg_display_mode_selected
                         button_kind            = if_wd_window=>co_buttons_ok
                         message_type           = if_wd_window=>co_msg_type_none
                         default_button         = if_wd_window=>co_button_ok
                         ).
    
      lo_window->open( ).
    
    ENDMETHOD.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 03, 2009 at 04:05 PM

    Thank you for your answers!

    I think the creation of the LinkToAction UI elements is the best variant.

    And what about the form layout? Should I create this form by creating all of the table fields manually in the new view?

    I need all the cells in the clicked row to be placed in column (not in row).

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Maria,

      I dont have access to SAP at this time so am not able to check the RSDMD transaction. I guess that you want all the information from the selected row to appear as TextView's 1 below another. If thats the case then its simply, just create a context node at COMPONENTCONTROLLER level. Now when you click up on any row you would have obtained the information corresponding to that row by saying something like:

      CALL METHOD lr_node->get_static_attributes
          EXPORTING
            index             = r_param->index
          IMPORTING
            static_attributes = ls_sflight.

      So now just set the values for COMPONENTCONTROLLER 's node by doing a BIND_STRUCTURE.

      node->bind_structure(  new_item = ls_sel_opt ).

      Map the node from COMPONENTCONTROLLER to your popup windows view. So now on your layout right click & say "Create Container From" & select the node which you had created earlier & the cell editor as TextView's.

      Regards,

      Uday

  • avatar image
    Former Member
    Aug 04, 2009 at 12:43 PM

    Thanks a lot!

    Hope it won't be difficult to make it at runtime.

    Add comment
    10|10000 characters needed characters exceeded