SAP Knowledge Base Article - Public

3320543 - 1H 2023: New Selection for Fields and Segments - Compound Employee

Symptom

With the 1H 2023 release, it will now be possible to select the fields that will be returned in Compound Employee API response through the SELECT statement of the query string.

Image/data in this KBA is from SAP internal systems, sample data, or demo systems. Any resemblance to real data is purely coincidental.

Environment

  • SAP SuccessFactors HXM Suite
    • Compound Employee API

Resolution

The syntax will work as the following:​

Example 1 (selecting one specific field):

SELECT person(person_id_external) FROM CompoundEmployee WHERE person_id_external = 'John'

The response will return only field "person_id_external":
<person>
    <person_id>5327</person_id>
    <person_id_external>John</person_id_external>
</person>

Note: the key fields of the entities are always returned in the response, this is why we see "person_id" returning as well.

Example 2 (selecting more than one field):

SELECT person(person_id_external, date_of_birth) FROM CompoundEmployee WHERE person_id_external = 'John'

Response:
<person>
    <date_of_birth>1990-06-01</date_of_birth>
    <person_id>5327</person_id>
    <person_id_external>John</person_id_external>
</person>

Example 3 (selecting all the fields from a navigated entity only):

SELECT person/address_information FROM CompoundEmployee WHERE person_id_external = 'John'

​The response returns all fields from "address_information" only ("person_id" from "person" is still returned since it's a key field):

Response:
​<person>
    <person_id>5327</person_id>
    <address_information>
        <address_type>home</address_type>
        <country>DEU</country>
        <created_by>superuser</created_by>
        <created_on_timestamp>2020-06-03T08:09:15.000Z</created_on_timestamp>
        <end_date>9999-12-31</end_date>
        <is_global_model_address>false</is_global_model_address>
        <last_modified_by>superuser</last_modified_by>
        <last_modified_on>2020-06-03T08:09:15.000Z</last_modified_on>
        <start_date>2020-06-01</start_date>
    </address_information>
</person>

Example 4 (extending the navigation even further and selecting a specific field):

SELECT person/employment_information/job_information(company) FROM CompoundEmployee WHERE person_id_external = 'John'

Response:
<person>
    <person_id>5327</person_id>
    <employment_information>
        <user_id>John</user_id>
        <job_information>
            <company>1010</company>
            <end_date>9999-12-31</end_date>
            <seq_number>1</seq_number>
            <start_date>2023-04-03</start_date>
        </job_information>
        <job_information>
            <company>1010</company>
            <end_date>2023-04-02</end_date>
            <seq_number>1</seq_number>
            <start_date>2022-09-22</start_date>
        </job_information>
    </employment_information>
</person>

Note: the fields "start_date" and "end_date" are always returned for effective-dated entities.

Example 5 (excluding specific fields):

SELECT person/employment_information((c), assignment_class(e), assignmentIdExternal(e)) FROM CompoundEmployee WHERE person_id_external = 'John'

(c) means complete information
(e) means exclude that field

The select statement is asking the API to exclude "assignment_class" and "assignmentIdExternal" fields.

The "(c)" value is mandatory, otherwise the query fails.

The response:
<person>
    <person_id>5327</person_id>
    <employment_information>
        <assignment_uuid>E4FBA9788C424681B28F038F4D38BA6B</assignment_uuid>
        <created_by>superuser</created_by>
        <created_on_timestamp>2020-06-03T08:09:15.000Z</created_on_timestamp>
        <direct_reports>0</direct_reports>
        <eligibleForStock>false</eligibleForStock>
        <employeeFirstEmployment>false</employeeFirstEmployment>
        <employment_id>5823</employment_id>
        <hiringNotCompleted>false</hiringNotCompleted>
        <isContingentWorker>false</isContingentWorker>
        <jobNumber>1</jobNumber>
        <last_modified_by>superuser</last_modified_by>
        <last_modified_on>2020-06-03T08:09:15.000Z</last_modified_on>
        <originalStartDate>2020-06-01</originalStartDate>
        <seniorityDate>2020-06-01</seniorityDate>
        <serviceDate>2020-06-01</serviceDate>
        <start_date>2020-06-01</start_date>
        <user_id>John</user_id>
    </employment_information>
</person>


FAQ:

1) Will this be supported on all entities?
Yes, all HRIS and MDF entities covered by Compound Employee.

2) Can you select the fields from the entities in the middle of a navigation? For example: SELECT person/employment_information(assignmentIdExternal)/job_information.
No, this is not supported and will result in an error. You are able to use multiple selections in order to overcome that, for example:

SELECT person/employment_information(assignmentIdExternal), person/employment_information/job_information

3) Will the usage of this new selection of fields impact in the performance of Compound Employee API?
No, this was tested internally and the performance was not affected.

4) Is there any limitation in the amount of characters that the query string or SELECT statement support?
There is a limit but it's quite large, however please note that SAP does not recommend to use a large SELECT statement.

5) Will there be any impact in existing queries?
No, the existing queries will continue to work.

Keywords

1H 2023, 2305, b2305, release, production, preview, H1, ECT-195954, select, compoundemployee, ce, sfapi , KBA , LOD-SF-INT-CE , Compound Employee API , Product Enhancement

Product

SAP SuccessFactors HCM suite all versions