on 2011 Dec 01 7:19 AM
Hello friends,
I have enhanced a WD component on SC(/SAPSRM/WDC_DODC_SC_I_BD) to add some custom fields on the click of a button.
I have added the custom fields in SPRO >,...> extension and field control-->.. configure custom fields at item level. and updated the same attributes in WD thru a Z enh.
Now I have to control the button to make it invisible or visible based on the SC , EDIT or DISPLAY mode.
I have two approaches.
1) In spro-> Define actions and assign actions and control actions.(thru dynamic class)
2) Webdynpro : Not able to capture the item details at init method to control the actions.
I tried option 1 thru trial and error method. But i guess i am missing something here to trigger correctly.
If anynone tried and succeeded thru either of the options or any other method, kindly post the same.
Regards,
Vinay
Request clarification before answering.
hello,
Please use below code in MODIFYVIEW of /SAPSRM/WDC_DODC_SC_I_BD
Bind the button visible to attibute FILL_COLUMN_VISI
DATA: lo_wd_view_controller TYPE REF TO if_wd_view_controller,
lo_wd_comp_controller TYPE REF TO /sapsrm/iwci_wdi_l_fpc_general,
lo_task_container TYPE REF TO /sapsrm/if_cll_task_container,
lv_pdo_fill TYPE /sapsrm/pdo_inst_mode,
Instantiate the component controller and task container
lo_wd_view_controller = wd_this->wd_get_api( ).
lo_wd_comp_controller = wd_comp_controller.
lo_task_container = wd_comp_controller->mo_task_container.
CALL METHOD lo_task_container->get_transaction_mode
IMPORTING
ev_pdo_trans_mode = lv_pdo_fill.
IF lv_pdo_fill = gc_display.
* Set Visibility of button Fill Column to "Invisible"
lv_fill_column_visi = '01'.
lo_el_visibility->set_attribute(
name = `FILL_COLUMN_VISI`
value = lv_fill_column_visi ).
ELSEIF lv_pdo_fill = gc_edit.
Set Visibility of button Fill Column to "Visible"
lv_fill_column_visi = '02'.
lo_el_visibility->set_attribute(
name = `FILL_COLUMN_VISI`
value = lv_fill_column_visi ).
ENDIF.
Regards,
Neelima
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
1, Create an attribute fill_column_visi in context node and bind this attribute to visibility of the custom button
DATA: lv_fill_column_visi TYPE wd_this->element_visibility-fill_column_visi,
For item guid
2, DATA lo_nd_m_de_item_basic_data TYPE REF TO if_wd_context_node.
DATA lo_el_m_de_item_basic_data TYPE REF TO if_wd_context_element.
DATA ls_m_de_item_basic_data TYPE wd_this->element_m_de_item_basic_data.
DATA lv_guid TYPE wd_this->element_m_de_item_basic_data-guid.
navigate from <CONTEXT> to <M_DE_ITEM_BASIC_DATA> via lead selection
lo_nd_m_de_item_basic_data = wd_context->path_get_node( path = `ITEM_BASIC_DATA.M_DE_ITEM_BASIC_DATA` ).
get element via lead selection
lo_el_m_de_item_basic_data = lo_nd_m_de_item_basic_data->get_element( ).
get single attribute
lo_el_m_de_item_basic_data->get_attribute(
EXPORTING
name = `GUID`
IMPORTING
value = lv_guid).
Regards,
Neelima
Hi Vinay,
as you said you can control with meta configuration with dynamic classes but there are some limitations with this approach.
1. with dynamic classes u can only disable or enable that is only one time.means if u disabled then again u cannot enable when u switch the SC document into EDIT mode.( Suppose you opened the SC in edit mode and u changed the SC to display mode ).
Better approach is you can control the button by implementing domodifyview badi .
Regards
Devi prasad
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.