Skip to Content
avatar image
Former Member

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

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

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

    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.

    Add comment
    10|10000 characters needed characters exceeded