cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping between IDoc and MQ Message

0 Kudos

Hello XI Experts,

I have an input for mapping like this:

);

}

}

Here, a[] corresponds to STATUS and c[] corresponds to VALUE. b[0] is a constant which has the check value 03. Our arrays will be like this;

a[0] = 01, a[1] = 02, a[2] = 03, a[3] = 04

b[0] = 03

c[0] = AAA, c[1] = CCC, c[2] = DDD

Here, if the target VALUE is at last position (STATUS=04), the function will cause OutOfBoundException error. Because it will try to return c[3] which is not present. Beside this, in our example the function will return VALUE=DDD for STATUS=03 which is not correct.

Do you have any opinion?

Thanks, regards.

Ibrahim GUNDUZ

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello Ibrahim,

two advices:

1) Do NOT select the flag "Cache the whole queue". Otherwise the queues for a and c aren't in sync.

2) Add the node function "removeContexts" after your user-defined function.

Best regards

Joachim

0 Kudos

Hi Joachim,

1) It was already not selected.

2) Adding the "removeContext" before and/or after my function does not make any sense. I also tried to set the context to the top level node, but no sense.

I think it is a restriction in XI mapping. If VALUE does not exist in the PAIR, an element is not created in the array regardless of the context. We were doing this kind of maps in LOOP at Business Connector.

However, I think this restriction is very important. Because we are trying to pick some values from SAP R/3 4.6C IDoc's. We have to differentiate the content from some reference fields in a segment.

Thank you. Best regards.

Ibrahim

Former Member
0 Kudos

Hi Ibrahim,

please change your coding to the following:

public void filterSpecific(String[] a, String[] b, String[] c, ResultList result, Container container){

int k=0;

for (int i=0;i.equals(b[0])) result.addValue(c[k]);

k++;

}

}

}

In this case you treat the two queues for STATUS and VALUE separately. So you should specify "Cache the whole queue". Select the lower most context (PAIR) for the two elements. Then it works.

Best regards

Joachim

0 Kudos

Hi Joachim,

Yes, your solution is working! Many thanks for the hint.

Greetings from Turkey and best regards.

Ibrahim

Former Member
0 Kudos

Hi!

I have a similar situation, and I have tried your code. However, for some reason it does not work. I have set the "Cache entire queue" on and off without success.

Have I missed something in the code?

Here is the (same) code for the adv function, 3 arguments:

int k=0;

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

if (a.equals(ResultList.CC)){

k++; continue;

}

if (!c[k].equals(ResultList.CC)){

if (a.equals(b[0])) result.addValue(c[k]);

k++;

}

}

I have also tried to use this on a more complex structure, however the "cache entire queue" might prevent a solution.

I have tried to fetch data from E1EDPT1 and related E1EDPT2, where E1EDPT1-TDID = "0001". However, since this segments occurs in several lines (i.e. beneath E1EDP01, but maybe not all of them), the queue for each element might contain several occurrences of the related text (E1EDPT2-TDLINE) for the desired value "0001".

So the question is; how to keep the context for each P01-line, and still be able to use the function filterSpecific?

Best regards,

Oeystein Emhjellen