Tuesday, June 7, 2011

SAP BSP for Lotus Notes Widgets - Display Sales Order example

Follow up to my earlier post on using regular expressions in Lotus Notes widgets for live text recognition and linking this to SAP transactions.

This post covers a generic BSP to construct URLs linked to the Lotus Notes Widgets. This example does not use the Live Text feature instead the SAP transaction is started via selecting text in an email. (It is still possible to use the Live Text feature with the appropriate regular expression)

The objective is to use selected text in emails to link to SAP screen fields in various SAP transactions.

Example for transaction VA03 display order.

The screenshot shows an example email with the SAP related order number.


If the order number is selected and a right click shows the Note menu for widgets
Selecting the Display Order (VA03) in the above example will lead directly to the
transaction - as shown below.


As the Lotus Notes Widget allows you to log on to SAP then further follow up actions can be done in the HTML GUI.

*These examples use Lotus Notes client on windows XP.
BSP setup

Two new pages are added to the same ZBSPLN8 used in the previous transport related example.

The BSP setup shown below.


Page widget.htm

Create attributes FIELD, TEXT and TRAN

Layout code is the javascript form used to for the Live Text widget in Lotus Notes
 <%@page language="javascript"%>
  
 <html>
  
 <head>
  
   <form method="POST" action="widgetresult.htm" target="_parent">
  
       <p> Transaction:
  
     <input type="text" name="tran" >
  
    </p>
  
       <p> Screen Field:
  
     <input type="text" name="field" >
  
    </p>
  
    <p> Text:
  
     <input type="text" name="text" >
  
    </p>
  
       <p>
  
     <input type="submit" value="Lookup Transport">
  
    </p>
  
   </form>  


OnInputProcessing Event Handler

* event handler for checking and processing user input and
* for defining navigation
navigation->set_parameter( 'text' ).
navigation->set_parameter( 'tran' ).
navigation->set_parameter( 'field' ).

Page widgetresult.htm

Create attributes FIELD, TEXT and TRAN

OnInitialization Event Handler
Change the FQDN and port below to the appropriate values,

 * event handler for data retrieval
  
 data: tranc type string,
  
   url_ex type string,
  
   fieldc type string,
  
   textc type string.
  
 tranc = request->get_form_field( 'tran' ).
  
 fieldc = request->get_form_field( 'field' ).
  
 textc = request->get_form_field( 'text' ).
  
 concatenate 'http://F.Q.D.N:PORT/sap/bc/gui/sap/its/webgui?~okcode=*' tranc '+' fieldc '=' textc into url_ex.
  
 navigation->goto_page( url_ex ).  


*System logon changes
See the previous post on the required changes in SICF to allow the system log on page for the BSP. This is required for the Lotus Notes widget to log on to SAP.

Test the BSP and enter the values for the transaction VA03 the screen field for VA03 is VBAK-VBELN.
The text should be a valid order number for the SAP system.














For more information about Screen Fields check out this help.sap.com link

(Screen Fields are also used by GuiXT - see my post in regards to getting a Google static Map onto the SAPGUI which also uses Screen Fields)

Lotus Notes Widget

Check out the previous post for the logon details, below the major changes are noted.

First use the widget.htm page as the initial url



Select the HTTP POST (from a form on this web page)
and select "Authentication required"

Once successfully logged onto SAP, select the form from the BSP as shown below.



Enter the transaction VA03
Screen Field VBAK-VBELN
Text can remain empty
Select Next


Configure the Component




Complete the selections as above for the "Wire as an action" process.


On this screen the "text" field on the form is linked to the selected text in the Lotus Notes email.

This then completes the process. From now the widget will appear in the context menu of any selected text in an email. (repeat) screen shot example.

The screenshot shows an example email with the SAP related order number.



If the order number is selected and a right click shows the Note menu for widgets
Selecting the Display Order (VA03) in the above example will lead directly to the
transaction - as shown below.


Google +