cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping: Fields inside suppressed segment (PI 7.3)

Former Member
0 Kudos

Hi Ladies and Gentlemen,

Please help with the below.

Scenario:


A segment is mapped with a createif node condition based on the existence of another segment from the source message.

Note:


I want to avoid checking if the source segment exists for each of the fields in the target segment thus the condition on the target segment itself.

Problem:


Within the target segment is a useOneAsMany function on one of the fields based on the source segment + a field in the source segment as an example, since the target segment is conditioned by the existence of the source segment I expect the mapping logic applied in the fields of the target segment not to be executed if the target segment is suppressed from the results on the createif condition, thus the source segment not present, however, though the queue on the target segment results in a suppression, I still get a mapping error from within the suppressed target segment.

Error: "Exception:[com.sap.aii.mappingtool.tf7.FunctionException: Too many values in the first queue in function useOneAsMany. It must have the same number of contexts as the second queue]"

Any thoughts or inputs?

Thanks in advance.

Accepted Solutions (0)

Answers (1)

Answers (1)

praveen_sutra
Active Contributor
0 Kudos

Hi Mathala,

When we use the OneAsMany node function we have to send the data otherwise it throws an error.

So use map with default (give space value) function.

Input values to the OneAsMany function is Document numberafter add Map with Default function, Item node, Item node then output map to the corresponding field.

After OneAsMany use Split by Valu node function (Property is for each Value) later just before the target field use the below UDF (because target might be mandatory field).

Create UDF type as Queue

for (int i=0;i<value.length;i++)

{

if (value<i>.equals(""))

   result.addValue(ResultList.SUPPRESS);

else

   result.addValue(value<i>);

}

Here value is the input field.

thanks and regards,

Praveen T

Former Member
0 Kudos

Hi Praveen,

I agree with you regarding the oneAsMany function, but what I am saying is that the oneAsMany logic should not even be executed because the segment would not have been created due to the createif condition. So, the segment itself is suppressed but the logic on the fields still gets executed.

Former Member
0 Kudos

This is the condition I have on the segment

If this condition yields a SUPPRESS, then I expect the logic of the fields in the segment not to be executed in the first place, regardless of the kind of logic I have in the fields, be it oneAsMany or not, if the condition on the segment is not met then the fields should not be executed.

Let me know what you think.

praveen_sutra
Active Contributor
0 Kudos

Hi Mathala,

Yes very correctly said. Now this is our understanding that if segment is suppressed the logic doesnt holds true for sub nodes. But internally even though i haven't read anywhere but there is no mechanism for the programs internally to understand this. It will transform all the mapped fields. So as per my understanding the onus lies on us to handle the exception. Please correct if i am wrong somewhere.

thanks and regards,

Praveen T

ambrish_mishra
Active Contributor
0 Kudos

Hi,

Logically, it happens like a compiler program. So even though the target node condition is false, the compiler will still execute the logic for the child nodes.

It works like if and else. even if "if" is true, else part is still compiled and and if there is an exception in that branch, it does not work.

Hope I was able to explain you how it works!

Ambrish