Hi Experts,
I want to prevent navigation in View BP_DATA/AccountContactViewset when certain conditions are met. I have redefined EH_ONDONE to throw error message and when this condition is met the user can now see an error message and is not able to navigate with the "back" button.
My Problem is: the second button for only Navigation back (on top right side!! not the back button in left side which calls EH_ONDONE) allows it to navigate back, although I throw an error message. In Standard the user gets a popup with "Do you want to save your changes". If he clicks on "No" or "Cancel" then data got deleted! Whe he clicks on Yes he have to clear the error and maintain data correctly!
My Problem is, I dont get this popup when my own error message git throw! the user can directly navigate back and data could be saved despite of error message!
Here is my Coding:
data lr_msg_service type ref to cl_bsp_wd_message_service.
...
...
lr_msg_service = me->view_manager->get_message_service( ).
...
...
If condition = true. "sample
" throw error
check lr_msg_service is bound.
message e10(xxx) into lv_msgtext.
ls_messages-type = 'E'.
ls_messages-id = 'xxx'.
ls_messages-number = '10'.
ls_messages-message = lv_msgtext.
append ls_messages to lt_messages.
lr_msg_service->add_messages(
it_messages = lt_messages
).
return.
endif.
As I mentioned before, the message is shown but user can navigate back from button on top RIGHT of view. Why I don't get the standard popup which prevent user from navigation? What is wrong in my coding?
Thanks!
Best Regards,
Anna