cancel
Showing results for 
Search instead for 
Did you mean: 

How to write UDF for following Business logic in SAP XI

Former Member
0 Kudos

I have to write a user defined function in SAP XI. the scenario is as follows.

UDF needs to extract the mailid from source field.

source field : mail id

target field: from maild id

source example: "abc xyz"<abc.xyz@def.com>

target example: abc.xyz@def.com

pls any one help to write java code in udf.

pls response ASAP.

Thanks in Advance.

Regards,

Raghu

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

i got exact solution.

Thanks

Raghu

sunil_singh13
Active Contributor
0 Kudos

Hi Raghu ,

Don't use UDF you cn do this by using Standerd Functions given by SAP .Follow the Steps : -

Concate abc and XYZ using concat them and in concate you give "." in between So it will look like "abc.xyz" and then you can use append function to append @def at the end .

Dont use UDF as they are over head .

Regards,

Sunil Singh

Former Member
0 Kudos

Hi Raghu Ram,

public String mailId(String a,Container container){

//write your code here

String b = a.substring(a.indexOf("<")+1, a.lastIndexOf(">"));

return b;

mailId - u r udf name, a - is input field of Source field to this UDF.It will solve u r problem.

Cheers

Veera

Former Member
0 Kudos

public void func(String inputMail)

{

String outputMail = inputMail.substring(inputMail.indexOf("<")+1, inputMail.lastIndexOf(">"));

return outputMail;

}

former_member192892
Active Contributor
0 Kudos

Use this logic

the input is myInput

String output = myInput.substring(myInput.indexOf("<")+1, myInput.lastIndexOf(">"));

return output;

Former Member
0 Kudos

hi varun ,

can u provide that compleate java code.

Thanks,

Raghu

santhosh_kumarv
Active Contributor
0 Kudos

Hi Raghu,

The code given by varun is complete one.

String output = myInput.substring(myInput.indexOf("<")+1, myInput.lastIndexOf(">"));

return output;

*myInput is the name of the argument passed to the UDF.

Mapping:

sourcenode---->UDF--


> Target node.

Regards

San

former_member192892
Active Contributor
0 Kudos

Monica has given the whole fn

Thanks

Varun

Former Member
0 Kudos

Hi varun,

thank u so much for giving exact solution.

former_member192892
Active Contributor
0 Kudos

Thanks,

Please close the thread if you got the solution

Varun

former_member614185
Contributor
0 Kudos

Y r u going for UDF. You dircetly use Graphical mapping.

Former Member
0 Kudos

Hi prabhu,

in graphical mapping only i am going to write userdefined function.

Thanks,

Rahgu

former_member614185
Contributor
0 Kudos

Thats ok Raghu,

If you have mail ID in your input message. Y dont u map it directly to ur target field