Skip to Content
0

REST Receiver Adapter (ARRAY) - 2 elements with same name

Sep 20, 2017 at 10:54 PM

61

avatar image
Former Member

Hey

I have the next integration:
SAP ECC-->PO-->REST Receiver

I am facing a problem, where I have 2 elements with same name in my structure.

My structure:

<xsd:element name="fonte" minOccurs="0" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="nome" type="xsd:string" minOccurs="0" />
<xsd:element name="registro" minOccurs="0" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="tabela" minOccurs="0">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="nome" type="xsd:string" minOccurs="0" />
<xsd:element name="ocorrencia" minOccurs="0" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="atributo" minOccurs="0" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="nome" type="xsd:string" minOccurs="0" />
<xsd:element name="valor" type="xsd:string" minOccurs="0" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="tabela" minOccurs="0" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="nome" type="xsd:string" minOccurs="0" />

As you can see above, I have twice the element tabela, in the first time this element is not array 0..1 , but in the second time is a array 0..unbounded.

How can I specify just the element tabela 0..unbounded as array in my REST Receiver Adapter?

Regards.,

Cleyber Santos

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

avatar image
Former Member Sep 25, 2017 at 06:16 AM
0

I doubt that below blog will not be helpful in your case as once your provide "tabela" as array type, the enhanced settings are going to consider as array no matter if it having one element or other(nome,ocorrencia..etc)

https://blogs.sap.com/2016/01/13/rest-adapter-in-sap-pipo-enhanced-xmljson-conversion/

you may use java mapping to convert the xml to json as it is based on the sub elements condition.

But simple solution would be ask the target to have different name if it is possible from target side to make the structure change.

Share
10 |10000 characters needed characters left characters exceeded