<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: Mapping logic - send one value from multiple segments to single field in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/mapping-logic-send-one-value-from-multiple-segments-to-single-field/qaa-p/11909256#M4472989</link>
    <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;Try if this might help:&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1685463-segfiltering-mm01.png" /&gt;&lt;/P&gt;&lt;P&gt;field1...field4 are moved to "row" context.&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1685464-segfiltering-res01.png" /&gt;&lt;/P&gt;&lt;P&gt;Regards, Evgeniy.&lt;/P&gt;</description>
    <pubDate>Tue, 14 May 2019 07:44:56 GMT</pubDate>
    <dc:creator>former_member190293</dc:creator>
    <dc:date>2019-05-14T07:44:56Z</dc:date>
    <item>
      <title>Mapping logic - send one value from multiple segments to single field</title>
      <link>https://community.sap.com/t5/technology-q-a/mapping-logic-send-one-value-from-multiple-segments-to-single-field/qaq-p/11909250</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
  &lt;P&gt;I am trying to find out an error regarding some logic in my map. Please find below next source and target structures:&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1680735-source-and-target.jpg" /&gt;&lt;/P&gt;
  &lt;P&gt;The logic required is next one: each field is a map to map, excepts on the ones named "field".&lt;/P&gt;
  &lt;P&gt;Segment is 0..1 so it is possible that no fields should come here, and if exists then the segment1 may come 1 or more times. If there are segments (at least 1 to unbounded) then I need to search for value "AA" in field2 (on the source request). If the value exists then I need to send all those context values to the target (field1 to field1, field2 to field2, etc). If the value "AA" doesn't exist in field2 or if there is no segment then I need to send a 0 to all field target.&lt;/P&gt;
  &lt;P&gt;I am able to search for the AA value in field2 using an UDF:&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1680737-udf.jpg" /&gt;&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1680738-mapping-logic.jpg" /&gt;&lt;/P&gt;
  &lt;P&gt;field1 &amp;amp; field2 are the input parameters to the searchAA UDF and their context are at row level.&lt;/P&gt;
  &lt;P&gt;This is working for any test cases I've done:&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1680739-test1.jpg" /&gt;&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1680740-test2.jpg" /&gt;&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1680741-test3.jpg" /&gt;&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1680742-test4.jpg" /&gt;&lt;/P&gt;
  &lt;P&gt;But this is not working as expected when more than 1 row exist:&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1680746-error1.jpg" /&gt;&lt;/P&gt;
  &lt;P&gt;I might be missing something, or probable I need to avoid UDF and use only standard node functions but I can't understand the queue context error.&lt;/P&gt;
  &lt;P&gt;Is anyone able to let me know must I do this mapping logic so all test cases are good?&lt;/P&gt;
  &lt;P&gt;Thanks!!!!!!&lt;/P&gt;</description>
      <pubDate>Tue, 07 May 2019 13:55:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/mapping-logic-send-one-value-from-multiple-segments-to-single-field/qaq-p/11909250</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-05-07T13:55:46Z</dc:date>
    </item>
    <item>
      <title>Re: Mapping logic - send one value from multiple segments to single field</title>
      <link>https://community.sap.com/t5/technology-q-a/mapping-logic-send-one-value-from-multiple-segments-to-single-field/qaa-p/11909251#M4472984</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;1. First of all you don't need UDF to solve this requirement&lt;/P&gt;&lt;P&gt;you first need to maps segments to row (both 1 to unbounded)&lt;/P&gt;&lt;P&gt;field 1 -&amp;gt; if segment (exists) AND field2.equalsS("AA") map field1 to field1 else map 0 to field1&lt;/P&gt;&lt;P&gt;You can avoid segment(exists) logic as field2 will exist only if segment exists so the below logic is sufficient,the sam will work for all fields&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1681639-capture.jpg" /&gt;&lt;/P&gt;&lt;P&gt;2. The problem in your approach is you are doing result.addValue() but not doing ResultList.CC to handle contexts, so all values from udf will be coming in same context. else apply splitByValue(eachvalue) after udf&lt;/P&gt;</description>
      <pubDate>Tue, 07 May 2019 16:56:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/mapping-logic-send-one-value-from-multiple-segments-to-single-field/qaa-p/11909251#M4472984</guid>
      <dc:creator>vicky20691</dc:creator>
      <dc:date>2019-05-07T16:56:35Z</dc:date>
    </item>
    <item>
      <title>Re: Mapping logic - send one value from multiple segments to single field</title>
      <link>https://community.sap.com/t5/technology-q-a/mapping-logic-send-one-value-from-multiple-segments-to-single-field/qaa-p/11909252#M4472985</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;On top of what Vikas replied, here is approach 3 -&lt;/P&gt;&lt;P&gt;1. You can do mapping with segment1 to row putting a logic in Graphical mapping if field2 = AA.&lt;/P&gt;&lt;P&gt;     Afterwards, in the sub-parameters it will be one to one mapping for field1, field2 etc..&lt;/P&gt;&lt;P&gt;2. Duplicate row in the target end and put logic to create row as per occurrence of segment1 when field2 is not equals to AA.&lt;/P&gt;&lt;P&gt;    In the sub parameter, field1, field2 etc. will be mapped with constant 0 here.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Apu &lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2019 02:39:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/mapping-logic-send-one-value-from-multiple-segments-to-single-field/qaa-p/11909252#M4472985</guid>
      <dc:creator>apu_das2</dc:creator>
      <dc:date>2019-05-08T02:39:55Z</dc:date>
    </item>
    <item>
      <title>Re: Mapping logic - send one value from multiple segments to single field</title>
      <link>https://community.sap.com/t5/technology-q-a/mapping-logic-send-one-value-from-multiple-segments-to-single-field/qaa-p/11909253#M4472986</link>
      <description>&lt;P&gt;Hi Vikas,&lt;/P&gt;&lt;P&gt;Thanks for your response.&lt;/P&gt;&lt;P&gt;Option 1 will not work because segments1 will not always come as segment is 0..1, and also there may be repetitive segment1 but only 1 row on the source:&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1680917-option-1.jpg" /&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1680918-option1-test.jpg" /&gt;&lt;/P&gt;&lt;P&gt;So logic here tries to create more than one row when only one must be created.&lt;/P&gt;&lt;P&gt;Regarding option 2, thanks for the advice on the UDF.&lt;/P&gt;</description>
      <pubDate>Mon, 13 May 2019 13:37:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/mapping-logic-send-one-value-from-multiple-segments-to-single-field/qaa-p/11909253#M4472986</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-05-13T13:37:50Z</dc:date>
    </item>
    <item>
      <title>Re: Mapping logic - send one value from multiple segments to single field</title>
      <link>https://community.sap.com/t5/technology-q-a/mapping-logic-send-one-value-from-multiple-segments-to-single-field/qaa-p/11909254#M4472987</link>
      <description>&lt;P&gt;Hi Apu,&lt;/P&gt;&lt;P&gt;Thank you for your input!&lt;/P&gt;&lt;P&gt;On option 1 I'm having same issue as I told to Vikas: if I send segment1 to row then more rows in target side will be created than the expected one (it is 1 source row per 1 target row).&lt;/P&gt;&lt;P&gt;Option 2 was good idea but I assume it should be having the same issue as the others acording to the tests I've done.&lt;/P&gt;&lt;P&gt;Remember that logic is:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;for each source row, one target row must be created&lt;/LI&gt;&lt;LI&gt;rowfield1 is a map to map and must come always&lt;/LI&gt;&lt;LI&gt;field1, field2, field3 and field4 must have a 0 when there are no "AA" values in field2 and if "AA" value exists then only those values in the same context should be sent&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Any comments or help will be really appreciated.&lt;/P&gt;&lt;P&gt;Regards!&lt;/P&gt;</description>
      <pubDate>Mon, 13 May 2019 13:58:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/mapping-logic-send-one-value-from-multiple-segments-to-single-field/qaa-p/11909254#M4472987</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-05-13T13:58:41Z</dc:date>
    </item>
    <item>
      <title>Re: Mapping logic - send one value from multiple segments to single field</title>
      <link>https://community.sap.com/t5/technology-q-a/mapping-logic-send-one-value-from-multiple-segments-to-single-field/qaa-p/11909255#M4472988</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;This because of context handling.&lt;/P&gt;&lt;P&gt;1. Map source row to target row one to one&lt;/P&gt;&lt;P&gt;2. Map rowfield1,2,3 to Target rowfield1,2,3 one to one&lt;/P&gt;&lt;P&gt;3. Now apply the field1 logic as per my previous answer but always right click on field1 and go to context and select context from segment 1 to row.&lt;/P&gt;&lt;P&gt;You need to do.this context change for field 1, field2, 3 and 4 while mapping them&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vikas&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2019 01:39:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/mapping-logic-send-one-value-from-multiple-segments-to-single-field/qaa-p/11909255#M4472988</guid>
      <dc:creator>vicky20691</dc:creator>
      <dc:date>2019-05-14T01:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: Mapping logic - send one value from multiple segments to single field</title>
      <link>https://community.sap.com/t5/technology-q-a/mapping-logic-send-one-value-from-multiple-segments-to-single-field/qaa-p/11909256#M4472989</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;Try if this might help:&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1685463-segfiltering-mm01.png" /&gt;&lt;/P&gt;&lt;P&gt;field1...field4 are moved to "row" context.&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1685464-segfiltering-res01.png" /&gt;&lt;/P&gt;&lt;P&gt;Regards, Evgeniy.&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2019 07:44:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/mapping-logic-send-one-value-from-multiple-segments-to-single-field/qaa-p/11909256#M4472989</guid>
      <dc:creator>former_member190293</dc:creator>
      <dc:date>2019-05-14T07:44:56Z</dc:date>
    </item>
    <item>
      <title>Re: Mapping logic - send one value from multiple segments to single field</title>
      <link>https://community.sap.com/t5/technology-q-a/mapping-logic-send-one-value-from-multiple-segments-to-single-field/qaa-p/11909257#M4472990</link>
      <description>&lt;P&gt;Hi Vikas,&lt;/P&gt;&lt;P&gt;Thanks again for your response.&lt;/P&gt;&lt;P&gt;I did what you said and it wasn't working but the "map with default" option at the end of the IF was the thing remaining.&lt;/P&gt;&lt;P&gt;Thank you very much for everything!&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2019 18:40:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/mapping-logic-send-one-value-from-multiple-segments-to-single-field/qaa-p/11909257#M4472990</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-05-17T18:40:29Z</dc:date>
    </item>
    <item>
      <title>Re: Mapping logic - send one value from multiple segments to single field</title>
      <link>https://community.sap.com/t5/technology-q-a/mapping-logic-send-one-value-from-multiple-segments-to-single-field/qaa-p/11909258#M4472991</link>
      <description>&lt;P&gt;Hi Evgeniy,&lt;/P&gt;&lt;P&gt;Thank you!!!!! I was missing the map with default at the end of the if sentence.&lt;/P&gt;&lt;P&gt;This solved my issue!&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2019 18:41:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/mapping-logic-send-one-value-from-multiple-segments-to-single-field/qaa-p/11909258#M4472991</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-05-17T18:41:18Z</dc:date>
    </item>
    <item>
      <title>Re: Mapping logic - send one value from multiple segments to single field</title>
      <link>https://community.sap.com/t5/technology-q-a/mapping-logic-send-one-value-from-multiple-segments-to-single-field/qaa-p/11909259#M4472992</link>
      <description>&lt;P&gt;Happy to be of some help&lt;/P&gt;</description>
      <pubDate>Sat, 18 May 2019 06:35:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/mapping-logic-send-one-value-from-multiple-segments-to-single-field/qaa-p/11909259#M4472992</guid>
      <dc:creator>vicky20691</dc:creator>
      <dc:date>2019-05-18T06:35:33Z</dc:date>
    </item>
  </channel>
</rss>

