cancel
Showing results for 
Search instead for 
Did you mean: 

update Xpath in Message mapping using Custom functions.

amit023
Explorer
0 Kudos

Hi all,

is it possible to update the Xpath of Element in message mapping using custom functions instead of using context in SAP BTP.

Accepted Solutions (0)

Answers (3)

Answers (3)

Sriprasadsbhat
Active Contributor
0 Kudos

Hello ,

Below might help you and there are functions which will help you to handle contexts within script. But changing XPATH might not be possible using custom functions but you can pass different values as inputs and consider one based on some condition.

https://blogs.sap.com/2021/04/25/udfnodepool-functions-for-sap-cpi-with-groovy-scripting/

Regards,

Sriprasad Shivaram Bhat

amit023
Explorer
0 Kudos

That's a biggest problem working with context.

vishalakshmi
Contributor
0 Kudos
amit023
Explorer
0 Kudos

none helped.

Ivan-Mirisola
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi amit023,

How about entering your logic on a Groovy Script component and that would set some iflow context variables that would be used by the xpath for data extraction. Your script would be able to dynamically set what the xpath should gather from the payload.

Have you tried it?

If that doesn't work, I would simply add xpath extraction rules for all attributes in the payload, So I would be able to mapp whatever I wanted.

BTW, did you know you can convert your payload into OpenAPI syntax, upload it to Cloud Integration and use it to viasually map the inbound/outbound attributes?

https://blogs.sap.com/2020/09/16/sap-cloud-integration-swagger-openapi-spec-json-in-message-mapping/

Best regards,
Ivan

amit023
Explorer
0 Kudos

Hi Ivan,

question is more about pathetically designed message mapping component which has nothing inbuilt and for everything you have to write functions.

Ivan-Mirisola
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi amit023,

Could you please elaborate a little more on the comment? I didn't quite understand what you really want to achieve. Perhaps if you give a more concrete example it would help.

Best regards,
Ivan