cancel
Showing results for 
Search instead for 
Did you mean: 

SAP PI | message mapping problem

Dimitri
Active Contributor
0 Kudos

All,

I face a mapping problem using useOneAsMany, but I think that is my only option to accomplish this…

This is my source message

Segment ORU_R01.ORDER_OBSERVATION can occur multiple times.

Within that segment, segment ORU_R01.OBSERVATION can occur multiple times.

Segment ORU_R01.OBSERVATION contains a field with a specific value.

In case that value is e.g not AA, a target segment needs to be created, that is OK.

Now, I need to map other values too, contained in the OBR segment within ORU_R01.ORDER_OBSERVATION, were value is not AA.

I tried with this mapping…

… but I receive this error: Too many values in the first queue in function useOneAsMany. It must have the same number of contexts as the second queue] in class com.sap.aii.mappingtool.flib7.NodeFunctions method useOneAsMany[[Ljava.lang.String;@28250819,

I already played around with context changes, but still facing this error.

Can somebody help me out please?

Thanks a lot.

Dimitri

Accepted Solutions (1)

Accepted Solutions (1)

iaki_vila
Active Contributor
0 Kudos

Hi Dimitri,

The problem seems to be that your second paramerter (second queue) in the useOneAsMany has less context changes that the first parameter (first queue):  useOneAsMany - Managing Services in the Enterprise Services Repository - SAP Library

Could you share the input queues of useOneAsMany?

Regards.

Dimitri
Active Contributor
0 Kudos

Hi,

These are the queues, going from top to bottom in the useOneAsMany function:

Kind regards,

Dimitri

Dimitri
Active Contributor
0 Kudos

Hi,

I tested some more and these are my queue now

Still the same error.

I see 2 context changes and that is correct. Values 87 and 88 should be used in the output.

Also, my second and third statement look ok, no? But all together it still seems wrong. But I've no idea where that could be.

Kind regards,

Dimitri

iaki_vila
Active Contributor
0 Kudos

Hi Dimitri,

Your first queue has 1 context change and the second none.  Your second has to have one context change, the number of items in each context determine the iterations in the first queue values. Your third queue has more values than the second one, this queue will determinate the context changes in your output.

Regards.

iaki_vila
Active Contributor
0 Kudos

Hi Dimitri,

It seems the second queue has two context changes. Try to avoid the first one.

Regards.

former_member182412
Active Contributor
0 Kudos

Hi Dimitri,

Your current mapping the third queue before send it to useOneAsMany use splitByValue and try it will work.

But i would suggest you pass the suppress to target node and the fields you can directly map like below.

TragetNode mapping:

Target Field Mapping:

Regards,

Praveen.

Dimitri
Active Contributor
0 Kudos

This is what I have now

former_member182412
Active Contributor
0 Kudos

Hi Dimitri,

To useOneAsMany first and second queues number of context changes should be same (fiirst queue should be single values in the context, second queue multiple values in the each context), second and third queues the number of values should be same without taking considerations of number of contexts (third queue each context should be only one value)

I hope it clarifies your question.

Regards,

Praveen.

Dimitri
Active Contributor
0 Kudos

Hi Praveen,

I tried that, this is the result

Error: too few values in the first queue

[EDIT]

What is wrong with the above?

Also, I need all, except for value ED. But I guess I can do that afterwards.

former_member182412
Active Contributor
0 Kudos

Hi Dimitri,

The first queue is wrong because you only have 2 values where as second queue got three contexts.

Use below context for CE 4 field and try.

Regards,

Praveen.

Dimitri
Active Contributor
0 Kudos

Hi Praveen

The concept is clear to me and this is what I have now

But still the error too few values in the first queue.

Can you please clarify?

former_member182412
Active Contributor
0 Kudos

Hi Dimitri,

The second queue got three contexts so you must have first one also 3 contexts but in your case only two values, you must pass three values in the first queue, have you changed the context of CE4 field that is first queue in your case like below then it will pass three values in the first queue.

Regards,

Praveen.

Former Member
0 Kudos

Hi Dimitri,

Try this ,maintain mapwithDefault for the first field.

Thanks,

Dhileep.

Dimitri
Active Contributor
0 Kudos

Hi Praveen,

This is what I have now. I only have, in this example,  values 87 and 88 in the first queue. Just 2, not 3.

Kind regards,

Dimitri

former_member182412
Active Contributor
0 Kudos

Hi Dimitri,

After the useOneAsMany function put splitByValue function then it will work.

Regards,

Praveen.

Dimitri
Active Contributor
0 Kudos

Hi Praveen,

I did what you suggested, but still failing.

Is there a mapping alternative? I guess, like this, the problem will not be solved.

former_member182412
Active Contributor
0 Kudos

Hi Dimitri,

Can you attach source xml and required target xml then it will be easy to fix the problem.

Regards,

Praveen.

Dimitri
Active Contributor
0 Kudos

Hi Praveen,

Please find the source file attached...

Check segment ORU_R01.OBSERVATION -> OBX.2

In case that is NOT EQUAL to ED, use it in the target.

To fill the target segment further, I need ORU_R01.ORDER_OBSERVATION -> OBR -> OBR.4 -> CE.4. The value of that field must go to the QuestionnaireId in the target structure.

former_member184720
Active Contributor
0 Kudos

I don't see any value for the first occurance of

/ns0:ORU_R01/ns0:ORU_R01.PATIENT_RESULT/ns0:ORU_R01.ORDER_OBSERVATION/ns0:OBR/ns0:OBR.4/ns0:CE.4

Raise the context for the CE.4 field and set it to OBR then useoneasmany queue will work as you'll have equal number of inputs.

CE4(OBR context) -> map with default ->use one as many -> collapse context -> split by value -> target

Not sure of target structure.. If that doesn't work, can you please share the target structure as well?

Dimitri
Active Contributor
0 Kudos

Hi Hareesh,

This is my mapping now

and this is the queue for the target field.

In the first segment, value 87 is filled in. In the second, 88 is filled.

all other segments, the target field is not present.

That is not the expected behavior.

former_member184720
Active Contributor
0 Kudos

Can you please share the expected target queue? Not sure of target structure.

in case you need all the occurrences then did you try adding split by value after use one as many?

former_member182412
Active Contributor
0 Kudos

Hi Dimitri,

It depends on target structure also, i dont how is your target structure, i created the target structure like below i have done the mapping.

My Target Structure which i created my side:

Target Node ORU01_TARGET mapping:

Target Node OBR mapping:

Field1 mapping:

Result:

You need to adjust according to your target structure, the mapping will work according my target structure, you just need to adjust contexts according to your structure but the concept is same. If it did not work for your structure give me the target structure then i can help you.

Regards,

Praveen.

Dimitri
Active Contributor
0 Kudos

This is the target structure

former_member184720
Active Contributor
0 Kudos

Did you try adding split by value after useoneasmany ?

Dimitri
Active Contributor
0 Kudos

Hi Hareesh,

I tested again and this should be it

Thanks a lot!

Answers (0)