Skip to Content
avatar image
Former Member

Question about EVS dropdown

I am stuck with something on an EVS dropdown and am hoping someone here may be able to help me out. Here's the situation (for simplicity, I've eliminated all extra fields from view):

-- The controller calls an RFC to get the values that will be used to build the dropdown. Here's the wdDoInit method of the controller:

public void wdDoInit() {
//@@begin wdDoInit()
  Zwm_Fossil_Notif_Code_Values_Input input = new Zwm_Fossil_Notif_Code_Values_Input();
  wdContext.nodeMnZwm_Fossil_Notif_Code_Values_Input().bind(input);
  try {
    wdContext.currentMnZwm_Fossil_Notif_Code_Values_InputElement().modelObject().execute();
    wdContext.nodeOutput().invalidate();
    IPublicDropdownsNewComponent.IPriorityNode node = wdContext.nodePriority();
  } catch (WDDynamicRFCExecuteException e) {
    e.printStackTrace();
  }
  IWDAttributeInfo attributeInfo = wdContext.getNodeInfo().getAttribute(IPrivateDropdownsTestView.IContextElement.PRIORITY);
  ISimpleTypeModifiable priorityType = attributeInfo.getModifiableSimpleType();
  //	Set field label and populate valueset
  IModifiableSimpleValueSet valueSet = priorityType.getSVServices().getModifiableSimpleValueSet();
  for (int i = 0; i < wdContext.nodePriority().size(); i++) {
    IPublicDropdownsNewComponent.IPriorityElement ele = (IPublicDropdownsNewComponent.IPriorityElement)wdContext.nodePriority().getElementAt(i);
    valueSet.put(ele.getPriok(), ele.getPriokx());
  }
  wdContext.currentContextElement().setPriority(" ");
//@@end
}

-- The controller's context has a model node that's bound to the output of the RFC. One of the tables in the output is called Priority. It has a key (Priok) and value (Priokx)

-- The controller's context also has a value attribute of type String named Priority

-- The view has an input field and a button

-- The view's context has a value attribute named Priority

-- The input field is named EVSInputField and is bound to the context value attribute named Priority

-- The button is bound to an action. The code for the action method is below. It doesn't really do anything now other than get the selected value. Eventually, I want to put logic in it to call another RFC and pass it the key that corresponds to the value that was selected in the dropdown:

public void onActionPrioritySelected(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent) {
//@@begin 
  String selected = wdContext.currentContextElement().getPriority();
//@@end
}

OK, so that's the background. One thing I need to mention. I don't really know if I need the value attribute named Priority in the Controller's context.

When I click the icon to the right of the text box a table comes up. It shows two columns. One column shows the key and the other shows the value. For example. a value could be "Urgent" or "Critical" and the keys are "1" and "2",

<b>My problem is:</b>

When I select a row I want the value (e.g. "Urgent") to show in the drop down but I want to be able to access the corresponding key (e.g. "1") in my code so I can use that when passing data back to another RFC which will perform some business logic.I can't figure out how to do that.

Any help would be greatly appreciated.

Please don't just reply with links to tutorials or other posts unless you know that it really relates to what I'm asking. I've searched SDN and gone through a bunch of tutorials but I still can't figure out what's wrong. It's quite possible that I've missed something very simple in one of them. If that's the case, I would REALLY appreciate it if you would give me an idea of WHERE in the tutorial or (better yet) in my code I've gone wrong.

Nothing against SDN but I've found that a lot of times it appears people just post answers with links to other posts or tutorials/blogs without really understanding what the actual question was.

I'm not afraid to do some digging but the rush by some people to get points seems to cause them to take shortcuts and not really take the time to understand what the question was. That ends up causing the person who asked the question to spend a lot of time reading, trying to understand, material that is not really related to what they asked.

Sorry for the rant. : ) I really, really appreciate having a site like this and don't want to offend anyone. I'm just trying to make a suggestion that, hopefully, will help us all.

Again, thanks in advance for any help.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    May 13, 2007 at 05:03 PM

    - <i>Much Ado About Nothing</i>

    Why don't you use Dropdown by key UI element ? It solves your purpose exactly(if the list to be displayed is not huge i.e). And if you are so keen on using a input field ui element, i can only give you this link ( much against your wishes )

    yet" target="_blank">https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/webcontent/uuid/28113de9-0601-0010-71a3-c87806865f26?rid=/library/uuid/391ee590-0201-0010-1c89-f1193a886421">yet [original link is broken] [original link is broken]

    Regards

    kk

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      kk,

      You were right! The DropdownbyKey is exactly what I was looking for. I was doing the EVS option because that was recommended to me by someone else. My fault for not researching it more before using it. I'll learn! : )

      Thanks again.

      Oh and by the way, the link was very useful. I will need to do EVS++ in another part of my system.