cancel
Showing results for 
Search instead for 
Did you mean: 

Message Mapping in CPI how create without node as per Magento 2 Json structure Require.

07-18-2023 2:57 PM
haroonmind Discoverer
821 views 2 comments
0 Likes
SAP Managed Tags
Subscribe

I need to add all products without the node name row but all it fails when I remove elements from the array into sources items how to make it possible to create the exact same structure into xsd Message Mapping

<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified"

xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="sourceItems">
<xs:complexType> <xs:sequence> <xs:element name="row"> <xs:complexType> <xs:sequence> <xs:element name="quantity" type="xs:unsignedByte" /> <xs:element name="sku" type="xs:string" /> <xs:element name="source_code" type="xs:string" /> <xs:element name="status" type="xs:string" /> <xs:complexType> <xs:sequence> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>

[

 {
  "sourceItems": [
    {
      "sku": "WSH12-29-Red",
      "source_code": "default",
      "quantity": 111,
      "status": 1
    },
     {
      "sku": "MH01-XS-Black",
      "source_code": "default",
      "quantity": 222,
      "status": 1
    }
   ]
  }
]
0 Likes

Accepted Solutions (0)

Answers (1)

Answers (1)

PriyankaChak
SAP Champion
SAP Champion

Hi Haroon,

The XML structure can have only one root node. It does not supports multiple nodes at root level. You can use XML to JSON converter after message mapping and select option to 'Suppress Root element'.

Regards,

Priyanka

haroonmind
Discoverer
0 Likes

I am facing another issue in each SKU object there no parent node require

Require Like that

{ "sku": "WSH12-29-Red",

"source_code": "default",

"quantity": 111,

"status": 1

}


Wrong Result :

"row": { "sku": "WSH12-29-Red",

"source_code": "default",

"quantity": 111,

"status": 1

},

"row":{ "sku": "WSH12-29-Red",

"source_code": "default",

"quantity": 111,

"status": 1

}