Easy way to hide/disable elements(Texts/Fields) in a View of a Web Dynpro Application
This tutorial is for beginners. A requirement might come in where you have to hide fields in a Web Dynpro application. There are several blog posts regarding the same but they are very lengthy & quiet confusing sometimes for the beginners. For this reason, I am writing this short blog post. 🙂
I am assuming that for hiding the fields, no code is written earlier.
Please follow the below-mentioned steps to achieve the same.
- Enter the Tcode SE80: Object Navigator
- Mention the name of Web Dynpro Comp./Intf.
- Go to the Methods tab of the Views node. You will be able to see all the methods related to the views.
- Create a new method here, say with a name: ZMETHOD_HIDE. Provide a description of the method.
Provide a parameter: IM_CONTAINER with REFto CL_WD_UIELEMENT_CONTAINER.
- Enter the below-mentioned codes in that method. Please refer to the comments for further details.
- Now go back & find the method: WDDOMODIFYVIEW in the same View & double click into that. In case of a new View, by default, it will have this method.
- Now, please enter the below-mentioned codes in that method.
That’s it. Activate it & enjoy 🙂