on 03-06-2018 6:05 PM
Hi Experts,
I am working on an integration (in HCI) that has to do a global query to get all employees for a country in SSFF. Then after transforming the data, it should produce one file per company (you can have many companies in the same country). The company is an attribute in the xml.
<?xml version="1.0" encoding="UTF-8"?>
<queryCompoundEmployeeResponse>
<CompoundEmployee>
<person>
<action>NO CHANGE</action>
<id>employee1</id>
<employment_information>
<action>NO CHANGE</action>
<job_information>
<action>CHANGE</action>
<company>X</company>
</job_information>
</employment_information>
</person>
</CompoundEmployee>
<CompoundEmployee>
<person>
<action>NO CHANGE</action>
<id>employee2</id>
<employment_information>
<action>NO CHANGE</action>
<job_information>
<action>CHANGE</action>
<company>X</company>
</job_information>
</employment_information>
</person>
</CompoundEmployee>
<CompoundEmployee>
<person>
<action>NO CHANGE</action>
<id>employee3</id>
<employment_information>
<action>NO CHANGE</action>
<job_information>
<action>CHANGE</action>
<company>Y</company>
</job_information>
</employment_information>
</person>
</CompoundEmployee>
</queryCompoundEmployeeResponse>
Expected result shoud be, message1:
<?xml version="1.0" encoding="UTF-8"?>
<queryCompoundEmployeeResponse>
<CompoundEmployee>
<person>
<action>NO CHANGE</action>
<id>employee1</id>
<employment_information>
<action>NO CHANGE</action>
<job_information>
<action>CHANGE</action>
<company>X</company>
</job_information>
</employment_information>
</person>
</CompoundEmployee>
<CompoundEmployee>
<person>
<action>NO CHANGE</action>
<id>employee2</id>
<employment_information>
<action>NO CHANGE</action>
<job_information>
<action>CHANGE</action>
<company>X</company>
</job_information>
</employment_information>
</person>
</CompoundEmployee>
</queryCompoundEmployeeResponse>
Message 2
<?xml version="1.0" encoding="UTF-8"?>
<queryCompoundEmployeeResponse>
<CompoundEmployee>
<person>
<action>NO CHANGE</action>
<id>employee3</id>
<employment_information>
<action>NO CHANGE</action>
<job_information>
<action>CHANGE</action>
<company>Y</company>
</job_information>
</employment_information>
</person>
</CompoundEmployee>
</queryCompoundEmployeeResponse>
Using filters is fairly simple to group the messages, but I think I would need to add one filter per company, and I am looking for a dynamic solution. I am struggling to find a way to do it with a splitter or iterator.
Anybody has any idea to tackle this problem?
Thanks in advance,
Antonio
Hi Antonio,
You can use XSLT to tackle this situation. Using the following script, you can group all the CompoundEmployees with the same company code. Using the funciton <xsl:for-each-group>, it will group every 'CompoundEmployee' (select attribute) based on the company value (group-by attribute). The grouped CompoundEmployees will be encapsulated by an xml node called '<group name="[company code]">'
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="/*">
<queryCompoundEmployeeResponse>
<xsl:for-each-group select="CompoundEmployee" group-by="person/employment_information/job_information/company">
<group name="{current-grouping-key()}">
<xsl:copy-of select="current-group()"/>
</group>
</xsl:for-each-group>
</queryCompoundEmployeeResponse>
</xsl:template>
</xsl:stylesheet>
The output of this XSLT script will be the following XML:
Kind Regards,
Christophe Deblock
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Antonio
With splitter you can create different data flows. First you should group employees with same company and them split. Flow after the splitter will be shared by different messages. For naming convention file you can create a property for company id and use in sftp channel.
Alternative is to use filter. I suggest this approach due to you will schedule companies in different timings. Create an external parameter for company and replícate interface as many companies you can have. Include in the iflow id the company id.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can do that with a Splitter, check the documentation and examples below as they are very similar to your case:
Best Regards,
Carlos
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
<CompoundEmployee>
<id></id>
<person>
<action>NO CHANGE</action>
<personal_information>
<action>CHANGE</action>
</personal_information>
<employment_information>
<action>NO CHANGE</action>
<job_information>
<action>NO CHANGE</action>
</job_information>
<job_information>
<action>CHANGE</action>
</job_information>
<compensation_information>
<action>NO CHANGE</action>
</compensation_information>
<PaymentInformationV3>
<action>NO CHANGE</action>
</PaymentInformationV3>
</employment_information>
<national_id_card>
<action>NO CHANGE</action>
</national_id_card>
</person>
</CompoundEmployee>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi All,
But when we use the General Splitter, the nodes which are in next element to the configured element are not resulting in the output. Example below.
If we configure the Xpath to split on job_information, the compensation_information and PaymentInformationV3 is not coming out from the output of GeneralSplitter.
I read in SAP blog that this is the functionality of General Splitter, which is not useful anymore as we need to map the target with compensation_information and PaymentInformationV3 nodes as well.
Kindly suggest what can be done? Shall we ask SAP to introduce a splitter that can acheive the functionality that we are expecting?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.