cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping optional fields

Former Member
0 Kudos

Hello,

I have a problem mapping optional fields/segments in my input message.

The input message is an IDoc with items that may contain long texts or not.

simplified example:

<IDOC>
 <E1EDP01>
  <POSEX>00010</POSEX> 
  <KTEXT>pos 10 short text</KTEXT>   
   <E1EDPT1>
    <E1EDPT2>
     <TDLINE>pos 10 long text</TDLINE> 
    </E1EDPT2>
   </E1EDPT1>
 </E1EDP01>

 <E1EDP01>
  <POSEX>00020</POSEX> 
  <KTEXT>pos 20 short text</KTEXT>   
 </E1EDP01>

 <E1EDP01>
  <POSEX>00030</POSEX> 
  <KTEXT>pos 30 short text</KTEXT>   
   <E1EDPT1>
    <E1EDPT2>
     <TDLINE>pos 30 long text</TDLINE> 
    </E1EDPT2>
   </E1EDPT1>
 </E1EDP01>
</IDOC>

The result should look like this:

<RFQ>
 <RFQ_ITEM_LIST>
  <RFQ_ITEM>
   <LINE_ITEM_ID>00010</LINE_ITEM_ID>
   <SHORT_TXT>pos 10 short text<SHORT_/TXT>
   <LONG_TXT>pos 10 long text<LONG_/TXT>
  </RFQ_ITEM>

  <RFQ_ITEM>
   <LINE_ITEM_ID>00020</LINE_ITEM_ID>
   <SHORT_TXT>pos 20 short text<SHORT_/TXT>
   <LONG_TXT><LONG_/TXT>
  </RFQ_ITEM>

  <RFQ_ITEM>
   <LINE_ITEM_ID>00030</LINE_ITEM_ID>
   <SHORT_TXT>pos 30 short text<SHORT_/TXT>
   <LONG_TXT>pos 30 long text<LONG_/TXT>
  </RFQ_ITEM>
 </RFQ_ITEM_LIST>
</RFQ>

When I simply map <TDLINE> to <LONG_TXT> I get two instances of <LONG_TXT> only that appear under the first two <RFQ_ITEM>.

I have tried to check the existency of <E1EDPT1> and mapped TDLINE if true, constant space (empty <LONG_TXT> or space would both be acceptable) if false.

Then I get the space for the second item's <LONG_TXT> which is fine, but "_sUpPresSeD_" for the third one.

Any help welcome, thanks in advance

Rainer

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

I'll explainyou why:

Graphical mapping is based on queues and all these queues are constructed based on context.

In your case if the context was E1EDPT2

then the queue looked like that:

pos 10 long text

CC

pos 30 long text

CC is context change

After change of context you have

pos 10 long text

CC

SUPPRESS

CC

pos 30 long text

Regards,

wojtek

Zilch
Product and Topic Expert
Product and Topic Expert
0 Kudos

Thanks for your answers,

I didn't try your approaches as a colleague told me to concat TDLINE with Context E1EDP01 and E1EDPT1 and map the result to the target field.

Sounds strange to me but it worked!

Thanks & Regards

Rainer

Former Member
0 Kudos

Hi,

Please change the context to:

<E1EDP01>

and everything should be ok.

regards,

wojtek

Former Member
0 Kudos

Hi Rainer,

when you createing A Data Types in IR Normarlly optional will be assined when you select atribute.

At the time of Mapping we will assing constant value for that Attributes.

Hope these clarify your dought.

Thanks

Hari