cancel
Showing results for 
Search instead for 
Did you mean: 

Disable custom button added in SC line item during display mode

Former Member
0 Kudos

Hi All,

We have added a custom button in WDC: /SAPSRM/WDC_UI_SC_DOTC_BD view: V_SC_DOTC_BASIC at item level next to Delete button.

Now problem is this custom field is always enabled. We need to disable the custom button when the shopping cart is opened in display mode.

How to get the mode (Display / change) while adding code to disable the button in WDDOMODIFYVIEW method?

I know the code to disable the button which is given below But I need to call this code only if the cart is opened using display mode.

DATA:  lo_button  TYPE REF TO cl_wd_toolbar_button. 

lo_button  ?= view->get_element( 'COPY' ). 

lo_button->set_visible( '01' ). 

lo_button  ?= view->get_element( 'PASTE' ). 

lo_button->set_visible( '01' ).

Regards, Sasi

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I got the solution myself. Here is the code to get the transaction mode (Display/ create / edit) from view method. 

DATA lo_tsk_container TYPE REF TO /sapsrm/if_cll_task_container.  

DATA lv_sub_mode  TYPE /sapsrm/pdo_inst_mode. 

DATA lv_pdo_mode  TYPE /sapsrm/pdo_inst_mode.

* Get the Transaction Mode 

lo_tsk_container = wd_comp_controller->mo_task_container. 

CALL METHOD lo_tsk_container->get_transaction_mode   

IMPORTING       ev_sub_trans_mode = lv_sub_mode     

                             ev_pdo_trans_mode = lv_pdo_mode.

Lv_PDO_mode & lv_sub_mode will give the actual mode. Based on this, we can perform our validation.

Regards,

Sasi

former_member207661
Active Participant
0 Kudos

Hi Sasi,

Did you tried disabling this through Meta data handling.

In that approach, no need to write any code. Visibility of fields/buttons can be handled through configuration only.

Warm Regards,

Shyam Agrawal

Former Member
0 Kudos

Hi Shyam , I tried with metadata and it did not worked for us. Hence I did it through WDA enhancement. Can we use, meta data for custom fields too? Are you using it in your project? Also have you disabled the Paste button at item level? do you have the PDO action for PASTE button? Regards, Sasi

former_member207661
Active Participant
0 Kudos

Hi Sasi,

Yes, we can use metadata for custom fields/actions also.

Please see if you are using correct path to maintain metadata for fields/actions - there are different nodes in SPRO for fields and actions.

Please refer below for details on Metadata handling of custom fields.

http://scn.sap.com/docs/DOC-25692

http://scn.sap.com/thread/3473863

Regarding PASTE button in SC line item, there will be action associated with it which can be configured in Metadata. You need to check in Standard Metadata for SC at item level. Currently I do not have system, so cannot provide exact name of that action.

Warm Regards,

Shyam Agrawal

former_member207661
Active Participant
0 Kudos

Hi Sasikanth,

Were you able to achieve this via Metadata configuration?

Warm Regards,

Shyam Agrawal

Former Member
0 Kudos

Hi Shyam, I tried it initially and it did not worked. Hence I did it via coding. Regards, Sasi

Answers (0)