Human Capital Management Blogs by SAP
Get insider info on HCM solutions for core HR and payroll, time and attendance, talent management, employee experience management, and more in this SAP blog.
cancel
Showing results for 
Search instead for 
Did you mean: 
former_member18168
Product and Topic Expert
Product and Topic Expert
Hello SAP community,

Abstract:


The SFAPI Describe operation in SAP SuccessFactors SOAP APIs does not support the generation of the previous tag for the query mode delta/Period Delta. This is a common problem faced in the middleware/ETL tools while using CompoundEmployee API.

Solution overview:


CompoundEmployee API provides XSD generation capability through the parameter “resultOptions” parameter.


 

Solution Description:


 

01) Sample Without “renderPreviousTags” value

  • Parameter = resultOptions

  • Value = xsd


Sample CompoundEmployee API Request for generating XSD:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:sfobject.sfapi.successfactors.com">
<soapenv:Header/>
<soapenv:Body>
<urn:query>
<urn:queryString>SELECT person,employment_information,personal_information,job_information
FROM CompoundEmployee where person_id_external='sfadmin'
and last_modified_on > to_datetime('2021-05-19T12:45:00Z')</urn:queryString>
<urn:param>
<urn:name>resultOptions</urn:name>
<urn:value>xsd</urn:value>
</urn:param>
<urn:param>
<urn:name>queryMode</urn:name>
<urn:value>delta</urn:value>
</urn:param>
</urn:query>
</soapenv:Body>
</soapenv:Envelope>

 

Characteristic:



  • The <previous> tag will be generated inside every attribute tag.

  • The queryResponse will have the current and previous value in a single XML element with a structure format:


<fieldname> current value

<previous>previous_value</previous>

</fieldname>

 

Sample response:


                            <personal_information>

                            <action>CHANGE</action>

                            <attachment_id>8399</attachment_id>

                            <created_by>sfadmin</created_by>

                            <created_on_timestamp>2021-08-20T06:44:25.000Z</created_on_timestamp>

                            <end_date>9999-12-31</end_date>

                            <first_name>Mark

                                <previous>John</previous>

                            </first_name>

                            <formal_name>Mark Blue

                                <previous>John Red</previous>

                            </formal_name>

 

 

02) Sample With “renderPreviousTags” value

  • Parameter = resultOptions

  • Value = xsd,renderPreviousTags


Sample CompoundEmployee API Request for generating XSD:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:sfobject.sfapi.successfactors.com">
<soapenv:Header/>
<soapenv:Body>
<urn:query>
<urn:queryString>SELECT person,employment_information,personal_information,job_information
FROM CompoundEmployee where person_id_external='sfadmin'
and last_modified_on > to_datetime('2021-05-19T12:45:00Z')</urn:queryString>
<urn:param>
<urn:name>resultOptions</urn:name>
<urn:value>xsd,renderPreviousTags</urn:value>
</urn:param>
<urn:param>
<urn:name>queryMode</urn:name>
<urn:value>delta</urn:value>
</urn:param>
</urn:query>
</soapenv:Body>
</soapenv:Envelope>


 

Characteristic:



  • The XSD is generated with dedicated <previous> tags for each field.

  • The queryResponse will have the current and previous value in a different XML element with a structure format:


<fieldname> current value</fieldname>

< fieldname _previous>previous_value</ fieldname _previous>

 

Sample response:


                            <personal_information>

                            <action>CHANGE</action>

                            <attachment_id>8399</attachment_id>

                            <created_by>sfadmin</created_by>

                            <created_on_timestamp>2021-08-20T06:44:25.000Z</created_on_timestamp>

                            <end_date>9999-12-31</end_date>

                            <first_name>Mark</first_name>

                            <first_name_previous>John</first_name_previous>

                            <formal_name>Mark Blue</formal_name>

                            <formal_name_previous>John Red</formal_name_previous>

 

Format difference sample:



 


Conclusion:


Question:

  • You are wondering which is the correct format to generate the XSD of CompoundEmployee?


Answer:

  • If you specify to generate the XSD for delta / period delta mode in all cases previous tags will be contained within the XSD. In standard it will be the <previous> tag inside every attribute tag. You can switch this behavior to generate dedicated <…_previous> tags in case you add the renderPreviousTag parameter.

  • What’s correct is depending on the final query you will send. The data query and the XSD retrieval query need to have the same setting that both results fit together.


Also please refer to Generation of consumer interface structure file for Compound Employee API

Thank you!

Best Regards from Brazil.
4 Comments