Friday, 7 June 2013

60.DISPLAYING NAVIGABLE MESSAGES



NAVIGABLE MESSAGES :

In the previous chapter, we have created simple messages. At times, we have to execute certain actions to process the error message.
For ex:
By clicking on message, user has to navigate to some other screen or we need to execute certain code.
In this example, I will show how to navigate to another view by clicking on the message in the message bar. 


Here I have created two views and made one navigation link from source view to target view and assigned both views to the window. I made source view as default view so that when we display the window, source view will be displayed first. Kindly see the below screen shot.






We need to add one interface ‘IF_BSP_WD_MESSAGE_HANDLER’ to our view implementation class as a first step if it is not available already. 





After adding, activate the class.

Next, we need to subscribe our message to the global message service. I coded in the DO PREPARE OUTPUT method as below.




First I am subscribing my message using the method subscribe message. Then I am adding the message to make visible on the web ui. Save and activate the method. 


If you test application now, you can see that message will be displayed as hyperlink. Whenever user clicks on the hyper link, the method IF_BSP_WD_MESSAGE_HANDLER~HANDLE_MESSAGE will be triggered. We need to code in this method. 

Go to the view implementation class and add the following code.






I am simply triggering the navigation in this method.  I am giving the navigational link value to the outbound plug parameter.
Now testing the application.




Click on the message. You will navigate the target view.

No comments:

Post a Comment