cancel
Showing results for 
Search instead for 
Did you mean: 

help with UDF

Former Member
0 Kudos

Hi,

I would like to send a email using UDF.

Requirement: if xyz == "9" then send a email and also pass the value .......

else directly pass the value

I want to do it without Looksups, exclusively using Java code inside UDF.

has anyone done this earlier? Can someone help me?

thanks,

Venkat.

Edited by: Venkat A on Jul 22, 2009 10:58 PM

Accepted Solutions (1)

Accepted Solutions (1)

Shabarish_Nair
Active Contributor
0 Kudos

>

> Hi,

>

> I would like to send a email using UDF.

>

> Requirement: if xyz == "9" then send a email and also pass the value .......

> else directly pass the value

> I want to do it without Looksups, exclusively using Java code inside UDF.

>

> has anyone done this earlier? Can someone help me?

>

> thanks,

> Venkat.

>

> Edited by: Venkat A on Jul 22, 2009 10:58 PM

2 ways;

1. using alerts - /people/bhavesh.kantilal/blog/2006/07/25/triggering-xi-alerts-from-a-user-defined-function

2. call a email class from UDF - https://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=90570965

Former Member
0 Kudos

Agasthuri Doss,

I cannot go wid your solution as our alerts are in CCMS not through ALRTCATDEF

Shabarish,

Can your solution 2 be implemented without BPM?

I think I have to do lot of coding for this... I am not good at Java any errors in future .. do you think I can be able to handle with these huge UDFs?

How does it effect the performance?

Thanks,

Venkat.

Shabarish_Nair
Active Contributor
0 Kudos

use solution 2... the major code is already there

I dont think it should be a big performance issue....

Former Member
0 Kudos

Shabarish,

so far so good.

I am trying to do it in MM because I think that is pretty simple.

1. I have imported MM archieve to IR

2. imported mail.sdn.*; in UDF.

3. Placed the code as mentioned there.

I have following doubts in the actual code.

1. "<mailhost>" - What should I enter the value for this?

2. do I need to provide a sender ID that is existing? I mean if I provide the xi.adm at dev.com... does it really need to exist in real?

3. How do I use imported archieve?i mean I have a normal MM now. how do I link that imported achieve?

Thanks,

Venkat.

Edited by: Venkat A on Jul 23, 2009 12:03 AM

Shabarish_Nair
Active Contributor
0 Kudos

>

> I have following doubts in the actual code.

> 1. "<mailhost>" - What should I enter the value for this?

this is your mail server .. ex. smtp.yahoo.com etc

> 2. do I need to provide a sender ID that is existing? I mean if I provide the xi.adm at dev.com... does it really need to exist in real?

it can be anything that you want to be in the from id of your email

> 3. How do I use imported archieve?i mean I have a normal MM now. how do I link that imported achieve?

>

> Thanks,

> Venkat.

>

> Edited by: Venkat A on Jul 23, 2009 12:03 AM

in the UDF give you package name in the imports section ... the screenshot of the UDF in the link also shows this

Former Member
0 Kudos

Shabarish,

Thanks for your quick response.

One last question....

this is your mail server .. ex. smtp.yahoo.com etc

How do I know what should I enter for this value?

does it need some Basis admin setting on PI?

I tried with smtp.yahoo.com and set target email id as one office ID and one yahoo id. it sent mail to none.

Please suggest.

Thanks again,

Venkat.

Shabarish_Nair
Active Contributor
0 Kudos

lets take the case of a company mail server. say your mail client is outlook you can find the details via tools -> email account -> select the account details -> microsoft exchange server -> <yourcomany.mail.server>

else you can contact your mail admin / basis to know more details ..

Former Member
0 Kudos

For some reasons the servername.compnayname.com doesnt seem to be working.

Appreciate all your help Shabarish. I will check with my admin and will update you....

No matter if the email is sent or not it shows always as succesful. How do we make sure the delivery of the email?

thanks,

Venkat.

Shabarish_Nair
Active Contributor
0 Kudos

since there is no mail adapter to monitor the message i guess the only way seems to be to check the inbox itself

santhosh_kumarv
Active Contributor
0 Kudos

>>1. "<mailhost>" - What should I enter the value for this?

Go to T-Code SCOT double click SMTP under INT.. you can find the mails host that is being used by the PI to send emails. Use the same in the UDF

~SaNv...

Shabarish_Nair
Active Contributor
0 Kudos

have added that info to the wiki

santhosh_kumarv
Active Contributor
0 Kudos

I was abt to do that... but u did it.... thanks

~SaNv...

Former Member
0 Kudos

Thanks a lot Shabarish

Santhosh that was very useful and will be useful to many in future. Good work..Appreciate your effort.

I have localhost with port 25 in the SCOT.

So I tried with

1. smtp://host.compnay.com

2.imap4://host.compnay.com

3. host.compnay.com 25

4. host.compnay.com:25

5. localhost

6. localhost 25

7. localhost:25

8. host.compnay.com

9. host

10. IP address

11. host.company.com,25

Can you suggest wat should I exactly use? None of the 11 worked for me

Change:

In the newly added commonent. please correct "Use can the same in the UDF" in the last portion of wiki.

Thanks,

Venkat.

Edited by: Venkat A on Jul 23, 2009 10:38 AM

Former Member
0 Kudos

Santhosh/Shabarish,

I made the hostname from localhost to actual host in SCOT.

My admin is able to send a test email from test screen and from telnet.

But I still face the problem.

When I display queue, it executes succesfully. But I do not see email.

how do I see where things going wrong?

Please help.

thanks,

Venkat.

santhosh_kumarv
Active Contributor
0 Kudos

Hi Venkat,

Confirm if you are using the correct email-id and the format..... there is now way to monitor this emails message sucess status.... jst confirm if the mail server configuration is correct in your PI... try sending an email using the mail adapter with the same host name that u r using in the UDF...

~SaNv...

santhosh_kumarv
Active Contributor
0 Kudos

Hi Venkat,

where were you gng wrong and how did u resolve it...?

~SaNv...

Former Member
0 Kudos

Hi Santhosh,

I was trying to execute it from MM without the Integration scenario. I thought it will work like a lookup to test which we dont need a scenario .

server logs said the receiver deter not found. i created one and got executed.

thanks again.

Answers (1)

Answers (1)

agasthuri_doss
Active Contributor
0 Kudos

Venkat,

Thread -

Check the Answers from Aamir & Raj

Cheers

Agasthuri Doss