SAP Design Studio - Setting Up Bookmarks



When you create an analysis application in the Design Studio, you can create bookmarks for reusability and flexibility. Bookmarks can be created for the snapshot of the full application or a part of it. There are three types of bookmarks that can be used in Design Studio −

  • Standard
  • Fragment
  • Portable fragment

When an application developer wants to serialize the state of entire application, standard bookmark can be used. To use a selected part of an application, a fragment or portable fragment bookmark is used.

Loading Bookmarks Using Scripting

To load a bookmark in running analysis application, you can use scripting method.

To load a standard bookmark, you can use the following format −

Bookmark.loadBookmark(id);.

Now to select a bookmark id, you can select from the drop down list.

var id = DROPDOWN_1.getSelectedValue(); 
Bookmark.loadBookmark(id);

To load a fragment bookmark, you can use the following scripting method.

Bookmark.FragmentBookmark.loadBookmark(id)

To load a portable fragment bookmark, you can use the following scripting method.

Bookmark.PortableFragmentBookmark.loadBookmark(id)

Loading Bookmarks Using URL

You can also load bookmarks shared by other application user via a URL in the browser bar. All the bookmarks that are shared via a URL can’t be directly added to the user lists of that bookmark.

You can bookmark the shared analysis application and that bookmark is then listed when calling the script method.

Bookmark.getAllBookmarks() 
Bookmark.FragmentBookmark.getAllBookmarkInfos() 
Bookmark.PortableFragmentBookmark.getAllBookmarkInfos(groupIdentifier)

You can also save the URL to browser favorites.

Listing Bookmarks

You can use the scripting API to allow application users to retrieve a list of their own bookmarks at runtime. The following script methods are used, depending on the type of bookmark involved.

How to List Standard Bookmarks?

The returned array contains a list of BookmarkInfo object types. A BookmarkInfo object contains BookmarkId id, String name and String text. Both the String name and BookmarkId id refers to the bookmark id. The string text refers to the bookmark title. Any selection component like a Dropdown box or a List box can be populated with the array returned from the Bookmark.getAllBookmarks(); method.

var array = Bookmark.getAllBookmarks(); 
array.forEach(function(element, index)  
{ DROPDOWN_1.addItem(element.name, element.text);  
}); 

How to List Fragment Bookmarks?

You can list the fragment bookmarks to return the list of all fragment bookmarks for an analysis application −

var array = Bookmark.FragmentBookmark.getAllBookmarkInfos();  
array.forEach(function(element, index)  
{ DROPDOWN_1.addItem(element.id, element.title);  
}); 

How to List Portable Fragment Bookmarks for all the Applications?

You can use the following scripting method.

Bookmark.PortableFragmentBookmark.getAllBookmarkInfos();

This returns a list of all portable fragment bookmarks specified by the Group Identifier parameter. You can populate the Fragment Gallery with all portable fragment bookmarks created by the user using the FragmentGallery_1. addItems(); scripting method.

var array = 
Bookmark.PortableFragmentBookmark.getAllBookmarkInfos(“groupIdentifier”);  
FRAGMENTGALLERY_1.addItems(array); 

Saving and Sharing Bookmarks

In SAP Design Studio, an application user can save their bookmarks using the API scripting. You can save standard bookmarks with a unique title mentioned by the users.

You can use the following script to save a standard bookmark.

var id = Bookmark.saveBookmark(); 
var id = Bookmark.saveBookmark("title") 

You can also save a fragment bookmark using the following method.

var fragInfo = Bookmark.FragmentBookmark.saveBookmark(ContainerComponent); 

You can use method an Optional BookmarkInfo toOverWrite – to overwrite an existing fragment bookmark.

Sharing a Bookmark

Application designers can also share their bookmarks using a scripting method. You can run the following scripting method as per the type of the bookmark.

To share a standard bookmark, you can apply − Bookmark.shareBookmark(String URL) scripting method.

To share a fragment bookmark, you can apply −

Bookmark.FragmentBookmark.shareBookmark(String URL) scripting method.

To share a portable fragment bookmark, you can apply −

Bookmark.PortableFragmentBookmark.shareBookmark(String URL) scripting method.

Deleting Bookmarks

In SAP Design Studio, each bookmark owns a parent application. When you delete a parent application, its child bookmarks are deleted. To delete these bookmarks, you can use scripting API methods.

The following scripts can be used as per the bookmark type.

How to Delete Standard Bookmarks?

You can use the following script to allow the application user to delete their own standard bookmarks.

Bookmark.deleteBookmark(id); 
Bookmark.deleteAllBookmarks(); 

How to delete Fragment Bookmarks?

You can use the following script to allow the application user to delete their own fragment bookmarks.

Bookmark.FragmentBookmark.deleteBookmark(id); 
Bookmark.FragmentBookmark.deleteAllBookmarks(); 

How to delete Portable Fragment Bookmarks?

The following scripting method is used to allow the application user to delete their own portable fragment bookmarks.

Bookmark.PortableFragmentBookmark.deleteBookmark(id) 
Bookmark.PortableFragmentBookmark.deleteAllBookmarks(groupIdentifier) 
Advertisements