cancel
Showing results for 
Search instead for 
Did you mean: 

Preferred Supplier and Supplier fields in Shopping cart

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (2)

Answers (2)

laurent_burtaire
Active Contributor
0 Kudos

Hello Rohani,

check authorization for single role given to your Requester.

I guess authorization value "FIXED_SUP" is set (authorization class BBP, authorization object BBP_FUNCT ).

If yes, unset it.

Regards.

Laurent.

Former Member
0 Kudos

yes, this should be unchecked as well..

Former Member
0 Kudos

Hi Soumya,

1.The authorization object for "FIXED_SUP" is unchecked.

2.The comp configuration is lastly changed by SAP only.

In wddomodifyview postexit,i have the following code.

method PST00O2TH0NANYW7H4C0CWLU3EIN . "Exit of WDDOMODIFYVIEW (in ZSRM_DISABLESUPPL )

if first_time = abap_true.

DATA :lv_username type BAPIBNAME-BAPIBNAME,

lt_roles type standard table of bapiagr,

lw_role type bapiagr,

lv_flag type char1,

lt_return type standard table of BAPIRET2.

move sy-uname to lv_username.

*Getting the roles assigned to the logged in user.

CALL FUNCTION 'BAPI_USER_GET_DETAIL'

EXPORTING

USERNAME = lv_username

TABLES

ACTIVITYGROUPS = lt_roles

RETURN = lt_return.

clear lw_role.

**Checking whether the logged in user is an employee or requestor.

  • loop at lt_roles into lw_role where agr_name CS 'EMPL' OR agr_name CS 'REQU'.

loop at lt_roles into lw_role where agr_name CS 'EMP'.

IF sy-datum gt lw_role-FROM_DAT and sy-datum LT lw_role-TO_DAT.

lv_flag = 'X'.

endif.

ENDLOOP.

*If the user is Requestor,disable the Supplier Input field and

*Assign Supplier button in Source of Supply screen

if lv_flag = 'X'.

DATA :wD_inp_field TYPE REF TO cl_wd_input_field.

wd_inp_field ?= view->get_element('FIXED_SUPPLIER').

CALL METHOD wd_inp_field->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.

endif.

endif.

endmethod.

But stll the same issue is coming(Fixed supplier and Preferred supplier are getting disabled).Both enabled attributes are bound to the same context attribute and both the values are bound to Context "Partner" attribute.I am not able to see and Fixed supplier input field in my layout preview.But i can see the field in my SRM portal.Could anybody pls help me to resolve this issue.

Thanks and Regards,

Rohiin

Former Member
0 Kudos

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.

Former Member
0 Kudos

No .Even after disabling the fixed supplier field,if I try to enable the "Preferred supplier" by coding(setting its enabled property to true),it is making both the fields as enabled

Former Member
0 Kudos

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.

Former Member
0 Kudos

Hi Soumya,

Could you please check once whether the enabled property of "Fixed Supplier" and "Preferred supplier" are bound to the same attribute(LOCAL_UI_CONTROL->Supplier)in the SRM version which you are using

Former Member
0 Kudos

yes, they are bound to the same property...

can you check if your configurator has been changed?

/SAPSRM/WDCC_FPM_DODC_SC_I_SOS_W

what is the changed by name? is it SAP

Former Member
0 Kudos

I checked the Component configuration.It is lastly changed by SAP only

Former Member
0 Kudos

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