cancel
Showing results for 
Search instead for 
Did you mean: 

Drop down by key Sample Code

former_member540174
Participant
0 Kudos

I to take the results from a function module and put them in a drop down (piece of cake type coding from my .Net/C# days). Is there a tutorial, blog, or sample code from you that shows me how to build a drop down by key from data returned from a function module (it's a key/value pairing of key -course code and value-course description)? The sample code I has does things hardcoded.

Regards,

Diane

Accepted Solutions (1)

Accepted Solutions (1)

former_member197348
Active Contributor
0 Kudos

Hi

Check this [tutorial |https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/user-interface-technology/webdynpro/wd%20java/wdjava%20archive/value%20help%20in%20web%20dynpro%20applications.pdf]

In page 16 you can see the sample code

If you are getting the data from RFC, you can just bind the model attribute which has the descriptions to texts property of DDByIndex.

If the data is in R/3 and the field in R/3 has check table, you can just bind the model attribute to DDByKey

regards,

Siva

Edited by: Siva Rama Krushna on Mar 17, 2008 6:19 PM

former_member540174
Participant
0 Kudos

Here's the FM return

-Eventtype_List_Output

-


Begda

-


Endda

-


Objid <====Key

-


Short

-


Stext <====Value

Why DDbyKey - thought that was what I needed to use. I need a dropdown. Should I use DDbyIndex?

Diane

former_member197348
Active Contributor
0 Kudos

Hi Diane,

You can use DDbyIndex. Bind Stext to texts property of DDbyIndex.

You can get the key of the selected value like this:


//get the leadselection of the node
int i = wdContext.nodeEventtype_List_Output().getLeadSelection(); 
// get the corresponding key of the selected element
wdContext.nodeEventtype_List_Output().getEventtype_List_OutputElementAt(i).getObjid ()

regards,

Siva

Former Member
0 Kudos

...or shorter

wdContext.currentEventtype_List_OutputElement().getObjid()

Armin

Former Member
0 Kudos

That's why I asked. If the output is already in a 0:n node, DropDownbyIndex should be used.

Armin

Answers (1)

Answers (1)

Former Member
0 Kudos

How does the output structure of the FM looks like? Why do you want to use DDByKey?

Armin