Skip to Content

Bookmark Loading Issue in SAP Design Studio 1.6

Hi All,

I am facing an issue with the bookmarks when loading. Below is the syntax I have used for loading:

Bookmark.loadBookmark(DROPDOWN_2_BM.getSelectedValue());
var bookmarks=Bookmark.getAllBookmarks();
DROPDOWN_2_BM.removeAllItems();
bookmarks.forEach(function(element,index)
{
	DROPDOWN_2_BM.addItem(element.name, element.text);
});
INPUTFIELD_1.setValue("");

I have prompts in my application.

Issue 1: When I select the Load bookmark , the prompts window shows up with warnings of all the bookmarks I gave created last time "Bookmarks are obsolete". (Screenshot attached)

When I click on OK , the prompts window still remains.Nothing is changing. I can only see the prompt window.

Issue 2:I have written a code to remove all items at Startup, but when I execute the application,dropdown still populates with the bookmark names I created last time.

My requirement is : when I click on load bookmark, the data should be changed without the prompts window showing up.

I have tried various options but nothing is changing,Could someone please suggest where I am going wrong as I am trying out the bookmarks feature for the first time.

Thanks.

prompts-window.jpg (43.5 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    May 11, 2017 at 01:32 AM

    Hi Poojitha,

    See my comments below:

    Issue 1: When I select the Load bookmark , the prompts window shows up with warnings of all the bookmarks I gave created last time "Bookmarks are obsolete". (Screenshot attached)

    When I click on OK , the prompts window still remains.Nothing is changing. I can only see the prompt window.

    My requirement is : when I click on load bookmark, the data should be changed without the prompts window showing up.

    To prevent the prompt dialogue being displayed when a bookmark is loaded you should set the Bookmark Loading property of the application to either "Hide and Keep Prompts" or "Hide and Clear Prompts", depending on your requirement.

    Issue 2:I have written a code to remove all items at Startup, but when I execute the application,dropdown still populates with the bookmark names I created last time.

    This issue is probably occurring because you are using Standard Bookmarks, which saves the state of the entire application. Therefore, when you load such a bookmark, it will remember the content of the dropdown from the time the bookmark was saved and then re-populate it, so the sequence of your scripting is important. To avoid such problems I recommend using either Fragment Bookmarks or Portable Fragment Bookmarks where the dropdown component is not included in the bookmark container. This way, when you load the fragment bookmark, it will not influence the content of the dropdown, which you can populate via scripting as per your requirements.

    Regards,

    Mustafa.

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Poojitha,

      Issue 1:

      Make sure that when the bookmark is saved, the prompt values have already been populated. Also, make sure you are using the Bookmark.FragmentBookmark.saveBookmark() method to save the bookmarks as described below.

      Issue 2:

      To retrieve the list of bookmarks you need to use:

      var bookmarks = Bookmark.FragmentBookmark.getAllBookmarkInfos();

      instead of

      var bookmarks = Bookmark.getAllBookmarkInfos();

      And when the bookmarks are being saved, you need to make sure you are using:

      Bookmark.FragmentBookmark.saveBookmark(selection, title?, description?, toOverwrite?, appIdentifier?)

      Regards,

      Mustafa.

  • May 10, 2017 at 06:02 PM

    You may also want to see SAP Note https://launchpad.support.sap.com/#/notes/2050070/E

    What is in your on startup event?

    Mine:

    /* get all bookmarks and fill the LISTBOX_BOOKMARK */
    LISTBOX_BOOKMARK.removeAllItems();
    var bookmarks = Bookmark.getAllBookmarks();
    
    
    bookmarks.forEach(function(element, index) {
      LISTBOX_BOOKMARK.addItem(element.name, element.text);
    });
    
    
    

    I have a button to load bookmarks:

    // Load bookbark with the selected listbox entry  
    // load the all bookmarks again and set the selected value on the listbox
    // set the global variable for delete all bookmarks to false
    
    
    Bookmark.loadBookmark(bm_selected);
    
    
    /* get all Bookmark */
    var bookmarks = Bookmark.getAllBookmarks();
    
    
    bookmarks.forEach(function(element, index) 
    	{
    	LISTBOX_BOOKMARK.addItem(element.name, element.text);
    	});
    
    
    
    
    LISTBOX_BOOKMARK.setSelectedValue(bm_selected);
    
    
    bm_del_all = false;
    TEXT_BOOKMARK_DELALL.setText("");
    
    Add comment
    10|10000 characters needed characters exceeded

    • Hi Tammy,

      Thank you for your response.

      Below is my code at Start up.

      DROPDOWN_2_BM.removeAllItems();
      var bookmarks=Bookmark.getAllBookmarks();
      bookmarks.forEach(function(element,index)
      {
      	DROPDOWN_2_BM.addItem(element.name, element.text);
      });
      INPUTFIELD_1.setValue("");
      

      Code for Loading

      Bookmark.loadBookmark(DROPDOWN_2_BM.getSelectedValue());
      DROPDOWN_2_BM.removeAllItems();
      var bookmarks=Bookmark.getAllBookmarks();
      bookmarks.forEach(function(element,index)
      {
      	DROPDOWN_2_BM.addItem(element.name, element.text);
      });
      INPUTFIELD_1.setValue("");
      

      I compared your code with mine and found few differences.

      Could you please let me know if any global variables are to be created?

      Thanks