Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
antony_ferminus
Participant
5,118
SAP CPI Message mapping Flat Structure to Tree structure which has been briefly explained by ekasiri in on the blog. It is a great blog. Thanks Eaksiri.

I was trying expand the payload bit complex and came up with some additional mapping steps.

So I decided to share those information below.

Request payload.
<CompoundEmployee>
<Person>
<Manager_ID>1000</Manager_ID>
<Manager_Name>Manager A</Manager_Name>
<Employee_ID>8000</Employee_ID>
<Employee_Name>Emp A</Employee_Name>
</Person>
<Person>
<Manager_ID>1000</Manager_ID>
<Manager_Name>Manager A</Manager_Name>
<Employee_ID>8005</Employee_ID>
<Employee_Name>Emp B</Employee_Name>
</Person>
<Person>
<Manager_ID>2000</Manager_ID>
<Manager_Name>Manager B</Manager_Name>
<Employee_ID>9000</Employee_ID>
<Employee_Name>Emp C</Employee_Name>
</Person>
<Person>
<Manager_ID>2000</Manager_ID>
<Manager_Name>Manager B</Manager_Name>
<Employee_ID>9002</Employee_ID>
<Employee_Name>Emp D</Employee_Name>
</Person>
<Person>
<Manager_ID>1000</Manager_ID>
<Manager_Name>Manager A</Manager_Name>
<Employee_ID>9003</Employee_ID>
<Employee_Name>Emp E</Employee_Name>
</Person>
<Person>
<Manager_ID>3000</Manager_ID>
<Manager_Name>Manager C</Manager_Name>
<Employee_ID>9004</Employee_ID>
<Employee_Name>Emp F</Employee_Name>
</Person>
<Person>
<Manager_ID>2000</Manager_ID>
<Manager_Name>Manager B</Manager_Name>
<Employee_ID>9005</Employee_ID>
<Employee_Name>Emp G</Employee_Name>
</Person>
</CompoundEmployee>

Response Payload
<CompoundEmployee>
<Person>
<Manager_ID>1000</Manager_ID>
<Manager_Name>Manager A</Manager_Name>
<Employee>
<Employee_ID>8000</Employee_ID>
<Employee_Name>Emp A</Employee_Name>
</Employee>
<Employee>
<Employee_ID>8005</Employee_ID>
<Employee_Name>Emp B</Employee_Name>
</Employee>
<Employee>
<Employee_ID>9003</Employee_ID>
<Employee_Name>Emp E</Employee_Name>
</Employee>
</Person>
<Person>
<Manager_ID>2000</Manager_ID>
<Manager_Name>Manager B</Manager_Name>
<Employee>
<Employee_ID>9000</Employee_ID>
<Employee_Name>Emp C</Employee_Name>
</Employee>
<Employee>
<Employee_ID>9002</Employee_ID>
<Employee_Name>Emp D</Employee_Name>
</Employee>
<Employee>
<Employee_ID>9005</Employee_ID>
<Employee_Name>Emp G</Employee_Name>
</Employee>
</Person>
<Person>
<Manager_ID>3000</Manager_ID>
<Manager_Name>Manager C</Manager_Name>
<Employee>
<Employee_ID>9004</Employee_ID>
<Employee_Name>Emp F</Employee_Name>
</Employee>
</Person>
</CompoundEmployee>

Simulation


To obtain this result we have to adapt our mapping with 'sort', 'sortByKey' functions in between.

The Employee_ID, Employee_Name need additional mapping steps too.

 

CompoundEmployee



Person
Manager_ID > removeContext 
> Sort(case sensitive,asc)
> SplitByValue (value change)
> collapseContext
> Person







 

Manager_ID
Manager_ID > Removecontext 
> sort(case sencitive, asc)
> SplitByValue (value change)
> collapseContext
> splitByValue
> Manager_ID



 

Manager_Name



Manager_Name > removeContext 
> sort (case sensitive, asc)
> splitByValue (Value change)
> collapseContext
> splitByValue (Each value )
> formatByExample(input)
> Manager_Name

Manager_ID > removeContext
> sort (case sensitive, asc)
> splitByValue (Value change)
> collapseContext
> splitByValue (Each value )
> formatByExample(pattern)
> Manager_Name


 

Employee
Employee_ID > formatByExample (input)
> Employee

Manager_ID > removeContext
> sort (case sensitive, asc)
> splitByValue (Value change)
> formatByExample (pattern)
> Employee


 

Employee_ID
Manager_ID > removeContext 
> sortByKey(key)
> splitByValue(Each value)
> Employee_ID

Emoloyee_ID > removecontext
> sortByKey(value)
> Employee_ID


 

Employee_Name


             Same mapping as above with Employee_Name


 

Happy reading.
5 Comments
Labels in this area