cancel
Showing results for 
Search instead for 
Did you mean: 

Dropdown in SRM shopping cart item level ( Only for Limit Items)

Former Member
0 Kudos

Hi,

We are using SRM 7.0. we need to add dropdown field for company code under the shopping cart item tab ( Only for Limit Items). In the dropdown, values needs to be filled dynamically based on the instead of fixed domain values.

What are steps needs to be done ? Please explain in details.

Useful answers will be rewarded with points..

Regards,

Arunkumar B.

Accepted Solutions (1)

Accepted Solutions (1)

oliver_wurm
Active Participant
0 Kudos

Hi Arunkumar,

I have implemented a similar enhancement.

Web Dynpro Component is /SAPSRM/WDC_UI_DO_LIMIT. You Need to go into enhancement mode.

Now you can:

1. Add Field BE_CO_CODE to Contect Node LIMIT_ITEM (using the Wizzard to add attributes from components of structure).

2. Add the field to the View (I have chosen a normal Input field) - if you really need it as  a drop down add it as drop down by value. Make sure a (new) Action is assigned to the OnSelect Event and create it (empty for now).

3. Still in enhancement mode add a post-Exit to method WDDOMODIFYVIEW. In this post-Exit add some code that sets the value list of the drop down:

DATA: lt_co_codes TYPE wdr_context_attr_value_list,

           node_limit_item  TYPE REF TO  if_wd_context_node,

           node_info TYPE REF TO if_wd_context_node_info,

           elem_limit_item  TYPE REF TO  if_wd_context_element,

           lv_read_only       TYPE xfeld.

...

  node_limit_item = wd_context->get_child_node( name = wd_this->wdctx_limit_item ).

  elem_limit_item = node_limit_item->get_element(  ).

...

< Your logic to populate lt_co_codes >
...

  node_info = node_limit_item->get_node_info( ).

  node_info->set_attribute_value_set(

          name = 'BE_CO_CODE'

          value_set = lt_co_codes ).

< Your logic to populate LV_READ_ONLY >

    elem_limit_item->set_attribute_property(

      EXPORTING

        attribute_name = 'BE_CO_CODE'

        property       = if_wd_context_element=>e_property-read_only

        value          = lv_read_only ).

4. Write some code that reacts on the Change of the Company code into the Action you have assigned to the OnSelect Event of the Drop Down for the Company Code. You will have to check if the Limit Item was assigned to a plant which becomes invalid if you you just change the Company code of an item. So the Plant Needs to be changed as well. What needs to be in that routine is definitely:

DATA: lv_updated.

* --- Handle Enter Event

  wd_this->mo_dodm_limit->/sapsrm/if_cll_do_mapper~handle_on_enter( ).

  wd_this->mo_dodm_limit->/sapsrm/if_cll_mapper~update( IMPORTING ev_update_performed = lv_updated ).

That's it

Regards

Oliver

Former Member
0 Kudos

Hi Oliver,

Thanks a lot for your reply. I am not clear with the codes you written in the fourth point. Could you please explain in detail ?

Regards,

Arunkumar B.

oliver_wurm
Active Participant
0 Kudos

Hi Arunkumar,

If you select a new Company Code for an item there are other fields on the same item which become invalid by asssigning the new Company code. The Plant/Location is definitely a field that needs to be changed. A Plant can only be valid for exactly one Company Code so if you Change that Company code you will have to update the plant as well, e.g. to the first Plant assigned to the new Company Code. I'm using table BBP_LOCMAP to find the new Plant.

In Addition to that you Need to tell SRM that something was changed. This can be done by

DATA: lv_updated.

* --- Handle Enter Event

  wd_this->mo_dodm_limit->/sapsrm/if_cll_do_mapper~handle_on_enter( ).

  wd_this->mo_dodm_limit->/sapsrm/if_cll_mapper~update( IMPORTING ev_update_performed = lv_updated ).

Regards

Oliver

Former Member
0 Kudos

Hi Oliver,

Thanks again for your explanation. I am still having some doubts. Why do we write the code under WDDOMODIFYVIEW instead of WDDOINIT to populate the dropdown. I hope this is not the dynamic programming.

Regards,

Arunkumar B.

oliver_wurm
Active Participant
0 Kudos

Hi Arunkumar,

I simply thought that the List of Company Codes might Change depending on what the user enters. If the list is static you can populate the drop down list in WDDOINIT as well.

Regards

Oliver

Answers (2)

Answers (2)

laurent_burtaire
Active Contributor
0 Kudos

Hello Arun,

first, read this wiki:

Limit Shopping Cart - Some fields or tabs are not displayed

As a consequence, you need to manage dynamic metadata for field BE_CO_CODE (check BE_CO_CODE method from /SAPSRM/CL_PDO_DYN_MDF_IT_SC class).

Regards.

Laurent.

Former Member
0 Kudos

Hi Arun,

There are three parts in your questions:

Part# 1: we need to add dropdown field for company code under the shopping cart item tab

- If multiple values are assigned in the SRM Org. Structure for any user ID under the attribute "company codes", they would appear in the SC during creation as a drop-down.

So, no additional development would be required for this task.

Part# 2: Restrict the drop-down only for Limit Items

- Take help of your ABAPer and check if any of the two BADIs help you achieve your requirement:

BBP_SC_MODIFY_UI

WD_BADI_DOMODIFYVIEW

Part# 3: In the dropdown, values needs to be filled dynamically based on the instead of fixed domain values.


- How should the values be dynamically populated ?? Let me know if the part# 1 answers this questions.


Br,

Raghu