on 08-27-2009 6:50 AM
Hi Experts,
I have a requirement where in the very first screen, which is a selection screen, has to behave differently based on authorization for the logging in user. i have to hide/show few fields based on authorization.
So i need to check authorization-check, where shoul id code this, is it in WD_DOINIT method of the selection screen view?
or shall i code it in wd_doinit method of component controller?
I am a beginner in WDA so request your advice. Many thanks,
Ajay
Edited by: ajay matam on Aug 27, 2009 11:31 AM
WDDOINIT will be called for the first time when the application is executed.
Again when you navigate in between the views WDDOMODIFYVIEW will be called,so check including in both the methods.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ajay,
You can code in component controller's WDDOINIT method.
Steps:
1. Create attributes of type WDY_BOOLEAN in Comp's Context and bind them to View's UI elements, which needs to be hidden.
2. Now you can code in Comp's WDDOINIT, for auth check depending on User and set the visible attribute for respective UI element.
This way, you need not come for auth check in View.
Hope this helps!
Thanks,
Tejaswini
Hi Ajay,
You can code in component controller's WDDOINIT method.
Steps:
1. Create attributes of type WDY_BOOLEAN in Comp's Context and bind them to View's UI element's Visible property, which needs to be hidden.
2. Now you can code in Comp's WDDOINIT, for auth check depending on User and set the visible attribute for respective UI element.
DATA lo_nd_cn_visible TYPE REF TO if_wd_context_node.
DATA lo_el_cn_visible TYPE REF TO if_wd_context_element.
DATA ls_cn_visible TYPE wd_this->element_cn_visible.
DATA lv_ca_visible LIKE ls_cn_visible-ca_visible.
* navigate from <CONTEXT> to <CN_VISIBLE> via lead selection
lo_nd_cn_visible = wd_context->get_child_node( name = wd_this->wdctx_cn_visible ).
* get element via lead selection
lo_el_cn_visible = lo_nd_cn_visible->get_element( ).
...
auth check for sy-uname
.......
if.....condition..
lv_ca_visible = abap_true.
else.
lv_ca_visible = abap_false.
endif.
* get single attribute
lo_el_cn_visible->set_attribute(
EXPORTING
name = `CA_VISIBLE`
value = lv_ca_visible ).
This way, you need not come for auth check in View.
Hope this helps!
Thanks,
Tejaswini
Edited by: Tejaswini Chafekar on Aug 27, 2009 8:23 AM
HI Ajay,
You can code in WDDOMODIFYVIEW of View, there you can access the view UI elements and based on the authorization code you can hide/display the fields.
authority-check .....
if sy-subrc eq 0.
view->get_element( EXPORTING id = 'TXV_AGE' RECEIVING element = lr_view_element ).
lr_text_view ?= lr_view_element.
lr_text_view->set_visible( EXPORTING value = cl_wd_text_view=>e_visible-visible ).
" cl_wd_text_view=>e_visible-none for Hide
endif.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
74 | |
9 | |
8 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.