Skip to Content
Jun 07 at 01:38 PM

SAP PI issues in UDF for differnt queue length


Hello Experts,

We are facing issues in SAP PI mapping to generate correct output.

The input is following

IDoc has several E1EDP01 segments, each E1EDP01 segments has multiple E1EDP05 Segments

Within E1EDP05 segments, we have 3 fields




ALCKZ and BETRG fields are available in all E1EDP05 segmants, but KSCHL (Price condition) is available in some segments.

Requirement is, to populate target field, under target segment InvoiceLine, InvoiceLine segment is created based on E1EDP01.

Condition: When ALCKZ is '+' and KSCHL ="V140" then pass the value of BETRG to target field, SurchargeValue.

We are using below mapping

Target Structure




For all input fields, we are using context of E1EDP01. This is working if KSCHL is present under all E1EDP05 segments, but if there is only one KSCHL with V140 value in second E1EDP01 segments, it is passing BETRG value to first InvoiceLine Segment of target instead of second one.

Could you please tell me, how I can fix this, I tried in several way, in graphical mapping and udf, but not able to make it work.

UDF used:

int val = var1.length;

String [] a=new String[val];

for(int d=0;d<val;d++) {

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

if(var1[i].equals("V140")) {

a[d]= var2[i];



} break;


Thank you.


kgutp.png (20.4 kB)
0amnq.png (41.4 kB)
crljd.png (2.5 kB)