Skip to Content

SAP Design Studio - Select the first value of a Dropdown

Hello dear community,

I'm trying to select the first value in a Dropdown box, but I can't find a solution to fix this problem.

I have a dropdown box with multiple values and need to select the text of the first value.

Does somebody know a solution for that ? It doesn't have to be a dropdown box at all cost. I just need something where I can sort alphabetically and then select the first / second / third value of it.

Thanks for the help in advance!

Add comment
10|10000 characters needed characters exceeded

  • Hi Vu,

    Can you provide some more context about the use case you are trying to implement? It sounds like you just want an internal mechanism for sorting a list as an array and then iterate through that list to access its elements one by one, rather than specifically needing a UI component like a dropdown where the items are selected via user interaction. Is that right? As Tammy has pointed out, your data source will be relevant here too.



  • Hi Mustafa,

    yes, you are right.

    I want to sort a list of saved bookmarks alphabetically. After that I want to display the text of the first 3 elements in 3 different text boxes.

    I don't know if I'm using a BEx Query as a datasource. I'm using a relational database schema of Oracle, so I think it's an universe.

  • Get RSS Feed

2 Answers

  • Best Answer
    Jun 29, 2017 at 07:07 AM

    Hi Vu,

    In Design Studio 1.6 there is no option to explicitly sort the list of bookmarks when you use getAllBookmarkInfos(). I can't remember off the top of my head if getAllBookmarkInfos() returns the list in alphabetical order or not. You could try that first and iterate through the first three elements to set the texts. If that doesn't work then the cleanest approach would be to use the SDK Community Collection Utility Component to sort the bookmarks and retrieve the top 3, with code as follows:

    var myBookmarks = Bookmark.getAllBookmarks();
    myBookmarks.forEach(function(bookmarkInfo, index) {
      COLLECTION_1.addItem(, bookmarkInfo.text,index);
    var bookmarkArray = COLLECTION_1.getAsKeyLabelValueArray();
    var bookmark1 = bookmarkArray[0];
    var bookmark2 = bookmarkArray[1];
    var bookmark3 = bookmarkArray[2];

    In the above example I have assumed you are using Standard Bookmarks. You can adapt it for Fragment or Portable Fragment Bookmarks if needed.



    Add comment
    10|10000 characters needed characters exceeded

  • Jun 28, 2017 at 02:37 PM

    Hi Vu - I assume you are using a BEx query as a data source?

    In the dropdown you could set the member display settings at the application start-up and in the binding

    DROPDOWN_1.setItems(DS_1.getMemberList("ZPROJ", MemberPresentation.INTERNAL_KEY, MemberDisplay.TEXT_KEY, 5, "ALL"));

    But I am not sure if that is what you are looking for.

    Add comment
    10|10000 characters needed characters exceeded