Unsubscribing a Portal Event Using a Code Snippet 
You have created the views and their corresponding action handlers.
For more information, see Creating a View
For more information, see SAP NetWeaver CE > Creating an Action.
In the Web Dynpro perspective, choose
In the Web Dynpro Explorer, select the required view.
Choose using the secondary mouse button.
Drag the UnSubscribe from a Portal Event snippet and drop it in the suitable user code area of the Java editor.
In the Insert Snippet: Unsubscribe to Portal Event dialog box, enter the necessary details such as Namespace, Name, and Handler Action and choose Insert.