cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Custom button control at SC Level

Former Member
0 Kudos
339

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

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

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

Former Member
0 Kudos

Neelima,

Thanks for the reply.

And I am guessing to implement the code in post-exit of wdomodifyview?

Regards,

Vinay

Edited by: Vinay Reddy on Dec 1, 2011 11:29 AM

Former Member
0 Kudos

Hello vinay,

Yes your right

Implement it in modify view post exit.

Please reward if it works

Regards,

Neelima

Edited by: S Neelima on Dec 1, 2011 11:41 AM

Former Member
0 Kudos

Hello Neelima,

I have implemented the code. But the button does not go to invisble mode.

What is the data type of the attribute lv_fill_column_visi ?

Is it wdy_boolean or any other data type.

I delcared it as wdy_boolean and binded to visible property

Is my approach correct?

Regards,

Vinay

Former Member
0 Kudos

Hello Neelima,

Your reply was useful.

One more question.. I got the GUID of the SC.

In any way.. can i get the GUID of the item level. (this is very important to me) using the task container

or in any method.

Thanks for your valuable help.

Regards,

Vinay

Former Member
0 Kudos

Hello Neelima,

Can you pls help me with the above two queries ?

Regards,

Vinay

Former Member
0 Kudos

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

Former Member
0 Kudos

Hello Neelima,

There is no GUID attribute in the node M_DE_ITEM_BASIC_DATA and compiler throws me an error for this.

I checked all of the nodes in item basic data and then i posted the query.

Regards

Vinay

Former Member
0 Kudos

Hello Neelima,

If possible.... Can you pls help me to get the ITEM GUID as... . my major design works on this.

i need this as i have to enable or disable based on the custom fields based on the item details

Regards,

Vinay

Former Member
0 Kudos

Hello Neelima,

Resolved.

I debugged the SC application and am able to access the ITEM GUID in the WDOMODIFYVIEW post exit.

Thanks for you help and lead.

Closing the thread

Regards,

Vinay

0 Kudos

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