
In every SRM developer’s life there comes a day when he/she needs to modify the standard Web UI and this blog is intended for that day. Let’s get into the details now
The things you need to know/have before reading this blog are
I am going to divide the general requirements into few categories and discuss how we can achieve each of those requirements
SAP has provided a beautiful BADI WD_BADI_DOMODIFYVIEW for achieving most of the requirements under this category.This is a filter dependent BADI, so you can create multiple implementations based on webdynpro component and the VIEW name. It has an import parameter called VIEW , which gets the reference to the view controller at runtime. So, if you want to hide any of the UI element on a particular view, just proceed as below
sounds like a piece of cake. isn't it?. well not always. let's look at an example to understand it better
For instance, if you want to hide PO number field on overview tab of the PO screen.
The technical help of PO number field gives us the information about WD component, VIEW name and component configuration
Create an implementation for the badi with the following filter combination
In the implementation of BADI use the following code
DATA : lo_trans_cont TYPE REF TO cl_wd_transparent_container .
*every UI element in webdynpro has a corresponding class. Find the class for the UI element that you want to hide
CONSTANTS lc_main_cont_id TYPE string VALUE 'MAIN_CONTAINER'.
CONSTANTS lc_left_cont_id TYPE string VALUE 'LEFT_CONTAINER'.
*In this case the field is embedded in a transparentUIcontainer with name 'LEFT_CONTAINER', which in turn embedded
*in another container with name 'MAIN_CONTAINER'
lo_trans_cont ?= view->get_element( lc_main_cont_id ).
lo_trans_cont ?= lo_trans_cont->get_child( id = lc_left_cont_id ).
IF lo_trans_cont IS NOT INITIAL.
*Remove input field
lo_trans_cont->remove_child( id = 'PO_NUMBER').
*Remove label
lo_trans_cont->remove_child( id = 'PO_NUMBER_LABEL' ).
ENDIF.
PO number field is removed from the VIEW now
Same goes for hiding any container present in the view. For hiding subviews, please refer to my other blog Floorplan Manager for WebDynpro ABAP: Dynamical... | SCN
Other way of doing this is creating a Z component configuration by copying the std one and making the changes to it
/SAPSRM/WDCC_PO_DOFC_OV_HD. click on 'other functions' and select 'Enhance'
you can change the 'visible' property of the UI element
This method can be used , if the changes to the web UI applies to all the users
For this case, we will use the same BADI, but now we use the import parameter WD_CONTEXT, which holds the reference to the VIEW context.
Value helps are assigned at context attribute level. Every contest attribute has two properties related to search help
SAP use below code for different types of the search help
Deactivated | 101 |
Automatic | 111 |
DDIC | 121 |
OVS | 131 |
Application defined | 141 |
Get the name of the view context attribute that holds the search help and use the below sample code to attach/overwrite new/existing search help
Below is the sample code to attach/overwrite search help to a context attribute
DATA lo_nd_attrib TYPE REF TO if_wd_context_node.
DATA lo_nd_attrib_info TYPE REF TO if_wd_context_node_info.
*get the reference to context node info
lo_nd_attrib_info = lo_nd_attrib->get_node_info( ).
*attach the search help to the relevant attribute
lo_nd_attrib_info->set_attribute_value_help( name = ‘here enter the ID of the context attribute’
value_help_mode = '121' (if it is DDIC shlp)
value_help = ‘here enter the custom search help name that you have created')
Use the below SPRO configuration to make the fields non-editable/mandatory
Add the field to the above configuration and select 'Field enabled' and 'Field required' check boxes as required. Same thing goes for fields at item level. You can define customer class and method to enable/disable fields based on custom logic. For more information on customer class, please refer to the SPRO documentation.
There is an excellent blog written by ricardo.romeromataon how to add custom fields to SC and POWL. You can find the blog here Add custom field to SC and POWL
For adding new main views/Tabs, please refer to my other blog Floorplan Manager for WebDynpro ABAP: Dynamical... | SCN
If you can not achieve the requirement by any of the above said methods, the last option would be to enhance the standard webdynpro component/view.
There might be other better ways of doing whatever I said above, so please post your thoughts and comments.
I hope you enjoyed reading it as much as I did writing.
PS: This blog is the result of a boring weekend
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.