Skip to Content

Handle the action on customise button on ALV within ALV at CC level

Hello Expert,

i have a requirement where i need to handle the action on a customise button (SAY ADD) which is on ALV(say ALV2) and this ALV(ALV2) comes as pop up once user cllck on cutomise button(say BUTTON1) which is present in alv(say ALV1).

I created a view(V_POP) and within that a view container for holding the ALV2.

And in the CC i did the below coding on the action of button BUTTON1.

l_if_window = l_if_window_manager->create_and_open_popup(

window_name = TABLE

component_usage_name = V_POP

title = wd_assist->if_wd_component_assistance~get_text( '001' )

message_type = if_wd_window=>co_msg_type_none

message_display_mode = if_wd_window=>co_msg_display_mode_selected

buttons = l_i_buttons

cancel_action = l_wa_canc_action

i created a button and add it in table l_i_buttons..

But i am not able to subscribe this button

* Subscribe Button Yes event

* l_if_window->subscribe_to_button_event(

* button = 4

* action_name = /glb/cl_8gtpt_const_vend_aud=>cc_add_scope_pop

* button_text = cl_hrtmc_dr_utilities=>get_otr_text_by_alias( 'SAP_NWBC/ADD' )

* action_view = l_if_view_controller

* is_default_button = abap_true ).

because i am not getting the view(action_view).

Please help.


Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Jan 20, 2015 at 02:42 PM

    Hi Mahesh,

    When you write that button ADD "is on" ALV2, do you mean that you have created a custom function within ALV2? By that I mean...

      data lo_alv type ref to cl_salv_wd_config_table.
      data lo_button type ref to cl_salv_wd_fe_button.
      data lo_function type ref to cl_salv_wd_function.
      lo_alv = wd_this->wd_cpifc_my_alv( )->get_model( ).
      create object lo_button.
      lo_button->set_text( 'Add' ).
      lo_function = lo_alv->if_salv_wd_function_settings~create_function( 'ADD' ).
      lo_function->set_editor( lo_button ).

    If this is how you have created the custom button for ALV2, then you may handle its click event as follows. Create an event handler method in your view for the ALV component's ON_FUNCTION event. In the event handler method, you can determine which ALV function was triggered and insert your logic...

    method handle_on_function .
    * -- Handle function events in the ALV
      case r_param->id. " r_param comes as a standard parameter
         when 'ADD'.
          wd_comp_controller->do_something( ).
         when others.
           wd_comp_controller->do_something_else( ).
      endcase. " ALV event ID



    Add comment
    10|10000 characters needed characters exceeded