cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with Dropdown list box data binding

former_member758419
Active Participant
0 Kudos

Hi,

I need to have a dropdown list box in my application, Where the values of the listbox should be populated from a database table entries[zstudent-name]. For this requirement should i use DropDownByIndex or DropDownByKey. Also can u tell me how to bind the data from the database table to dropdownlist box. I studied help.sap.com regarding this but not able to create the binding.. Please provide some sample codes which demonstrates the data binding..

Thanks,

Sachidanand.B

Accepted Solutions (1)

Accepted Solutions (1)

rainer_liebisch
Contributor
0 Kudos

Hi,

please read the following blog:

/people/thomas.szcs/blog/2006/07/24/basic-concepts--selection-vs-leadselection

This explains exactly what you want to achieve.

Regards,

Rainer

former_member758419
Active Participant
0 Kudos

Hi Rainer,,

I studied that blog and also implemented the same in my system, but once i created the empty action and assigned it to the onselect of the first dropdown, the application is not responding when i select any value in the first dropdown box, The browser shows "Wait..." image.

For that i removed the empty action and placed a button for the same purpose, then the application works for the first value in dropdown i.e., '1'. Even then if i select any other value from dropdown and press the button the application doesnt respond and shows "WAIT..." image on the browser..

Please help me with this,,,

Thanks,

Sachidanand.B

thomas_szcs
Active Contributor
0 Kudos

Hi Sachi,

It's probably the browser you are using. Try to switch to IE and test it again.

Best regards,

Thomas

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi.

The way I've bound values from a table to a dropdown is via a supply function. You can create a supply function that reads the desired table (e.g. a master data text table ) and fills a context node with key and text data. Then, you bind the DropDownByIndex to the text attribute inside the context node.

The result is a dynamically produced list of dropdown selection options based on a table. As the table changes, the screen will adjust automatically.

Use can then methods in the previous posts to retrieve the user selection for the key in the context node.

Regards,

Adam

Former Member
0 Kudos

Hi,

create a node with cadinality 1..n, with an attribute "text" type string and a supply function, in which you fill the attribute text of your node with your table-data you selected in this method before.

Then map this node from your controller to your view, and bind the text-attribute in the context to your DropDownByIndex - texts Property.

You can find out, which element is selected by calling the function getleadselectionindex( ).

Regards

Message was edited by:

Michael Kappler

former_member758419
Active Participant
0 Kudos

Hi,

I was able to bind the dropdown list box with the database table by creating a bapi to populate the data and using that bapi as a model and the bapi call was made in method WDDOINIT of the view.

But i need to populate values second dropdown list box based on the selection of value in first dropdown box. Please tell me how to do this,

Hi Micheal,

>> Using supply function to bind dropdownlist box with database table.

I tried with the supply function to bind dropdown list box with table, but the problem that i face is, filling the attribute 'text' of our node with the table data, please tell me how to use select queries inside supply function and fill the attribute text, so that i can try even this method to bind the UI element with table. Please provide some sample code regarding this,

Thanks,

Sachidanand.B