cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member190293
Active Contributor
0 Kudos

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.