Skip to Content

Embedded component with message view

I've created a component with a message view. In the WDDOINIT method I have:

  data: lr_wd_message_area    type ref to if_wd_message_area,
        lr_current_controller type ref to if_wd_window_controller.

* Set up message controller
  lr_current_controller ?= wd_this->wd_get_api( ).
  lr_wd_message_area = lr_current_controller->get_message_area( ).
  lr_wd_message_area->set_display_attributes( i_show_only_current = ' '
                                              i_for_all_instances = ' '
                                              i_use_toggle_area   = ' ' ).

When I call the component as a standalone application it works fine. lr_wd_message_area is instantiated. When I embed the component in the window of another application, I get a dump, as lr_wd_message_area is NOT instantiated. In the other application, the component is embedded directly in a window, which is called as a popup.

 ...  lr_popup = lr_window_manager->create_window(
  modal               = abap_true
  window_name         = 'W_LOG'
  title               = 'Errors log'
  close_button        = abap_true
  button_kind         = if_wd_window=>co_buttons_close
  message_type        = if_wd_window=>co_msg_type_error
  close_in_any_case   = abap_true
  message_display_mode = if_wd_window=>co_msg_display_mode_all ).

  lr_popup->open( ).

When I test the program, it dumps at line lr_wd_message_area = lr_current_controller->get_message_area( ). (in the first code fragment), as lr_current_controller isn't instantiated. When I call the component directly, the lr_current_controller is instantiated.

What could be causing this lack of instantiation?


Edited by: Matt on Mar 1, 2011 11:45 AM

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Best Answer
    Mar 01, 2011 at 11:20 AM

    I guess lr_current_controller will not be initial.

    but instead it will be missing some values like view id etc when you are using the window as embeded view.

    so in this case it wont give you the message area

    using lr_current_controller->get_message_area( ).

    could you elaborate on what is the actual requirement in this case.

    may be we can do some work around.


    sarbjeet singh

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Matthew Billingham


      Exactly, you should not use MessageArea in the reusable view assembly.

      So in the approach 1. You could have the view-b with message area. view-a which is reusable view should not have the messageArea.

      Approach 2, should not have MessageArea at all.

      In our company, we do not include MessageArea at all. Exceptional cases have to be solved in a order as i described above.