Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Problem in mapping with optional tag

Hi all,

I have to map the following messages:

Source:

<POITEM> (occurrence 0...unbounded)

<TipoRecord></TipoRecord>

<PO_ITEM></PO_ITEM>

<DELETE_IND></DELETE_IND>

</POITEM>

<POITEM>

<TipoRecord></TipoRecord>

<PO_ITEM></PO_ITEM>

<DELETE_IND></DELETE_IND>

</POITEM>

Target:

<POITEM_B> (occurrence 0 1)

<item> (occurrence 0...unbounded)

<TipoRecord></TipoRecord>

<PO_ITEM></PO_ITEM>

<DELETE_IND></DELETE_IND>

</item>

<item>

<TipoRecord></TipoRecord>

<PO_ITEM></PO_ITEM>

<DELETE_IND></DELETE_IND>

</item>

</POITEM_B>

To do this mapping I have mapped "POITEM" of the source message with "item" of the target one and in that way the cardinality is ok.

Since POITEM_B is optional, even if there are in the source message <POITEM> elements, the tag <POITEM_B> is not created (nor its children).

So I mapped <POITEM> to <POITEM_B>:

the result is ok only for the first <POITEM> element; the second <POITEM> element generates the tag <POITEM_B> without any tag <item> below!

I have tried in several ways (like changing context, and others), but the only way I have found to get all the correct <item> tags below <POITEM>, is to map <POITEM_B> with a Constant!!!

Someone can suggest me a better solution?

ThankS!

Luciana

Former Member
Not what you were looking for? View more on this topic or Ask a question