cancel
Showing results for 
Search instead for 
Did you mean: 

Userdefined Function

Former Member
0 Kudos

Hi ,

i need to use an user defined function.. can any body give me the exact code.. for doing that.. because.. my requiremnt is i have one source struture and multiple receivers..

If the Nmae starts with Mr means.. those perosons details will goes to MALE RECEIVER..

IF the name starts with Ms then those details will moves to FEMALE RECEIVERS..

for this i'm useing an user defined in that i wrote this code. but it's not working... so, plz check this.. and correct it..

-


int i;

int mr=0;

int ms=0;

for(i=0; i<a.length;i++)

{

if( a<i>.substring(0,2).equals("Mr") && mr==0)

{

result.addValue("<b>MALE RECEIVER</b>"); ****my first receiver

mr=1;

}

if( a<i>.substring(0,2).equals("Ms") && ms==0)

{

result.addValue("<b>FEMALE RECEIVER</b>"); ****my second receiver

ms=1;

}

}

</textarea>

-


for helpful answers will be rewarded

thanks

BABU

Accepted Solutions (1)

Accepted Solutions (1)

former_member614185
Contributor
0 Kudos

Hi babu,

Try this one,

int i;

int mr=0;

int ms=0;

for(i=0; i<a.length;i++)

{

if( a<i>.substring(0,2).equals("Mr") && mr==0)

{

result.addValue("MALE RECEIVER"); ****my first receiver

mr=1;

}

if( <i>.substring(0,2).equals("Ms") && ms==0)

{

result.addValue("FEMALE RECEIVER"); ****my second receiver

ms=1;

}

}

the changes i made here is<b> a<i></b> (array)

former_member614185
Contributor
0 Kudos

int i;

int mr=0;

int ms=0;

for(i=0; i<a.length;i++)

{

if( a<i>.substring(0,2).equals("Mr") && mr==0)

{

result.addValue("MALE RECEIVER"); ****my first receiver

mr=1;

}

if( a<i>.substring(0,2).equals("Ms") && ms==0)

{

result.addValue("FEMALE RECEIVER"); ****my second receiver

ms=1;

}

}

there was amistake in my previous reply a<i>

Answers (4)

Answers (4)

former_member192892
Active Contributor
0 Kudos

Hi Babu,

What is the occurence of your source "<b>NAME</b>" node??

Former Member
0 Kudos

Hi varun :

Name is with occurences of 0 : UNBOUNDED

thanks

babu

Former Member
0 Kudos

Hi

What problem does this give??Error??

Thanks

Former Member
0 Kudos

Hi babu,

Check the links u can find lot of UDF's

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

Reward Points if Helpful

Former Member
0 Kudos

This can be done in recevier determination using conditions in the configured receiver.

Select Condition and Add

Select Left Operand and then the field to check (Using XPath)

Opearation is equal

Right operand is Mr

Assign that to the comunication channel

Repeat for Ms.

Former Member
0 Kudos

HI babu

your requirement is based on the starts name and on the basic of the starts name u have tow choice diffrent reciever . you can do it in condition editor in reciever determenation and it will work.

Thanks

sudhir sharma

Former Member
0 Kudos

Hi sudir,

I'm doing Enhanced receiver determination.. so, we need to use the user defined function only.. in this function i need to write the code ..like.. if the name starts with MR then this message will moves to first receiver..

if the name starts with MS then this message will moves to Second receiver.. like this..

so, can u plz give me the coding..

regards

babu