Human Capital Management Blogs by SAP
Get insider info on SAP SuccessFactors HCM suite 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
StevenLiu刘家骥
Product and Topic Expert
Product and Topic Expert
Cool, thanks!
CassioFernandes
Explorer
0 Kudos

Hi Guilherme, great post!

I did find though one entrusting point, and if you can clarify it, it would be great! I generated xsd file, updating XSD generated by default when we setup an external call to SuccessFactors (CompoundEmployeeEntityquerySync0.xsd). Through "Resources", I edited it and pasted XSD generated manually. I expected that I would get this xml format in CPI, just as I see in SoapUI.

Immediate payload from SFSF

 

XSD

 

To my surprise, it seems that CPI transforms XML to a "default" format automatically. I was expecting xml format as per XSD, so I could use it in the message mapping (nodes queryResponse/result/sfobject). Instead I get xml with nodes queryCompoundEmployeeResponse/CompoundEmployee.

 

xml at next iFlow step

 

Can you please clarify if this is a normal behavior in CPI? Is there any alternative? Use SOAP adapter type instead of the SOAP SuccessFactors?

Thanks in advance, and I look forward to your comment.

Cassio.

former_member18168
Product and Topic Expert
Product and Topic Expert
Dear Cassio,

I tried to check your question internally but seems the behavior is due CPI side only (not related to SF).

Can you kindly raise one customer incident for the component LOD-HCI-PI-GB asking the same question? My colleagues in that are will check the issue from the CPI perspective.

Thank you!

Soliman
CassioFernandes
Explorer
0 Kudos
Hey Guilherme,

I really appreciate your quick response, as well informing the proper component! I'll shoot them an incident. I was going a little nuts trying to figure it out...  🙂

Have a great afternoon!

Cassio