cancel
Showing results for 
Search instead for 
Did you mean: 

The order of payload when using Odata adapter in SAP CPI

shin861231
Explorer
0 Kudos
384

Hello Experts,

I'm encountering an unusual issue with OData queries in SAP Cloud Platform Integration (CPI), and I'm hoping someone can shed some light on this problem.

The Issue

When I perform an OData GET query, the order of the data fields in the result is reversed when using SAP CPI compared to when I use Postman.

Postman Result (Correct Order):

Product, ProductType, LastChangeDate

SAP CPI Result (Reversed Order):

LastChangeDate, ProductType, Product

I've attempted to resolve this by adding the $orderby parameter to my query, but unfortunately, this did not solve the issue. ($orderby=Product,ProductType,LastChangeDate)

 

My Questions are

1. Why might this reversal of field order occur when using SAP CPI?
2. How can I ensure that the field order in SAP CPI matches what I see in Postman?

As your reference, the attached screenshots show the Integration flow as well as the connection configuration for Odata Adapter, as well as the payload with reversed order.

IFLOW and Connection Configuration.jpgPayload with reversed order.jpg

 

It would be a huge help if you could please kindly advise on this one!

Thank you.

 

Ryan-Crosby
Active Contributor
0 Kudos
The order looks correct to me in your screenshot.
Ryan-Crosby
Active Contributor
0 Kudos
If you are referring to the positioning of the XML nodes themselves, then it does not matter because XML is a hierarchical structure.

Accepted Solutions (0)

Answers (1)

Answers (1)

shin861231
Explorer
0 Kudos

Hello Ryan,

Thank you for your answer.

But the correct order is Product, ProductType, LastChangeDate.

However, what I get in payload is 

<A_ProductType>

<LastChangeDate>2024-01-10T00:00:00.000</LastChangeDate>

<ProductType>SERV</ProductType>

<Product>A001</Product>

</A_ProductType>

As you can see, the order is all reversed.

Or am I interpretating the payload wrongly?

Aamir_Suhail
Explorer
0 Kudos
In XML, the order is irrelevant. As long as the element hierarchy is correct (which seems to be the case), the order will not matter.