cancel
Showing results for 
Search instead for 
Did you mean: 

error messages in Popup

Former Member
0 Kudos

Hi experts ,

i created a popup using create window . Now whatwever messages in popup are coming in main window and popup is getting closed . i want to display the messages in popup itself .

can anybody help on this ...

thanks

setu

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

I think u ll do validation For displaying the Error Message.

Create one Local Variable lv_flag with Value '0'. While doing validation set that Flag as '1' if the condition Fails. Then close the pop-up if the lv_flag is '0'.

data l_api_v_new_assignment type ref to if_wd_view_controller.
  l_api_v_new_assignment = wd_this->wd_get_api( ).

  data window_controller type ref to if_wd_window_controller.
  window_controller = l_api_v_new_assignment->get_embedding_window_ctlr( ).

  data window type ref to if_wd_window.
  window = window_controller->get_window( ).

  data lv_flag type i value '0'.

*   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.

IF <condition >.

*   report message
      CALL METHOD lo_message_manager->REPORT_ERROR_MESSAGE
        EXPORTING
          MESSAGE_TEXT = 'For Category A projects, one value can be selected'.

lv_flag = 1.

endif.

if lv_flag eq 0.

window->close( ).

endif.

Regards,

Padmam.

Former Member
0 Kudos

Hi <

I tried that , but that is not working . now i am able to disaply messeges in popup . but my screen control is not going back .

pl help on this .....

Former Member
0 Kudos

Hi Experts ,

I am not getting any reply for my issue .

i will explain bit tdetail my problem .

i am calling a window as a popup using create window method .

i am subscribing event 'save' from the callin view and doing some process in 'save' method . i am doing some validation on my screen , but whatever error i am throughing , it is coming in the main view. later i make 'if_any case ' to abap_false while callin the popup. now i ma able to show my errors the popup . but the control is not going back to the screen , popup still remains.

it is very uzgent frr me ...

pl help on this .....

regards

setu

Former Member
0 Kudos

Check the steps to be followed for creating popup window:

Step 1 - Within your created web dynpro application create a new view

Create a new view which contains the text and UI elements you want to display

Step 2 - Create a new WINDOW (WND_POPUP) to embed the view into

Create a new window and embed the view you have just created into it.

Step 3 - Add ABAP code

Insert the following ABAP code into the appropriate place.

i.e. in the action method of your desired button

Data: context_node type ref to if_wd_context_node.  data: lr_popup type ref to if_wd_window,        lr_view_controller type ref to if_wd_view_controller.  data: lr_api_comp_controller type ref to if_wd_component,        lr_window_manager type ref to if_wd_window_manager.  lr_api_comp_controller = wd_comp_controller->wd_get_api( ).  lr_window_manager =              lr_api_comp_controller->get_window_manager( ).  lr_popup = lr_window_manager->create_window(  MODAL               = ABAP_TRUE  window_name         = 'WND_POPUP'         "Name of the window created in step 2  TITLE               = 'Please enter all information'  CLOSE_BUTTON        = ABAP_TRUE  BUTTON_KIND         = if_wd_window=>CO_BUTTONS_YESNO  MESSAGE_TYPE        = if_wd_window=>co_msg_type_error  CLOSE_IN_ANY_CASE   = ABAP_TRUE*MESSAGE_DISPLAY_MODE = MESSAGE_DISPLAY_MODE  ).* Adds an action to the popup screen buttons* lr_view_controller = wd_this->wd_get_api( ).* lr_popup->subscribe_to_button_event(* button = if_wd_window=>co_button_ok* button_text = 'Yes'* action_name = 'SUBMIT'* action_view = lr_view_controller ).  lr_popup->open( ).

Step 4 - Popup screen options

The code in step 3 will display your popup screen as an error message with two

buttons saying 'YES' and 'NO', these buttons will not perform an action and will

simply return the user back to the main window. If this is not what you require

below is a list of options which will allow you to change this display to suit your

needs (adding different buttons, change message type, add action to buttons):

Options for the BUTTON_KIND parameter

(which can be found by double clicking on

'co_buttons_ok' within the above ABAP code):

CO_BUTTONS_NONE - No ButtonsCO_BUTTONS_ABORTRETRYIGNORE - Buttons for 'Cancel', 'Repeat', 'Ignore'CO_BUTTONS_OK - Buttons for 'O.K.'CO_BUTTONS_CLOSE - Buttons for 'Close'CO_BUTTONS_OKCANCEL - Buttons for 'O.k.', 'Cancel'CO_BUTTONS_YESNO - Buttons for 'Yes', 'No'CO_BUTTONS_YESNOCANCEL - Buttons for 'Yes', 'No', 'Close' CO_BUTTON_ABORT - Button for 'Cancel'CO_BUTTON_RETRY - Button for 'Repeat'CO_BUTTON_IGNORE - Button for 'Ignore'CO_BUTTON_OK - Button for 'Ok.'CO_BUTTON_CLOSE - Button for 'Close'CO_BUTTON_CANCEL - Button for 'Cancel'CO_BUTTON_YES - Button for 'Yes'CO_BUTTON_NO - Button for 'No'

Options for the MESSAGE_TYPE parameter

(which can be found by double clicking on 'co_msg_type_error'

within the above ABAP code):

CO_MSG_TYPE_NONE - No message typeCO_MSG_TYPE_WARNING - WarningCO_MSG_TYPE_INFORMATION - InformationCO_MSG_TYPE_QUESTION - QuestionCO_MSG_TYPE_ERROR - ErrorCO_MSG_TYPE_STOPP - Cancel

Adding actions to popup screen buttons (Yes, OK etc)

Add the following code to that found in step 3, after the method

'create_window' has been called (or simple uncomment it!!)

lr_view_controller = wd_this->wd_get_api( ). lr_popup->subscribe_to_button_event( button = if_wd_window=>co_button_ok button_text = 'Yes' action_name = 'SUBMIT' action_view = lr_view_controller ).

Former Member
0 Kudos

Hi Hari ,

Thanks for your reply . i did this alredy . my req is i am able to display pop up . but i am using some validations on my popup screen . and i throughing error message if it fails . but this error message is coming in the main view from where ia m callin the pop up . i want to avoid that .i want to display message in the pop up itself ..

thanks

setu

uday_gubbala2
Active Contributor
0 Kudos

Hi Setu,

When you use the if_wd_message_manager's methods to display your message you will get a parameter called "VIEW". Specify your popup views name in there so that the message would ge displayed in the popup and not on your main view.

ex:

CALL METHOD lo_message_manager->report_success

EXPORTING

message_text =

  • params =

  • msg_user_data =

  • is_permanent = ABAP_FALSE

  • scope_permanent_msg = CO_MSG_SCOPE_CONTROLLER

view = 'POPUP_VIEW'

  • show_as_popup =

  • controller_permanent_msg =

  • msg_index =

  • cancel_navigation =

Regards,

Uday