cancel
Showing results for 
Search instead for 
Did you mean: 

Showing Messages in Popup

Former Member
0 Kudos

Hi all,

I have a query regarding the Web Dynpro application.

I am using popup window when clicked on a button, in which I have mandatory fields.

I want to throw error message if the mandatory fields are not filled in the popup window itself.

I have already used the method "subscribe_to_button_event" of the class and "raise_error_message" methods.

But, I'm getting the messages at main screen not on popup window.

could anyone please help me.

Regards,

Ram.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

for ur window parameter make CLOSE_IN_ANY_CASE as abap_false.

write the code for ur message in the OnAction of ur OK button .

refer this link for same requirement

Former Member
0 Kudos

Hi,

When you are creating the window then make the parameter CLOSE_IN_ANY_CASE as abap_false.

CLOSE_IN_ANY_CASE   = abap_false

Now In the wddoinit of the view, which is getting opened as pop up, write the code for creating the button event.

In this event you can do the proper validations and print the message. Message will get printed on the pop screen only.

Now for closing the window use the exit plugs of window.

Former Member
0 Kudos

hi ,

there is exactly the same requirement :

proceed as below :

For creating a pop up message u must have one more window which will open as a pop up.

Create one window say ( WIN2 ) and one view say (VIEW2 ). Now embed this view in window( WIN1 ).

Take one message area in the view.

Insert the following piececode into the appropriate place. i.e. in the wdp action method of your desired button



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 = 'WIN2'
message_display_mode = if_wd_window=>co_msg_display_mode_selected
* close_button = abap_true
button_kind = if_wd_window=>co_buttons_none
message_type = if_wd_window=>co_msg_type_none
default_button = if_wd_window=>co_button_ok
).
lo_window->open( ).

* get message manager
DATA lo_api_controller TYPE REF TO if_wd_controller.
DATA lo_message_manager TYPE REF TO if_wd_message_manager.

lo_api_controller ?= wd_this->wd_get_api( ).

CALL METHOD lo_api_controller->get_message_manager
RECEIVING
message_manager = lo_message_manager
.
* report message
call method LO_MESSAGE_MANAGER->REPORT_MESSAGE
exporting
MESSAGE_TEXT = LS_RET_MESSAGE-MESSAGE
MESSAGE_TYPE = 2
SHOW_AS_POPUP = ABAP_TRUE
*view                      = 'VIEW2'*
receiving
MESSAGE_ID = L_MSG_ID.

Message will come only to the pop up view.

rgds,

amit

Former Member
0 Kudos

hi,

Use this code in the wddoinit of second window which is called as pop up window :

DATA lo_view_controller TYPE REF TO if_wd_view_controller.
  lo_view_controller = wd_this->wd_get_api( ).
  DATA lo_wdw_controller TYPE REF TO if_wd_window_controller.
  lo_wdw_controller = lo_view_controller->get_embedding_window_ctlr( ).
  DATA lo_item_popup_window TYPE REF TO if_wd_window.
  lo_item_popup_window = lo_wdw_controller->get_window( ).
 
    lo_item_popup_window->subscribe_to_button_event(
    button = if_wd_window=>co_button_ok
    button_text = 'otr_text'
    action_name = 'OK'
    action_view = lo_view_controller
    is_default_button = abap_true
  ).

Now create action OK in new window's Action Tab and do the validation here.

Previously you must be creating subscribe to button event at the time of calling second window.

Avoid writing there.

In second window , do init only write code for button event and make actions here only.Refer this thread with similar requiement :