ProcessHRDataSAP Method
The human resources (HR) module for ERP Connector maintains resource and organization data in Microsoft Office Project Server 2003. The mySAP™ ERP Human Capital Management solution exports XML data to the drop folder, then the Service for Enterprise Data Maintenance (EDM) sends the data in the drop folder to the PDS extension ProcessHRDataSAP, which processes the data using standard PDS methods.
Figure 1. General architecture of the HR module of ERP Connector
This topic includes the following sections:
- Syntax shows the complete XML syntax for a ProcessHRDataSAP request.
- Parameters describes all of the request's XML tags.
- Implementation Classes shows a class diagram and describes the major features of the ProcessHRDataSAP source code, and summarizes calls to the standard PDS methods.
Syntax
<Request>
<ProcessHRDataSAP>
<HumanResources>
<Resources>
<PERNO></PERNO>
<LAST_NAME></LAST_NAME>
<FIRSTNAME></FIRSTNAME>
<EMAIL></EMAIL>
<OVERTIMERATE></OVERTIMERATE>
<AMOUNT_MONTH></AMOUNT_MONTH>
<AMOUNT_HOUR></AMOUNT_HOUR>
<WAERS></WAERS>
<BIRTHDATE></BIRTHDATE>
<INFOTYPE></INFOTYPE>
<OBJECT_ID></OBJECT_ID>
<TO_DATE></TO_DATE>
<FROM_DATE></FROM_DATE>
<SEQNO></SEQNO>
<CH_ON></CH_ON>
<CHANGED_BY></CHANGED_BY>
</Resources>
-- Additional resources --
</HumanResources>
<OrganisationStructure>
<OrganisationUnit>
<ORGUNIT></ORGUNIT>
<ORG_SHORT></ORG_SHORT>
<ORG_LONG></ORG_LONG>
<OTYPE></OTYPE>
<PARENT></PARENT>
<LEVEL></LEVEL>
</OrganisationUnit>
-- Additional organisation units --
<OrganisationStructure>
<ResourceMapping>
<Mapping>
<PERNO></PERNO>
<ORG_UNIT></ORG_UNIT>
<LEAD_POS></LEAD_POS>
</Mapping>
-- Additional resource mappings --
</ResourceMapping>
</ProcessHRDataSAP>
</Request>
Parameters
The following table describes the parameters for each of the three sections of the ProcessHRDataSAP method: HumanResources, OrganisationStructure, and ResourceMapping. If the tag occurrence includes 0, then it is an optional parameter.
Table 1. Parameters for the three sections of ProcessHRDataSAP
Tag | Description | Type / Format | Occurrence |
---|---|---|---|
HumanResources | |||
HumanResources | Parent element for human resources. | 1 | |
Resources | Element for one human resource. | 0 - n | |
PERNO | Unique ID of the resource from mySAP ERP. | Text | 1 |
LAST_NAME | Last name of the resource. | Text | 1 |
FIRSTNAME | First name of the resource. | Text | 1 |
E-mail of the resource; if not defined, a formula can be defined for building the e-mail address. | Text | 0 - 1 | |
OVERTIMERATE | Cost of the resource when working overtime. The value should be a number with a decimal point, for example 80.00. ProcessHRDataSAP converts the decimal point to the currency decimal separator for the current locale, determined by the following statement in Datatypes.cs:string decSep = CultureInfo.CurrentCulture.NumberFormat.CurrencyDecimalSeparator; |
Text | 0 - 1 |
AMOUNT_MONTH | Cost of the resource per month. The value should be a number with a decimal point, for example 9600.00. | Text | 0 - 1 |
AMOUNT_HOUR | Cost of the resource per hour. The value should be a number with a decimal point, for example 60.00. | Text | 0 - 1 |
WAERS | Currency of the cost rates; USD (U.S. dollar), EUR (euro), yen, and so on. | Text | 0 - 1 |
BIRTHDATE | Resource's date of birth. | Date: YYYYMMDD | 0 - 1 |
INFOTYPE | Type of information. | Text | 0 - 1 |
OBJECT_ID | Object ID. | Text | 0 - 1 |
TO_DATE | Date through which the resource is valid. | Date: YYYYMMDD | 0 - 1 |
FROM_DATE | Date when the resource becomes valid. | Date: YYYYMMDD | 0 - 1 |
SEQNO | mySAP ERP HCR sequence number. | Text | 0 - 1 |
CH_ON | Date when the resource data was updated. | Date: YYYYMMDD | 0 - 1 |
CHANGED_BY | Name of the person who changed the resource data. | Text | 0 - 1 |
OrganisationStructure | |||
OrganisationStructure | Parent element for the organization structure. | 1 | |
OrganisationUnit | Element for one organization unit. | Text | 0 - n |
ORGUNIT | Unique ID of the organization unit from mySAP ERP. | Text | 1 |
ORG_SHORT | Short name of the organization unit. | Text | 0 - 1 |
ORG_LONG | Long name of the organization unit. | Text | 1 |
OTYPE | Type of the organization unit. | Text | 0 - 1 |
PARENT | ID of the parent organization unit. | Text | 0 - 1 |
LEVEL | Level of the organization unit. | Text | 0 - 1 |
ResourceMapping | |||
ResourceMapping | Parent element for the resource mappings. | 1 | |
Mapping | Element for one resource mapping. | Text | 0 - n |
PERNO | Unique ID of the resource from mySAP ERP. | Text | 1 |
ORG_UNIT | Unique ID of the organization unit from mySAP ERP. | Text | 1 |
LEAD_POS | Flag that indicates whether the resource is the organization unit manager. If not empty, the flag is set to true. Note This differs from standard PDS flag values of 0 (default) and 1 (true). |
Text | 1 |
Implementation Classes
The PDS extension ProcessHRDataSAP uses the Extender base class described in Creating a Managed Code PDS Extension for Project Server 2003. Figure 2 shows a class diagram of the ProcessHRDataSAP implementation for the HR module of the ERP Connector. The download includes the full-size diagram in the image file HRModuleClassDiagram.gif and in the Microsoft Office Visio file HRModuleClassDiagram.vsd.
Figure 2. Class diagram of the PDS extension ProcessHRDataSAP
SAP_HR_PDSExtension is a subclass of the Extender class, and provides the public XMLRequestEx method required for PDS extensions.
The SAP_HR_Processor class contains the logic that handles the HR data. SAP_HR_Processor uses HRDataRequestParser to parse the incoming data and to retrieve the equivalent data types. The complex data types HumanResource, OrganizationUnit, and ResourceMapping are defined in the file Datatypes.cs. For a list of files in the HRModule project, see Project Files.
When all the data from mySAP ERP is parsed, SAP_HR_Processor retrieves the unique IDs from Project Server for the different data objects and calls the appropriate PDS methods to update the data. SAP_HR_Processor uses PDSInterface to access PDS methods. PDSInterface parses the PDS response with the appropriate parser class and returns the equivalent data type.
ProcessHRDataSAP uses settings in the configuration file, and also logs transactions and errors. For information about administrative settings for the HR module, see Using the Administration Page. For information about logging and the configuration architecture, see Architecture.
Field Mapping for the HR Module
The following table shows the relationship between mySAP ERP input data and the Project Server data fields.
Table 2. Relationship of mySAP ERP HCM input data to Project Server data fields
Input data | Project Server data | Comment |
---|---|---|
HumanResource | ||
Employee ID | Enterprise text field | The employee ID from mySAP ERP is not the resource ID in Project Server. |
First name | Resource.Name | |
Last name | Resource.Name | |
E-mail address | Resource.Email | |
Standard rate | Resource.StandardRate | Based on cost center or activity type. |
Overtime rate | Resource.OvertimeRate | Based on cost center or activity type. |
OrganizationUnit | ||
Employee ID | For identification purposes only. | |
Organization unit ID | Enterprise outline code number | |
Manager flag | Enterprise text field | |
ResourceMapping | ||
Organization unit ID | Enterprise outline code value | |
Organization unit text | Enterprise text field | |
SAP_HR_Processor Functions
The SAP_HR_Processor class performs different actions on Project Server, depending on the data type.
Data type | Supported actions |
---|---|
HumanResource (Basic employee data) | Create, update, and deactivate resources. |
OrganizationUnit (Organization structure) | Create and update organization structure. |
ResourceMapping (Organization mapping) | Assign resources to organization units. |
Creating Resources
If a resource is not part of the Project Server enterprise resource pool, SAP_HR_Processor calls the following PDS methods to create a new resource:
- ResourcesAdd adds the new resource.
- ResourceCodeValuesUpdate updates the resource custom fields.
Updating Existing Resources
If the resource already exists in the enterprise resource pool, and the resource is not checked out, SAP_HR_Processor calls the following PDS methods:
- ResourcesCheckout checks out the resource.
- ResourcesUpdate edits the resource.
- ResourceCodeValuesUpdate updates the resource custom fields.
- ResourcesCheckin checks in the updated resource.
Deactivating Resources
Depending on the configuration, SAP_HR_Processor deactivates every resource in the enterprise resource pool that is not part of the mySAP ERP input data. Therefore, the SAP_HR_Processor first gets a list of all resources in the pool. Following are the PDS methods used:
- ResourcesStatus gets a list of all resources.
- ResourcesCheckout checks out the resource.
- ResourceDeactivate deletes (deactivates) the resource.
- ResourcesCheckin checks in the resource.
Creating Organization Structure
If SAP_HR_Processor receives data of type OrganizationUnit, it calls the following PDS methods to create the corresponding enterprise outline code values:
- ProjectsCheckout checks out the Enterprise Global template.
- EnterpriseOutlineCodeUpdate creates values for the enterprise outline code field.
- ProjectsCheckin checks in the Enterprise Global template.
Updating Organization Structure
If SAP_HR_Processor receives data of type OrganizationUnit, it calls the following PDS methods to update the corresponding enterprise outline code values:
- ProjectsCheckout checks out the Enterprise Global template.
- EnterpriseOutlineCodeUpdate updates values for the enterprise outline code field.
- ProjectsCheckin checks in the Enterprise Global template.
Assigning Resources to Organization Units
If the resource is not already checked out, SAP_HR_Processor calls the following PDS methods to assign the resource to an organization unit.
- ResourcesCheckout checks out the resource.
- ResourceCodeValuesUpdate updates the enterprise outline code number.
- ResourcesCheckin checks in the updated resource.
PDSInterface Functions
SAP_HR_Processor uses PDSInterface to make all calls to PDS standard methods. PDSInterface generates the XML requests and parses the PDS replies. Communication with the PDS occurs through the COM interface because ERP Connector is on the same computer as the PDS. Following is a list of the standard PDS calls that PDSInterfaces makes.
- ProjectsCheckout
- ProjectsCheckin
- ResourcesCheckout
- ResourcesCheckin
- ResourcesStatus
- ResourcesAdd
- ResourceDeactivate
- ResourcesUpdate
- EnterpriseOutlineCodes
- EnterpriseOutlineCodeUpdate
- ResourceCodeValues
- ResourceCodeValuesUpdate