on 2023 May 20 9:38 AM
Hi All,
My requirement is to map a synchronous call from SAP--CPI--API( Third-party) (Json call) and Map the response back to SAP system.
I am facing challenge in mapping the requirement as the Json response is having dynamic values at item level under saleorderList ( example as TEST1, TEST2 and so on.. and they are going to change based on the input selection criteria from SAP
My JSON response :
{
"responseCode": 0,
"responseMessage": "Success",
"totalOrders": 2,
"salesorderList": {
"TEST1": {
"orderLocation": "M1",
"orderLocationName": "ABC",
"channelName": "",
"items": [
{
"lineno": "156",
"sku": "234ABC",
"status": "InTransit",
}
]
},
"TEST2": {
"orderLocation": "M2",
"orderLocationName": "ABC
"channelName":,
"items": [
{
"lineno": "1",
"sku": "456ABC",
"status": "Shipped",
"0"
}
]
},
"TEST3": {
......... and so on...
How to define a xsd structure for this in CPI as items coming under saleOrderList are changing dynamically.( TEST1, TEST2 and TEST3) and map this response with an imported SAP's wsdl/xsd file into a response message mapping .
Since xsd are defined static in both CPI and SAP WSDL/XSD, While taking response back into CPI mapping , they fail at this dynamic filed levels, as they are not recognized.
Hope many of you have come across such requirements. Any expert suggestions, would help.
Regards,
Suman.
Request clarification before answering.
Hello @suman.kumar13,
Did you get the solution? Kindly share as we have similar requirement where dynamic json expected at source end which needs to be mapped to target SF ODATA API.
Thanks,
Seema
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can try the below options.
1) Define the API response structure with all the fields (one global structure) that you are expecting under SalesOrcersList as optional fields. Since they are optional only fields with data will be mapped to the SAP response structure. Also, the SAP response structure should be having all the fields as optional.
2) Have a Groovy Script before the response map (unlike Message Mapping, Groovy can take any structure) parse, and convert the payload to a structure defined in SAP with all additional/dynamic fields written/appended to some filler.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
54 | |
10 | |
8 | |
6 | |
5 | |
5 | |
5 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.