Skip to Content
0

SAP PI Map Repeat source field as many times as Context on other field

Nov 28, 2016 at 12:13 PM

159

avatar image

Hi there experts,

I facing some mapping and I cannot see the logic. Scenario is IDOC to Flat File, and I'm generating at target file as many lines as POSNR (positions) at the IDOC.

Thing is now they want to have more lines at some positions that have inside more values (some box code).

I need to have at the target file:

POS 001 BOX1

POS 001 BOX2

POS 001 BOX3

POS 002 BOX4

POS 003 BOX5

Thing is, to repeat the pos as many times as there are boxes at same context. Is there any UDF easy solution to this?

Cheers, and thanks a lot in advance

Edu

img1.png (26.1 kB)
img2.png (23.8 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Evgeniy Kolmakov Nov 29, 2016 at 01:25 AM
0

Hi Eduardo!

UDF:

public void multiplyQueues(String[] q1, String[] q2, ResultList result1, ResultList result2, Container container) throws StreamTransformationException{

for (int i=0; i<q1.length; i++)
for (int j=0; j<q2.length; j++)
if (!(q1[i].equals(ResultList.SUPPRESS) || q2[j].equals(ResultList.SUPPRESS))) {
result1.addValue(q1[i]);
result2.addValue(q2[j]);
}
else {
result1.addValue(ResultList.SUPPRESS);
result2.addValue(ResultList.SUPPRESS);
}

Execution type: All values of a Context.

Regards, Evgeniy.


Share
10 |10000 characters needed characters left characters exceeded