on 2012 Feb 01 7:55 AM
Hi,
My requirement is to disable "Supplier" input field and "Assign Supplier" Button when the logged in user is a requestor.
Meatdata customization is not possible for this field.As one of my friend in sdn suggested to enhance the wddomodifyview method.I have placed the below code in my postexit.
DATA :wd_por_en TYPE REF TO cl_wd_input_field.
wd_por_en ?= view->get_element('FIXED_SUPPLIER').
CALL METHOD wd_por_en->set_enabled
EXPORTING
value = abap_false.
But what is happening is Both Supplier and Preferred Supplier fields are getting disbled since both enabled property is bound to the same attribute in the layout.What can we do to resolve this issue?
If we can achieve using authorization object,What are the steps to be followed for this?
Also using Auth obj whether it can be made disabled or only making the field invisible is possible.
Any help would be appreciated.
Thanks and Regards,
Rohini
Request clarification before answering.
are you changing the property value of context element SUPPLIER any where in the WD enhancement?
only making the set_enabled for fixed_supplier wont disable Preferred Supplier for sure.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
is there any other enhancement involved.
this is my enhancement and it works perfectly..
1. no configurator change.
2. no meta data change
3. no role level addition
4. Only below code in the post exit of WDDOMODIFYVIEW of V_DODC_SC_I_SOS.
DATA :wd_por_en TYPE REF TO cl_wd_input_field.
wd_por_en ?= view->get_element('FIXED_SUPPLIER').
CALL METHOD wd_por_en->set_enabled
EXPORTING
value = abap_false.
DATA: wd_button type ref to CL_WD_BUTTON.
wd_button ?= view->get_element('ASSIGN_FIXED_SUPPL').
CALL METHOD wd_button->set_enabled
EXPORTING
value = abap_false.
Rohani,
I still suggest you to go with the BAdi which I suggested you last time, though you can still have WDDOMODIFYVIEW method enhanced. Keeping in mind next upgrade, would you not prefer to avoid SPAU in next upgrade.
Check the following.
1. Authorization of Requestor/User- As suggested.
2. below code snippet in the BAdi
DATA: lr_view_info TYPE REF TO if_wd_rr_view.
DATA: lr_component TYPE REF TO if_wd_component.
DATA: lr_component_info TYPE REF TO if_wd_rr_component.
lr_view_info = view->if_wd_view_controller~get_view_info( ).
lv_viewname = lr_view_info->get_name( ).
lr_component = view->if_wd_controller~get_component( ).
lr_component_info = lr_comp->get_component_info( ).
lv_compname = lr_comp_info->get_name( ).
lr_uielement ?= view->get_element( 'FIXED_SUPLLIER' ).
lv_enable = ' '.
IF ( lr_uielement IS BOUND ).
TRY.
lr_uielement->set_enabled( lv_enable ).
CATCH cx_wd_context.
ENDTRY.
TRY.
lr_uielement->bind_visible( '' ).
IF ( lv_enabled = 'X' ).
lr_uielement->set_visible( '02' ).
ELSE.
lr_uielement->set_visible( '01' ).
lr_uielement->set_enabled( 'X' ).
ENDIF.
CATCH cx_wd_context.
ENDTRY.
Give us your code snippet, we will check if it has some problems
Edited by: Surender Yadav on Feb 1, 2012 5:36 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.