cancel
Showing results for 
Search instead for 
Did you mean: 

Bookmark Loading Issue in SAP Design Studio 1.6

former_member334960
Participant
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

MustafaBensan
Active Contributor
0 Kudos

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.

former_member334960
Participant
0 Kudos

Hi Mustafa,

Thank you for replying as I was looking for a help in this area.

I have 5 tabs in my application and I am trying to add this on one of the tabs. This tab contains 4 List boxes and one chart(List box and chart are interactive)

Issue 1: Bookmark Loading property is set to "Hide and Keep Values" but the prompt window still opens.

Issue 2: Could you please help me with the code for this?

I tried to use fragment bookmark in the below manner: but data doesn't get loaded.

Load script:

Bookmark.FragmentBookmark.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("");

Startup Script:

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

Could you please guide me on this?

Thanks.

MustafaBensan
Active Contributor

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.

Answers (1)

Answers (1)

TammyPowlas
Active Contributor
0 Kudos

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("");
former_member334960
Participant
0 Kudos

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