e25ce5a7-0901-0010-aeaf-ee8e67de9029

Upload: carlosvillanuevaqwistgaard

Post on 06-Apr-2018

215 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/3/2019 e25ce5a7-0901-0010-aeaf-ee8e67de9029

    1/10

    Employee Self-Service Sample Applicationfor Microsoft SharePoint, Created with SAPPDK for .NET.

    2005 SAP AG The SAP Developer Network:http://sdn.sap.com

    Applies to:

    SAP NetWeaver 04 SPS15, Portal Development Kit 2.0 for Microsoft .NET.

    Microsoft Visual Studio .NET 2003

    SAP ESA Fast Track

    Microsoft SharePoint Portal Server 2003

    Summary

    This article introduces a sample Employee Self-Service application developed with SAP PortalDevelopment Kit 2.0 for Microsoft .NET and integrated into Microsoft SharePoint Portal Server.

    By: Tarnoruder Anne, SAP NetWeaver Product Management

    Company: SAP

    Date: February 2006

    Level of difficulty

    Technical consultants, developers

    Table of Contents

    Introduction.......................................................................................................................................2Prerequisites.................................................................................................................................2

    Application........................................................................................................................................3Architecture...................................................................................................................................3

    Implementation.................................................................................................................................4Creating a Web Service Wrapper Component.............................................................................4Creating a Portal Component .......................................................................................................5

    Implementing UI........................................................................................................................5Creating a Typed Dataset.........................................................................................................5Adding Code .............................................................................................................................6

    Testing in SAP NetWeaver Portal ................................................................................................6Packaging for SharePoint Portal ..................................................................................................6Integration into SharePoint Portal.................................................................................................7Integration into SharePoint Portal.................................................................................................7

    Running the Application ...................................................................................................................8

    1

  • 8/3/2019 e25ce5a7-0901-0010-aeaf-ee8e67de9029

    2/10

    Employee Self-Service Sample Applicationfor Microsoft SharePoint, Created with SAPPDK for .NET.

    2005 SAP AG The SAP Developer Network:http://sdn.sap.com

    Introduction

    This article introduces a sample Employee Self-Service application, based on the SAP ESA Preview

    System developed with SAP Portal Development Kit 2.0 for Microsoft .NET (PDK for .NET), andintegrated into Microsoft SharePoint Portal Server 2003.

    The application enables employees to request a leave, as well as view their current balance of used andremaining leave days for a given period.

    This application illustrates:

    How enterprise services from the SAP ESA Preview System are consumed in order to implementa business process.

    How to enable integration of the content created with PDK 2.0 for .NET into Microsoft SharePointPortal Server 2003.

    Prerequisites

    Microsoft Visual Studio .NET 2003 installed on a development host

    Portal Add-in 2.0 for Visual Studio 2003 installed on a development host

    Portal Runtime 2.0 for Microsoft .NET installed and running on a Microsoft SharePoint PortalServer

    For detailed installation instructions, see Installation, Upgrade and Configuration Guide PDK for .NET.

    Microsoft SharePoint Portal Server configured to run SAP portal content (see Integration of SAP

    Portal Content into Microsoft SharePoint Portal Server )

    Access to ESA Preview System (see Introduction to ESA Preview System).

    1

    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/6807356c-0801-0010-7082-c007cb67fff1https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/6844e48d-0901-0010-b4b2-d5666689ca8bhttps://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/6844e48d-0901-0010-b4b2-d5666689ca8bhttps://www.sdn.sap.com/irj/sdn/developerareas/esa/esapreviewhttps://www.sdn.sap.com/irj/sdn/developerareas/esa/esapreviewhttps://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/6844e48d-0901-0010-b4b2-d5666689ca8bhttps://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/6844e48d-0901-0010-b4b2-d5666689ca8bhttps://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/6807356c-0801-0010-7082-c007cb67fff1
  • 8/3/2019 e25ce5a7-0901-0010-aeaf-ee8e67de9029

    3/10

    Employee Self-Service Sample Applicationfor Microsoft SharePoint, Created with SAPPDK for .NET.

    2005 SAP AG The SAP Developer Network:http://sdn.sap.com

    Application

    The employee self-service LeaveRequestsample application consists of two components, representing

    two separate presentation and business layers: a portal component that implements the user interface ofthe application, and a Web services wrapper component that encapsulates the functionality provided bythe Time and Attendance Enterpise Services from SAP ESA Preview System. These enterprise Webservices retrieve data from the underlying business system, and execute the relevant business processes.

    The application is packaged and deployed to both SAP NetWeaver Portal and Microsoft SharePoint PortalServer, where it is integrated into a portal page.

    Architecture

    The following diagram illustrates the architecture and deployment of the LeaveRequestapplication.

    MS Visual Studio 2003

    Microsoft SharePointPortal Server

    ESA Preview SystemPersonnel

    Time and AttendanceWeb Services

    ESS Leave RequestPortal Application

    Portalcomponent

    WS wrappercomponent

    SAP NetWeaverPortal

    LeaveRequestiView

    LeaveRequestWeb Part

    DeployWeb Part

    DeployPAR

    1

    https://esapreview.sap.com/socoview(bD1lbiZjPTgwMCZkPW1pbiZ3PTczNDAwMDAr)/smdisplay.asp?id=5BFB2DFC05E2446C8308CBBF01F622FE&fragID=1177997D911B42EA9FB283AD0A88666E&packageid=607955A13D5EC14C8A9405A7D7A37BE9&iv=https://esapreview.sap.com/socoview(bD1lbiZjPTgwMCZkPW1pbiZ3PTczNDAwMDAr)/smdisplay.asp?id=5BFB2DFC05E2446C8308CBBF01F622FE&fragID=1177997D911B42EA9FB283AD0A88666E&packageid=607955A13D5EC14C8A9405A7D7A37BE9&iv=
  • 8/3/2019 e25ce5a7-0901-0010-aeaf-ee8e67de9029

    4/10

    Employee Self-Service Sample Applicationfor Microsoft SharePoint, Created with SAPPDK for .NET.

    2005 SAP AG The SAP Developer Network:http://sdn.sap.com

    Implementation

    The following workflow lists the steps required for the implementation of the Leave Requestapplication:

    Creating a Web service wrapper component

    Creating a portal component

    Testing in SAP NetWeaver Portal

    Packaging for the SharePoint portal

    Integration into the SharePoint portal

    Creating a Web Service Wrapper Component

    The Web service wrapper component encapsulates the business logic provided by the Web servicesavailable in ESA Preview System. This component exposes the data types and methods that are used bythe portal component.

    To create the Web service wrapper component:

    1.

    2.

    3.

    4.

    5.

    6.

    Log on to your development host.

    Open Microsoft Visual Studio 2003.

    Open a new solution.

    Add a new Visual C# project of the Class Librarytype, and name it EsaESS.

    Add a reference to System.Web.Services.

    Add a reference to each of the following Web services available in ESA Preview System.

    Web Reference Description

    EmployeeAbsenceTypeList_WS Returns a restricted list of absence types for anemployee.

    EmployeeAbsenceQuotas_WS Provides all absence quotas data for a givenemployee on a given date. The service returns atable containing the following information for eachabsence quota: type and description, unit (days /hours), deduction period, entitlement, the amountused and the amount remaining of the quota.

    EmployeeAbsenceCreate_WS Creates a generic absence; performs a plausibilitycheck on absence data and transfers it to the SAPR/3 System.

    7.

    8.

    Delete the automatically created Class1.csfile, create a new class and name it SelfService.sc.

    Add the implementation code. For details, inspect the SelfServices.csclass in the attachedapplication source.

    1

    http://erp.esapreview.sap.com/sap/bc/srt/xip/sap/EmployeeAbsenceTypeList_WSD?sap-client=800&wsdl=1.1http://erp.esapreview.sap.com/sap/bc/srt/xip/sap/EmployeeAbsenceQuotas_WSD?sap-client=800&wsdl=1.1http://erp.esapreview.sap.com/sap/bc/srt/xip/sap/EmployeeAbsencesCreate_WSD?sap-client=800&wsdl=1.1http://erp.esapreview.sap.com/sap/bc/srt/xip/sap/EmployeeAbsencesCreate_WSD?sap-client=800&wsdl=1.1http://erp.esapreview.sap.com/sap/bc/srt/xip/sap/EmployeeAbsenceQuotas_WSD?sap-client=800&wsdl=1.1http://erp.esapreview.sap.com/sap/bc/srt/xip/sap/EmployeeAbsenceTypeList_WSD?sap-client=800&wsdl=1.1
  • 8/3/2019 e25ce5a7-0901-0010-aeaf-ee8e67de9029

    5/10

    Employee Self-Service Sample Applicationfor Microsoft SharePoint, Created with SAPPDK for .NET.

    2005 SAP AG The SAP Developer Network:http://sdn.sap.com

    Creating a Portal Component

    The portal component contains a number of SAP NetWeaver .NET controls, including a table, and a typeddataset that is used for data binding of the table.

    Implementing UI

    Add a new SAP Portal Application project, and name it LeaveRequest.1.

    2.

    3.

    1.2.

    Add a new portal component, and name it Request.

    Open the component in Design view, and drag the following controls from the SAP NetWeaver tabin the Toolbox: a MessageArea, three Labels, a Table, a LinkToAction, a DropDownByKey, anInputField, and two Buttoncontrols.

    Creating a Typed Dataset

    Add a new dataset item to the project, and name it DSUserData.xsd.Open the dataset item in the designer, and add an element and five attributes, setting their namesand types as follows:

    3. Add a dataset control to the portal component and generate a typed dataset, naming itDsUserData.

    The resulting portal component should look like this:

    1

  • 8/3/2019 e25ce5a7-0901-0010-aeaf-ee8e67de9029

    6/10

    Employee Self-Service Sample Applicationfor Microsoft SharePoint, Created with SAPPDK for .NET.

    2005 SAP AG The SAP Developer Network:http://sdn.sap.com

    Adding Code

    Add a reference to the EsaESSproject.1.

    2.

    1.

    2.

    3.

    4.

    1.

    2.

    3.

    4.

    5.

    6.

    Open the code-behind class of the portal component, and add the event handlers that call therelevant methods of the wrapper component. For details, inspect the Request.ascxportalcomponent in the attached application source.

    Testing in SAP NetWeaver Portal

    Build and deploy your project to the current SAP NetWeaver Portal.

    Add a page to the project and drag the Requestcomponent onto it, thus creating an iView.

    Right-click your project and select Publish Project.

    Click the Preview tab of the page to test the application in the portal.

    Packaging for SharePoint Portal

    From the Toolsmenu, select Options.

    In the Optionsdialog box, expand the SAP PDKfolder.

    Set the Targetproperty under Output Settingsto Microsoft SharePoint and click OK.

    Restart Visual Studio.

    From the project menu, select Create PAR.

    From the project menu, select Create Web Part Package.

    The LeaveRequest.parand LeaveRequest.cabfiles are created in the output folder specified in theProject PAR properties. These files are ready to be deployed to a Microsoft SharePoint Portal Server2003.

    1

  • 8/3/2019 e25ce5a7-0901-0010-aeaf-ee8e67de9029

    7/10

    Employee Self-Service Sample Applicationfor Microsoft SharePoint, Created with SAPPDK for .NET.

    2005 SAP AG The SAP Developer Network:http://sdn.sap.com

    Integration into SharePoint Portal

    Follow the instructions in the Integration of SAP Portal Content into Microsoft SharePoint Portal Server

    guide for preparing the server, as well as deploying and integrating the portal application in a portal page.

    The following figure displays the Leave RequestWeb Part in a SharePoint portal home page.

    1

  • 8/3/2019 e25ce5a7-0901-0010-aeaf-ee8e67de9029

    8/10

    Employee Self-Service Sample Applicationfor Microsoft SharePoint, Created with SAPPDK for .NET.

    2005 SAP AG The SAP Developer Network:http://sdn.sap.com

    Running the Application

    1. Log on to your SharePoint portal and navigate to the page where the Web Part is installed. The

    initial view is displayed.

    2. Click Show Time Accounts. The following table displays the detailed time account information howmuch leave time the employee is entitled to, how much has been used, and how much remains asof the given date.

    3. Request a leave:

    a. From the Type of leavedropdown list, select an appropriate option.

    b. Click in the Leave Datefield and select a date on the dropdown calendar.

    c. Click Submit. A message in the upper part of the window indicates the result.

    1

  • 8/3/2019 e25ce5a7-0901-0010-aeaf-ee8e67de9029

    9/10

    Employee Self-Service Sample Applicationfor Microsoft SharePoint, Created with SAPPDK for .NET.

    2005 SAP AG The SAP Developer Network:http://sdn.sap.com

    4. Click Clearto clear the fields and return to the initial view.

    1

  • 8/3/2019 e25ce5a7-0901-0010-aeaf-ee8e67de9029

    10/10

    Employee Self-Service Sample Applicationfor Microsoft SharePoint, Created with SAPPDK for .NET.

    2005 SAP AG The SAP Developer Network:http://sdn.sap.com

    Author BioAnne Tarnoruder is an information developer for SAP NetWeaver Product Management inSAP Labs, Israel, where she is responsible for the developers documentation of PDK for.NET and Visual Composer. Prior to joining SAP in 2004, she held a number of positions insoftware development, team management, system architecture and technicalcommunications in various high-tech companies. Anne holds an M.S. degree in AppliedMathematics.

    Disclaimer & Liability Notice

    This document may discuss sample coding or other information that does not include SAP officialinterfaces and therefore is not supported by SAP. Changes made based on this information are notsupported and can be overwritten during an upgrade.

    SAP will not be held liable for any damages caused by using or misusing the information, code ormethods suggested in this document, and anyone using these methods does so at his/her own risk.

    SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the contentof this technical article or code sample, including any liability resulting from incompatibility between thecontent within this document and the materials and services offered by SAP. You agree that you will nothold, or seek to hold, SAP responsible or liable with respect to the content of this document.

    1