Skip to Content

Lately I got the order to implement a FlexUI command to copy the KM GUID (the “short ID”) into the windows clipboard just by one click. The use case was quite valid: If one wants to paste links to a certain KM resource into other documents or into a mail for example, it is a muddle to create this. The official way takes many clicks if using the standard Details command: DetailsSettingsPropertiesAccess Links – mark & copy the Short ID — this for example results in “/guid/508c546c-736f-2a10-efa2-8662ff5ffd80”; and then mark & copy the beginning of the Explorer URL to fetch the first part of the URL, which then for example is “http://localhost:50000/irj/go/km/navigation“. Putting both parts together creates the address one was looking for – all but user friendly, isn’t it?

So I started to develop the command, and at a certain point, I just wanted to have a look at the SAP source code to access the short ID programmatically (it’s often faster to look at the original code then to use the JavaDoc). Doing so, I stumbled over a property renderer which was offering just what I wanted to implement – it is offering a link beneath the rendered short ID to copy the URL into the clipboard. Having seen this, I thought that if somebody has implemented this property renderer, the corresponding command can’t be far away — and that was the case 🙂

Both features are undocumented, and I’m also unsure how “old” they are. From the information I got from my customer as well as from my local portal installation, it seems to be provided with SPS20 on NW ’04 (which corresponds to SPS12 on NW 7.0); the implementing class names partially don’t follow the standard naming conventions, so maybe some details will change when these features will be made officially available. Screenshots following are taken from SPS13 on NW 7.0.


Property Renderer Offering a Copy to Clipboard Link

The aforementioned Short ID property within the Access Links properties group technically is represented by the standard property cm_rnd_shortID which is rendered by the property renderer rnd_shortID. But there is one additional property maintained (but not put into the default property groups) with a different property renderer: cm_rnd_shortID_copy, rendered by rnd_shortID_copy_s. And there is even one more property renderer rnd_shortID_copy. Lets have a look at these:

The additional property of course is not a “real” property but is just a dummy property serving as a placeholder to bring the property renderer into the game. It is no problem just to use the different property renderers for the original property (which in turn is also just a placeholder, as the GUID is created bythe UriMapperService, and not a real property of a KM resource).

Here are the results of the different renderers. First the rnd_shortID_copy, which renders the Short ID as usual but with an additional link to copy the GUID-URL into the clipboard:


The rnd_shortID_copy_s renderer only renders the link and leaves out the ID itself:


The Copy to Clipboard Command

Beneath the possibility to render the standard property with an additional or simply as  a “Copy Short ID to Clipboard” link, there is also an equivalent command offered, which is very user friendly, as it reduces the click rate massively (you don’t need to go via DetailsSettingsPropertiesAcccess Links any more).

The name of this command is “copy_urlTo_clipboard”, and it isn’t part of any command group within the standard delivery (yet). One good place in my opinion could be the SingleDetailsGroup command group, which is used quite often to offer access to the details of a resource. To test the command, you could just alter this standard command group and add “,copy_urlTo_clipboard” into the groups command list:


With that, you can call for example a navigation iView with the AdminExplorer layout set, et voilà, the command appears, and pressing it it seems not to do anything – as it does its job in the background, copying the full URL into the windows clipboard:


CTRL-V in this case pastes for example http://localhost:50000/irj/go/km/navigation/guid/508c546c-736f-2a10-efa2-8662ff5ffd80.

The Logic of Determining the URL


  1. External links are used “as is”, so no GUID comes into the game. If a KM link points to, exactly this value will be in the clipboard.
  2. Internal links are resolved, so the URL within the clipboard does not point to the link resource but to the resource targeted by the link; see 3. and 4. also for the target resource and how it is handled.
  3. For KM collections (folders) the URL points to the navigation component (as it can be seen in the example above).
  4. For “real” KM resources (no link, no collection, but some kind of document) the URL points to the docs component, so that calling the URL would bring up the document itself.

The Magic Behind

Pasting some text from IE-JS into the clipboard is really trivial: window.clipboardData.setData(‘Text’, theTextToBePasted)

Doing the same for Mozilla / Firefox is much more a hassle; there are security constraints to consider, and the coding is all but short or intuitive. A first overview is given on A different approach using some Flash file is announced by Jeffrey Larson, very interesting.

Anyhow, SAP has implemented the pure JS approach (see for the template SAP used) and the best is: It is rendered by the WdfProxy class, somewhat the “heart” of the FlexUI framework. So, if you want to implement any kind of “Copy some stuff to clipboard” command or renderer link, all you have to call is the JS function copy_clip(theTextToBePasted)! Happy clipboarding 🙂

To report this post you need to login first.


You must be Logged on to comment or reply to a post.

  1. Rahul Urs
    Hi Detlev,
    just wondering if Portal content objects can be copied as a URL just like the KM objects …any ideas ??
    the current method is to navigate to copy the link and go to system administration  > navigation > short URL >
    type ROLES://  followed by the PCD location
    and determine your short URL and then concatenate the  URL using the short ID.  thats painful and I just want to find out an easier way like the one you have here….Good Job in stumbling on those property renderer’s..

    Rahul Urs

    1. Detlev Beutner Post author
      Hi Rahul,
      You can use the “Add to Browser Favorites” function of the page title bar and then copy the URL from the IE favorites. This is at least much faster than the way you showed…
      Hope it helps, Detlev
    1. Detlev Beutner Post author
      Hi Lisette,
      Sorry to say that I’m not familiar with the MAC universe; anyhow, in the end it depends very much on the browser which is used and how this browser supports copying text into the clipboard. Firefox should be supported, for any other browser you really would have to implement this command one more time (or find out how it works and get in touch with the “right” SAP developer, so that the JS copy function would respect this browser, too).
      Best regards, Detlev

Leave a Reply