Skip to Content
avatar image
Former Member

Open window code in Component controller

Hello,

My requirement is to show the pop up window for search help which is reuseble for all view.for that i have created one method in component controller which can be used by all view.

I have created one window "TEST_WINDOW" and embedded a view name as "TEST_VIEW".

By following code window is opened properly but after adding subscribe_to_button_event method i m facing null pointer error.


  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.
  DATA l_api type ref to if_wd_view_controller.


  lo_api_component  = wd_this->wd_get_api( ).
  lo_window_manager = lo_api_component->get_window_manager( ).

  lo_window   = lo_window_manager->create_window(
                     window_name            = "TEST_WINDOW"
                     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( ).

 

I have added following code.Code for "ok" button action .Code created 'a_selected_material' action is properly created in TEST_VIEW view but null pointer is getting in this line lo_window->subscribe_to_button_event(


lo_window->subscribe_to_button_event(
               button            = if_wd_window=>co_button_ok
               action_name       = 'a_selected_material'
               action_view       = l_api
               is_default_button = abap_false ).

Please help me out for this issues.

Thanks & ragards

Abhilasha Dahare.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Nov 25, 2011 at 01:46 PM

    1)You need view controllers to subscribe to the event. What u can do is to keep the first part (creating popup window ) in the component controller. This method should return you the lo_window.

    Do the Subscrption part in the views. using the lo_window.

    2)Another way it to receive view controller from the view and use that view controller for Subscription.

    I would go with option 2.

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 25, 2011 at 01:47 PM

    Hi,

    What is in l_api ?

    I think you need to add a parameter to your method called for example i_view_api TYPE REF TO IF_WD_VIEW_CONTROLLER.

    And before to call this method get its value like this:

    DATA lo_api_YOUR_VIEW TYPE REF TO if_wd_view_controller.
        lo_api_YOUR_VIEW = wd_this->wd_get_api( ).

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 27, 2011 at 04:08 PM

    Hi Abi,

    Define OVS( to the required attribute ) in the Component controller. Define context mapping to the required views. Now you can use OVS attribute as search help . Hope your problem is solved. Can you let me know if your doubt is not clarified.

    Regards,

    Sankar

    Add comment
    10|10000 characters needed characters exceeded