Technical Articles
Get Employee ID and Business Partner Internal ID using ByDesign OData Services
In SAP Business ByDesign each ByD Employee is a ByD Business Partner as well. You can observe that in work center Business Partner Data, view Business Partners, which lists all kind of business partners incl. accounts, suppliers, contacts, … and employees.
Hence each ByD employee always has an Employee ID as well as a Business Partner Internal ID. In ByD HCM screens and web services it is more common to use the Employee ID, whereas in other areas like for example ByD CRM most web services use the identifier type code Business Partner Internal ID (often named PartyID).
This leads to the question: How can I map between Employee ID and Business Partner Internal ID?
Using ByD OData Services you easily map between Employee ID and Business Partner Internal ID of ByD Employees.
For that purpose I created a simple Custom OData Service using the new work center view OData Services in work center Application and User Management for business object Employee. Optionally you can import the business object query QueryByIdentification as function well.
OData Service entity types:
OData Service function import (business object query QueryByIdentification):
After activation of the Custom OData Service you can easily query employees using the Employee ID or the Business Partner Internal ID as filter criteria and the system returns both: the EmployeeID and the InternalID.
Some OData URL examples:
Get available collections:
https://myXXXXXX.sapbydesign.com/sap/byd/odata/cust/v1/khemployee/
Get metadata:
https://myXXXXXX.sapbydesign.com/sap/byd/odata/cust/v1/khemployee/$metadata
Get employee data:
https://myXXXXXX.sapbydesign.com/sap/byd/odata/cust/v1/khemployee/EmployeeCollection
Get employee data with filter by business partner internal ID:
https://myXXXXXX.sapbydesign.com/sap/byd/odata/cust/v1/khemployee/EmployeeCollection?$filter=InternalID eq ‘8000001260’
Get employee data with filter and wildcard:
https://myXXXXXX.sapbydesign.com/sap/byd/odata/cust/v1/khemployee/EmployeeCollection?$filter=InternalID eq ‘800000*’
Get employee data using business object query QueryByIdentification as function and filter by business partner internal ID:
https://myXXXXXX.sapbydesign.com/sap/byd/odata/cust/v1/khemployee/EmployeeQueryByIdentification1?InternalID=’8000001260′
OData service response example:
<?xml version="1.0" encoding="utf-8" ?>
<feed xml:base="https://myXXXXXX.sapbydesign.com/sap/byd/odata/cust/v1/khemployee/" xmlns="http://www.w3.org/2005/Atom" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">
<id>https://myXXXXXX.sapbydesign.com/sap/byd/odata/cust/v1/khemployee/EmployeeCollection</id>
<title type="text">EmployeeCollection</title>
<updated>2016-11-24T13:51:06Z</updated>
<author>
<name />
</author>
<link href="EmployeeCollection" rel="self" title="EmployeeCollection" />
<entry>
<id>https://myXXXXXX.sapbydesign.com/sap/byd/odata/cust/v1/khemployee/EmployeeCollection('0000000000011ED18AF66C5834CC02EE')</id>
<title type="text">EmployeeCollection('0000000000011ED18AF66C5834CC02EE')</title>
<updated>2016-11-24T13:51:06Z</updated>
<category term="cust.Employee" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<link href="EmployeeCollection('0000000000011ED18AF66C5834CC02EE')" rel="edit" title="Employee" />
<content type="application/xml">
<m:properties>
<d:ObjectID>0000000000011ED18AF66C5834CC02EE</d:ObjectID>
<d:InternalID>8000001260</d:InternalID>
<d:BusinessPartnerID>000000000000000000000000000000000000000000000000000007000034</d:BusinessPartnerID>
<d:EmployeeID>7000034</d:EmployeeID>
<d:PartyIdentifierTypeCode>HCM001</d:PartyIdentifierTypeCode>
<d:BusinessPartnerFormattedName>Kate Jacob</d:BusinessPartnerFormattedName>
<d:PartyIdentifierTypeCodeText>Employee ID</d:PartyIdentifierTypeCodeText>
</m:properties>
</content>
</entry>
</feed>
You find more information about ByD OData Services in our SAP Community for ByDesign, ByDesign Wiki, SAP PartnerEdge and of course in the SAP Help Center of your ByD system:
- SAP Business ByDesign 1611 Delta Sessions >> Overview of 1611 delta for OData modeller
- SAP Business ByDesign November 2016 Release Information >> OData Modeler User Guide
Nice blog. Thanks, knut.
Regards
Sankaran A
Hi Knut,
I need your help on this topic.
https://answers.sap.com/questions/67081/create-physical-inventory-adjustment-via-absl.html
Regards
Sankaran A
Hello Knut,
I repeat myself but, as usual this is a great blog.
I would personally add a note regarding the filter function.
Depending on the type you are working with, some require to add the data type into the URL.
Currently, the two I came up with are datetime and guid.
Therefore, in order to query the EmployeeUUID, instead of
$filter=EmployeeResponsibleUUID eq 'the UUID you want',
we need,
$filter=EmployeeResponsibleUUID eq guid'the UUID you want'
Same with the date time fields like LastChangeDateTime where we need to mention it is a datetime before mentioning the value.
I know you quickly mentioned that in your blog for the Analytics Odata svc, but this is could be useful here also.
Thank you for your precious documents Knut.
Best regards.
Jacques-Antoine