Wednesday, October 19, 2011

The poor man's interface (use case 1)

How to connect from SAP to SharePoint to show related documents

Use case:
In SAP we have the registration of objects, and we want to link relevant documents or forms to these objects. Instead of the options SAP DMS, Web Dynpro or Adobe forms, we want to make use of SharePoint for this purpose.
So related documents are stored in SharePoint. But how to get to them, how to upload them and link them to the SAP objects?


Solution:
With some modest customization of SAP it is possible to present an option (under the button) to open a browser with a constructed url based on the metadata from SAP. For example: http://sp2010/objectinfo/default.aspx?ObjectID=obj000333
The first part of the url is static:"http://sp2010/objectinfo/default.aspx?ObjectID=", and the ID of the SAP object is added: "obj000333".
This url will connect to the default page of a Document Center site in SharePoint.


What should the user experience be like?
First of all we want to show a selection of documents and pictures based on the ID of the SAP object. This can be done with the help of a Query String (URL) Filter webpart that gets the value of the Query String Parameter: ObjectID. Then we connect to send the filter values to the Documents and Pictures webpart.


We should also be able to add new documents or pictures to the libraries and have the object ID added to them automatically after upload. With the help of javascript we are able to store the Object ID and current user ID as session variables, so the values can be used after upload to modify the properties of the (new) documents and pictures. This is one of the Off-The-Shelf scripts that I have described in an earlier post.

Finally we want to show an input box with the Object ID as default value, and the manual input can be used to change the filter value on the spot.



When the documents are stored in more than one location it's better to fire a search query from SAP.
Add the ObjectID as managed property to your search administration, so it will be indexed and can be used as keyword in the search query.
The url should be like: http://sp2010/SearchCenter/Pages/results.aspx?k=ObjectID%3A%22obj000333%22

Monday, October 17, 2011

Return to the context of the contextual search

The contextual search is integrated in the standard search center of SharePoint 2010. So we have one search experience, that can be modified.
The scope of the contextual search is added to the search query url by the parameters cs (contextual scope: This Site/This List) and u (url of the site/list).


The masterpage of the search center doesn't provide any navigation. And other portals are not part of the navigation within the Home site. But it would be nice to be able to go back to where we started the search, no matter where we came from. This can be done with some simple Html and javascript.
Add a HTML Form Web Part to the left zone of the search results page and paste the following code into the source editor:


<br/>&#160;&#160;&#160;<a href="/"><img class="ms-rtePosition-4" alt="Go Home" src="/_layouts/images/hhome.png" border="0"/></a>&#160;<font color="#0072bc"><a href="/">Go Home</a>&#160; </font><a href="#" onClick="javascript:window.location.replace(GetUrlKeyValue('u'));"><img class="ms-rtePosition-4" alt="Go Back" src="/_layouts/images/back.gif" border="0"/></a>&#160;<a href="#" onClick="javascript:window.location.replace(GetUrlKeyValue('u'));">Go Back</a><br/><br/>

This results in two options: go home, or go back to the context.
When there is no context, you will return to the default page of the search center.