on 11-09-2012 1:22 PM
Hello,
following strange graphical mapping behaviour. Goal is to create a certain target segment only for those E1EDP05 source segments where field KSCHL exists.
And I need to align the KSCHL contexts with the E1EDP05 contexts (P05 occurence in P01).
Implementation: createIf (formatByExample ( exists(KSCHL), E1EDP05)
All works fine except when we have an input document which contains no P05 segment at all. In this case, the function exists(KSCHL) surprisingly returns a queue with one element (false), and not an empty queue. But the P05 parameter returns an empty queue, the result of formatByExample then is an error because the queues have not same length.
The funny thing is when the input document contains one P01 segment without P05 elements, and other P01 segments with P05 elements, it does NOT return that strange "false" value for the segment which does not contain P05 elements, but an empty queue (which is as expected).
I consider this a bug. In PI 7.0, the behaviour is ok, there we always have an empty queue.
We are on PI 7.11 Service Pack 07.
What can I do ? I tried several workarounds (e.g. mapWithDefault), but nothing worked.
CSY
Hi Christian,
its not the bug. Exist functionality is correct.
what is Exists function?
Exists function returns "true" if node exist, otherwise "false"
Till SP20 ( PI 7.0), If input is Suppress to Exists function then output is also Suppress
actually this is a bug but we are used to it and developed all the XI interfaces accordngly.
SAP has corrected the functionaly of Exists in later releases .. i can confirm this is available in SP26.
what is the new functionlaity?
If input is Suppress to Exists function then output is false. This is the correct behaviour, but unfortunately it will affect the already developed interfaces on old Exists functionality. the only solution to this is we have to rewrite the mapping.
Regarding your scenario, KSCHL-exists return false because there no P05 segments and the result coming to exists is Suppress
Regrading your second question, exists did not retun false beause there is a P05 segment in the of the P01
Cheers,
Hidayat
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mark,
check the below note
Note 1319395 - Exists function's current behaviour in Message Mapping
Cheers,
Hidayat
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In many cases, where the parent is not created and the child uses a formatbyexample, the standard formatbyexample creates a runtime exception since the inputs may have different queue lengths(usually when the second queue is all suppress and we have used a mapwithdefault for the first queue )
Type :- Queue function
Inputs :-
a[] :- Input to be formatted after mapped with default and removing contexts
b[] :- The queue based on which the first queue has to be formatted
c[] :- The b[] queue itself except change its context to super-parent to make sure that there is atleast one value in the second queue.
Code:-
-------------------
public void CustomFormatByExample(String[] a,String[] b,String[] c,ResultList result,Container container){
AbstractTrace trace =container.getTrace();
if(c.length<=1)
{
result.addValue(a[0]);
}else
{
for(int i=0,j=0;i<b.length;i++)
{
try {
if (b[i].equalsIgnoreCase("__cC_"))
{
result.addValue(ResultList.CC);
}
else
{
result.addValue(a[j]);
j++;
}
} catch (Exception e)
{
}
}
}
}
Try using the above udf in place of standard function format by example and Let me know if this helps
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Strange..i think you should provide more info on this as requested already...
Also notify in idea's place for fixing this..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
Can you provide a screenshot? Maybe we could help you more.
Regards,
Mark
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here are some screenshots to explain the problem in more detail:
the left queue shows the KSCHL field. We see that no value is present in the source data. But after the exists function is called, we have one "false" value in the queue (the middle queue), this I consider as bug. In the right queue we see that no E1EDP05 segment occurs in the source data (KSCHL is a field in this segment).
The consequence is that the formatByExample call fails with
Exception:[com.sap.aii.mappingtool.tf7.FunctionException: Function formatByExample: Queues do not have the same number of values]
because input queue 1 has 1 value, but input queue 2 has 0 values.
What can I do as a workaround ?
CSY
Hello,
It looks like a bug, but I can't replicate it in my system PI 7.11 SP08. Also there was a similar discussion here in sdn and I can't find the thread. Hmmmm... As a workaround, you can try using this mapping though:
Check if it is existing first before you use the formatByExample logic.
Hope this helps,
Mark
Hi Christian,
Java mapping can handle such problem easily. To proceed with java mapping you need to post source XML and required sample target XML. Java mapping should be your last option, thus please wait for experts advice on the solution to this problem.
Regards
Anupam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.