cancel
Showing results for 
Search instead for 
Did you mean: 

Looping an IDOC in UDF

sbuttler77
Active Participant
0 Kudos

Hi folks,

please can anyone tell me how to loop IDoc segments in an UDF, e.g.

I have an INVOIC02 IDoc with multiple E1EDK03 segments is there any

way to loop through these in Java (while/for etc)?

Thanks.

Sven

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

yes it's possible.

> for (int index = 0; index < input.length; index++) { input\[index\]...}

Regards

Patrick

sbuttler77
Active Participant
0 Kudos

Hi Patrick,

thanks for the quick response, to clarify my main problem is I don't know how to reference

the IDoc's segments, input[index] <- what does this translate to in the example given, say

INVOIC02.E1EDK03[index] or INVOIC02[index]?

Thanks.

Former Member
0 Kudos

Hi,

input should be the input parameter of the udf.

If the input parameter is the segment (in your example E1EDK03), then you loop over the segments and input[0] references the first E1EDK03 segment.

Regards

Patrick

Answers (1)

Answers (1)

SudhirT
Active Contributor
0 Kudos

Hi,

while creating UDF ,you create n no of argument say a,b,c. but in your case it will be only one say 'a'. after writing the UDF, you will use it in graphical mapping and the input will be the segment for which you want d loop. this segment will be the argument 'a' inside the UDF.

Thanks.