cancel
Showing results for 
Search instead for 
Did you mean: 

UDF for Counting index for Alert Message

Former Member
0 Kudos

Hi I am trying to implement the following scenario.

Mapping a Multiple message (collected in a BPM) to a single message

LIST HEADER

S_STX --> REPORT both 1..unbounded

So mapping S_STX --> MyCounter --> REPORT

public void MyCounter(String[] myArgument,ResultList result,Container container){

for (int j =0;j<myArgument.length;j++)

{

result.addValue(myArgument[j]) ;

}

if(myCounter==null) myCounter = new Integer(0);

else

{myCounter = new Integer(myCounter.intValue() + 1);

}

}

Variable myCounter is declared as a global variable in the Java section

Integer myCounter.

Now this runs and in the Queue I can see

MyCounter in MyCounter out

[] []

[] []

[] []

[] []

I want to make the myCounter variable available to the trace so we can track which single message had a mapping error.

I would also like this available to my BPM Container so that the ALERT Message can reference it.

Any ideas how to proceed from here?

thanks

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Right I managed it by using collapse contexts and Sum then mapped to a FaultMessage type the Error Text concatenating in the result of my User function

Former Member
0 Kudos

I have read some more stuff as you sent.

Now I have a simple UDF that can pass the inbound queue to the outbound queue so that I am not affecting the mapping but also issues the index line I am on as an addWarning() to the trace.

The result is that when I Test the Mapping in the Design Tool I can see this information coming out in the log.

Message Index 1

Message Index 2 etc

When I run this with data in the runtime environment I get no logging information on this. As I throw my alert because the 3rd message is incorrect and the effect is that the mapping result is never reached so there is no resulting XML logged message.

Do I need to create some sort of out message before I throw the ALERT so that I can get the messages logged?

I am mapping from a multiline message to a single message.

thanks in advance...

Former Member
0 Kudos

HI ,

check this links for different UDF,

http://flickr.com/photos/8764045@N06/

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/be05e290-0201-0010-e997-b6e...

Example 1

http://www.flickr.com/photo_zoom.gne?id=544183191&size=o

http://www.flickr.com/photo_zoom.gne?id=544183195&size=o

http://www.flickr.com/photo_zoom.gne?id=544183225&size=o

http://www.flickr.com/photo_zoom.gne?id=544183233&size=o

Example 2

http://www.flickr.com/photo_zoom.gne?id=545133789&size=o

http://www.flickr.com/photo_zoom.gne?id=545133791&size=o

http://www.flickr.com/photo_zoom.gne?id=545133801&size=o

http://www.flickr.com/photo_zoom.gne?id=545133807&size=o

http://www.flickr.com/photo_zoom.gne?id=545133811&size=o

http://www.flickr.com/photo_zoom.gne?id=545138911&size=o

http://www.flickr.com/photo_zoom.gne?id=545138913&size=o

http://www.flickr.com/photo_zoom.gne?id=545138915&size=o

http://www.flickr.com/photo_zoom.gne?id=545138917&size=o

http://www.flickr.com/photo_zoom.gne?id=545138947&size=o

http://www.flickr.com/photo_zoom.gne?id=545138951&size=o

http://www.flickr.com/photo_zoom.gne?id=545005958&size=o

Example 3

http://www.flickr.com/photo_zoom.gne?id=549186611&size=o

http://www.flickr.com/photo_zoom.gne?id=549186651&size=o

http://java.sun.com/j2se/1.5.0/docs/api/

/people/krishna.moorthyp/blog/2006/07/29/documentation-html-editor-in-xi

/people/sap.user72/blog/2006/02/06/xi-mapping-tool-exports

http://help.sap.com/saphelp_nw04/helpdata/en/43/c4cdfc334824478090739c04c4a249/content.htm

http://help.sap.com/saphelp_nw04/helpdata/en/22/e127f28b572243b4324879c6bf05a0/content.htm

/people/stefan.grube/blog/2005/12/30/test-user-defined-functions-for-the-xi-graphical-mapping-tool-in-developer-studio

http://help.sap.com/bp_bpmv130/Documentation/Operation/MappingXI30.pdf

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d046c490-0201-0010-84b6-9df523cb...

Regards,

phani