Skip to Content

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

Mapping problem.

Hi.

Have a mapping problem.

The source looks like:

<zmessage>
  <zidocmessage>
    <zidoc>
      <zidocheader>
         <hfield1>hf1</hfield1>
         <hfield2>hf2</hfield2>
         <zidocitem>
           <ifield1>if1</ifield1>
           <ifield2>if2</ifield2>
         </zidocitem>
         <zidocitem>
           <ifield1>if1</ifield1>
           <ifield2>if2</ifield2>
         </zidocitem>
      </zidocheader>
    </idoc>
  <zidocmessage>
    <zidoc>
      <zidocheader>
         <hfield1>hf1</hfield1>
         <hfield2>hf2</hfield2>
         <zidocitem>
           <ifield1>if1</ifield1>
           <ifield2>if2</ifield2>
         </zidocitem>
         <zidocitem>
           <ifield1>if1</ifield1>
           <ifield2>if2</ifield2>
         </zidocitem>
      </zidocheader>
    </idoc>
</zmessage>

And the target should be like:

<zmessage>
  <zfilemessage>
    <zfilefirstrec>
      <firstrecfield1>ff1</firstrecfield1>
      <firstrecfield2>ff2</firstrecfield2>
    </zfilefirstrec>
    <zfileheader>
      <hfield1>hf1</hfield1>
      <hfield2>hf2</hfield2>
    </zfileheader>
    <zfileitem>
       <ifield1>if1</ifield1>
       <ifield2>if2</ifield2>
    </zfileitem>
    <zfileitem>
       <ifield1>if1</ifield1>
       <ifield2>if2</ifield2>
    </zfileitem>
    <zfileheader>
      <hfield1>hf1</hfield1>
      <hfield2>hf2</hfield2>
    </zfileheader>
    <zfileitem>
      <ifield1>if1</ifield1>
      <ifield2>if2</ifield2>
    </zfileitem>
    <zfileitem>
       <ifield1>if1</ifield1>
       <ifield2>if2</ifield2>
    </zfileitem>
  <zfilemessage>
</zmessage>

firstrecfield1 and firstrecfield2 are mapped with constants.

zidocheader -> zfileheader

zidocitem -> zfileitem

When I do the mapping I get 2 entries of zfilefirstrec if I have 2 zidocmessages in the source.

Are there any way for me to make it so I only get 1 zfilefirstrec in the target?

I can't change the structure of the source or the target message.

BR

Kalle

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