cancel
Showing results for 
Search instead for 
Did you mean: 

Enrich/Combine the message using join and gather in CPI

former_member60331
Participant
0 Kudos

Hi Experts,

I have requirement where I am calling two different systems fetching the data.

Flow -

Response XML from Step-1

<EmployeeTime>
	<EmployeeTime>
		<ABC>xyz</ABC>
		<userId>100050</userId>
		<ABC1>xyz1</ABC1>
	</EmployeeTime>
	<EmployeeTime>
		<ABC>xyz</ABC>
		<userId>100060</userId>
		<ABC1>xyz1</ABC1>
	</EmployeeTime>
	<EmployeeTime>
		<ABC>xyz</ABC>
		<userId>100070</userId>
		<ABC1>xyz1</ABC1>
	</EmployeeTime>
</EmployeeTime>

Response XML from Step-2

<n0:ZHTR_LEAVE_SAL_ADVANCEResponse xmlns:n0="urn:sap-com:document:sap:rfc:functions" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
	<E_LEAVEDATA>
		<item>
			<PERNR>100050</PERNR>
			<AMOUNT>0.0</AMOUNT>
			<DAYS/>
			<DATE>0000-00-00</DATE>
		</item>
		<item>
			<PERNR>100060</PERNR>
			<AMOUNT>0.0</AMOUNT>
			<DAYS/>
			<DATE>0000-00-00</DATE>
		</item>
		<item>
			<PERNR>100070</PERNR>
			<AMOUNT>0.0</AMOUNT>
			<DAYS/>
			<DATE>0000-00-00</DATE>
		</item>
	</E_LEAVEDATA>
</n0:ZHTR_LEAVE_SAL_ADVANCEResponse>

I am using gather to combine these two message, however, I am not getting the desired results.

My requirement is to get the output as

<EmployeeTime>
	<EmployeeTime>
		<ABC>xyz</ABC>
		<userId>
			<PERNR>100050</PERNR>
			<AMOUNT>0.0</AMOUNT>
			<DAYS/>
			<DATE>2020-02-29</DATE>
		</userId>
		<ABC1>xyz1</ABC1>
	</EmployeeTime>
	<EmployeeTime>
		<ABC>xyz</ABC>
		<userId>
			<PERNR>100060</PERNR>
			<AMOUNT>0.0</AMOUNT>
			<DAYS/>
			<DATE>2020-02-29</DATE>
		</userId>
		<ABC1>xyz1</ABC1>
	</EmployeeTime>
	<EmployeeTime>
		<ABC>xyz</ABC>
		<userId>
			<PERNR>100070</PERNR>
			<AMOUNT>0.0</AMOUNT>
			<DAYS/>
			<DATE>2020-02-29</DATE>
		</userId>
		<ABC1>xyz1</ABC1>
	</EmployeeTime>
</EmployeeTime>

can anyone please guide how to put the condition in gather to achieve this.

Regards,

Akash

Accepted Solutions (0)

Answers (4)

Answers (4)

0 Kudos

Akash,

how did you solved this issue? Please share. Thanks.

0 Kudos

Hi akashenoc,

It's not clear why can't you use Enricher.

Enrich doesn't require same XML's. Till the time you have a valid XML you could use Enricher.

thanks and regards,

Praveen T

0 Kudos

Hi Akash,

"The Gather step merges messages from different routes (into a single message) with the option to define certain strategies how to combine the initial messages. The Join step is used in combination with the Gather step. It brings together the messages from different routes, but it does not affect the content of the messages"

But your requirement is not merging, your requirement is to enrich based on UserID. Hence as per my understanding Enricher should be used.

For more details please refer below link:

https://help.sap.com/viewer/368c481cd6954bdfa5d0435479fd4eaf/Cloud/en-US/94ef1f283e624ebdae747dbad67...

Hope this helps !

thanks and regards,

Praveen T

former_member60331
Participant
0 Kudos

Hi tirumareddy.praveen,

Thank you for the reply.

The enrich will not work in my case as I am changing the original message in the xslt mapping step. That is the reason I was trying to get it work with gather step.

Regards,

Akash

0 Kudos

Hi akashenoc,

You wont be able to get the desired result in one step. you could use Enricher step to achieve this.

Please find below the link with more details.

https://help.sap.com/viewer/368c481cd6954bdfa5d0435479fd4eaf/Cloud/en-US/8827f9feb94e4264aaf42ac1c6c...

Post that you might need an xslt or message-mapping or groovy script to get the resultant structure.

Hope this helps !

Thanks and regards,

Praveen T

former_member60331
Participant
0 Kudos

Hi tirumareddy.praveen,

Thank you for the reply.

Why can't we use gather and combine the two message?

Regards,

Akash