Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

UDF help

Hi XI gurus,

I am not an expert with JAVA programming so I'm having this problem regarding the UDF that I need to create. I need to group transactions according to 2 different fields. For example:


Material Price Date

Cotton 1.00 02-28-11

Wood 5.50 01-08-11

Metal 10.0 01-25-11

Cotton 1.00 01-25-11

Wood 5.50 01-25-11

I need to group the transactions that have equal Material and Price.

Output should be:


Cotton 1.0 02-28-11

Cotton 1.0 01-25-11


Wood 5.50 01-08-11

Wood 5.50 01-25-11


Metal 10.0 01-25-11

Is this possible via UDF?

Any help would be greatly appreciated. Thanks!

Former Member
Former Member replied


For the child fields use this function

valueKeyQueue - should be material

valueQueue - should be for example price or date

valueQueue - this entire structure material>removecontext->sort>splitby value(valuechange)->collapsecontect---->I

don't forget splitByValue after the call to the UDF

public static void findValuesByKeysForSearchKeys(String[] valueKeyQueue, String[] valueQueue, String[] searchKeyQueue, ResultList result) throws StreamTransformationException{
		for (int i = 0; i < searchKeyQueue.length; i++) {
			// Is the current entry a context change?
			if (searchKeyQueue<i>.equals(ResultList.CC)) {
				// add the context change itself to the result queue
			} else {
				// find the value in the valueQueue
				boolean found = false;
				int j = 0;
				while (j < valueKeyQueue.length && !found) {
					if (valueKeyQueue[j].equals(searchKeyQueue<i>)) {
						found = true;
						if (j<valueQueue.length)
					} else {

				if (!found) {

0 View this answer in context

Helpful Answer

Not what you were looking for? View more on this topic or Ask a question