SAP Workflow Apps for Office Application using SAP Gateway for Microsoft
SAP Gateway for Microsoft (GWM) is a product that simplifies the integration of SAP Gateway based services into Microsoft products. GWM provides an interoperability layer that makes sure that applications can communicate in a secure, reliable and scalable manner with SAP backend systems.
The GWM add-in for Visual Studio provides an extensive OData browsing functionality, a set of templates that can be used to create Contact, Calendar or Workflow-based scenarios in Microsoft Outlook 2010 and 2013 and also provides a generic service generation for any Visual Studio C# project. For details refer: SAP Gateway for Microsoft.
SAP Workflow Apps for Office Application helps to retrieve work item details (ex: leave requests, Travel Requests, Purchase Order Requests….etc.) from SAP Backend and update (Approve\Reject) request using Task Gateway Service V2, which is THE central workflow service that is used by plenty of (Fiori) applications, for example SAP FIori – MyInbox. This means that if you have already the SAP Fiori – My Inbox running, you can now easily also bring your workflows to Outlook. For details refer: Task Gateway Service Version 2.
This application supports 2 ways of accessing the TaskProcessingV2 (controlled through configurations as explained below in the configuration section).
- Directly from Gateway (Default).
- Through Azure via Provider Systems configured in GWM Azure Portal.
This application and this blog focuses on 2 potential scenarios (controlled through configurations as explained below in the configuration section).
- Any sample Workflow in the SAP Backend system – Showcases how you can take any workflow that you want to build or that you might already have in your system and expose it to Outlook.
- SAP Standard Travel request – Showcases how you can use existing out of the box SAP workflow services and get them to Outlook.
Note: Sample Workflow in this application can be considered as the Leave request workflow.
Application code can be downloaded from the GitHub Repository
- Operating System – Windows 7 and Windows 8.
- Microsoft Visual Studio 2013 Editions – Professional, Premium, Ultimate and Community.
- Net Framework 4.5.
- Microsoft Office Professional 2013 and Microsoft Office 365 (Office Online).
- Required Library Files– The following Dynamic Link Library files (with the extension .dll) should be present in the Global Assembly Cache (GAC) folder for installation:
- Newtonsoft.Json.dll (version 5.0.6)
- Microsoft.IdentityModel.Clients.ActiveDirectory.dll (version 1.0.2)
- Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll (version 1.0.2)
- Newtonsoft.Json.dll is available in the Json.Net 5.0.6 package,
- Microsoft.IdentityModel.Clients.ActiveDirectory.dll and
- Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll are available in the Active Directory Authentication Library 1.0.2 package. These packages can be downloaded at https://www.nuget.org/ with a registered account. The downloaded files can be extracted to view the DLL files in the lib folder based on the .NET Framework version. Follow these steps to add the required DLL files to the GAC folder:
- Open Visual Studio Tools on the Start menu, right-click on Developer Command Prompt for VS2013 or Developer Command Prompt for VS2010 (depending on the version of Visual Studio being used) and choose Run as Administrator , choose Yes if Windows displays a security prompt.
- In Developer Command Prompt , run the command gacutil -if and press Enter. Repeat this step till all the required DLL files are added successfully.
- SAP Gateway for Microsoft (GWM) Solution.
This application supports 2 ways of accessing Task Processing Service controlled by configurations in the Web.Config file.
- Directly from Gateway – Provide the below values under Gateway Configurations section in the Web.Config.
- Through Azure via Provider Systems configured in Azure Portal – Provide the below values under Azure Configurations section in the Web.Config.
Note: GatewayRequestType/ AzureRequestType determines if it is sample Workflow or SAP Standard Travel request.
Steps to run the Apps for Office Workflow Application:
Note: You need to have a workflow and a related Taskprocessing service configured and accessible.
- Download the SAP.Workflow.AppsforOfficeApplication code from Github.
- Extract the file.
- Open SAP.Workflow.AppsforOfficeApplication.sln file.
- Build the project.
- Deploy the solution.
- Run the project.[BH1]
- Enter the credentials to connect to Exchange email account.
- Open the Workflow notification mail received in the inbox.
- Click on the WorkflowApp.
- Apps for Office Workflow application for Sample WF loads and displays the details of the request from the SAP Backend.
- Approve\Reject the request.
- Request gets updated in the SAP Backend system.
- When you reopen the request, details are fetched from the SAP Backend.
About SAP.AppsforOffice.WorkflowAppln Code:
- Structure of the code – 2 main projects as below
- Description of the main files of the project
- AADSSOTravelAgency.xml: Contains Activation rules. Out of the box, App will be enabled in the mails if the subject contains “# followed by numbers until next space”.
- Images: Added images for SAP Icon, Approve, Reject and Close.
- Pages->Utilities->Constant.cs: Maintain Gateway system user credentials which are used to access Task Processing Service.
- Pages->AzurePages->Default.aspx.cs: Retrieves task details (Get) from SAP backend and Approve\Reject (Post) for Azure scenario.
- Pages->GatewayPages->DefaultForGateway.cs: Retrieves task details (Get) from SAP backend, getting Decision Options and Approve\Reject (Post) for Gateway scenario.
- Pages->AzurePages->UserInfoPage.cs: Getting Decision Options for Azure scenario.
- Pages->AzurePages->UserInfo.js: Creates Approve\Reject buttons if Decision Options are available, displays status message upon Approve\Reject.
Sample Workflow in the SAP Backend:
- This application supports any workflow created in SAP backend. Example: as show below.
- Sample workflow as shown above is for the Leave request scenario. We have provided “Name”, “From Date”, and “To Date” as part of parameters. Decision Options – “Approve” and “Reject”.
- “Name”, “From Date”, and “To Date” are categorized as Custom Attributes for Leave request and these values can be accessed using navigation property “CustomAttributeDefinitionData” and “CustomAttributeData”. For details refer: Custom Attributes.
End to End flow:
Below steps demonstrates how to create work items (Leave requests) in the SAP backend, send the Leave requests to Outlook 2013 (Office 365), retrieve details of therequest in Office 365 and Approve\Reject the request.
- Open the workflow in SWDD transaction
- Press on F8 to run the workflow
- Provide “Name”, “From Date”, and “To Date”.
- Press on F8 and then cancel button to get the Work item Id.
- You can track this leave request in Business Workplace of the requester (inbox) in the transaction SBWP.
- To send this leave request to Office 365 -> Send a mail from any Id to the approver’s Office 365 mail Id. Make sure subject has “# followed by Work item number generated above”.
- Login to approver’s Office 365 -> Check for the new mail waiting for approval.
- Click on the WorkflowApp -> Apps for Office Application for leave request will be loaded by fetching the request details from SAP backend.
- Approve\Reject the request -> leave request gets approved\rejected in the SAP backend.
- Upon refreshing the App -> leave requests details are fetched from SAP backend which means we get the real time status of the request in case request is updated from another application.
- Status of this leave request gets updated in the SAP backend.
(http://service.sap.com/patches -> Support Packages and Patches -> G -> GWPAM -> GWPAM 1.0 )
Demos & Videos
- Teaser Video
- CodeTalk session withIan Thain
- Overview: SAP NetWeaver Gateway productivity accelerator for Microsoft
- Technical Overview: SAP Gateway for Microsoft
- Playlist: GWPAM Overview
- Playlist: GWPAM Technical Overview
Lectures & How-Go Guides
Connect with us: