Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to code dependant dropdowns

Hi

From Function modules i have the following structure which i have mapped to my context:

Building(Node)

|_Build

|_Btext

Room(Node)

|_Build

|_RNr

|_Rtext

In my View I have 2 dropdowns - Building and Room. The Room dropdown values are dependant on the Building value.

I am using Dropdown by key. How do I code the second dropdown so that it populates where

Building.Build == Room.Build?

Below is my code for the 2 dropdowns. Your help is much appreciated and points rewarded.

//SRM-BUILD
IWDAttributeInfo ainfoBuild =wdContext.nodeZhr_Rfc_Dataver_Input().nodeOutputGetData().nodeIt_Outtab().getNodeInfo().getAttribute("Btext");
ISimpleTypeModifiable stBuild = ainfoBuild.getModifiableSimpleType();
IModifiableSimpleValueSet vsBuild =stBuild.getSVServices().getModifiableSimpleValueSet();
for(int i=0;i<wdContext.nodeBuild().size();i++){
     wdContext.nodeBuild().setLeadSelection(i);
     vsBuild.put(wdContext.currentBuildElement().getBuild(),wdContext.currentBuildElement().getStext());
}
	  
   if(wdContext.currentBuildElement().getBuild() != null){
   IWDAttributeInfo ainfoLocation =wdContext.nodeZhr_Rfc_Dataver_Input().nodeOutputGetData().nodeIt_Outtab().getNodeInfo().getAttribute("Rtext");
   ISimpleTypeModifiable stLocation = ainfoLocation.getModifiableSimpleType();
   IModifiableSimpleValueSet vsLocation =stLocation.getSVServices().getModifiableSimpleValueSet();
        if(wdContext.currentBuildElement().getBuild().equals(wdContext.currentLocationElement().getBuild())){
		   for(int i=0;i<wdContext.nodeLocation().size();i++){
			   wdContext.nodeLocation().setLeadSelection(i);
			   if(wdContext.currentBuildElement().getBuild().equals (wdContext.currentLocationElement().getBuild())){
				   vsLocation.put(wdContext.currentLocationElement().getLoc(),wdContext.currentLocationElement().getStext());
			   }
		   } 
	   }
   }

Former Member
Not what you were looking for? View more on this topic or Ask a question