cancel
Showing results for 
Search instead for 
Did you mean: 

Sending file as e-mail attachment

Former Member
0 Kudos

Hi,

I want to prapare XI 3.0 message that doing only send file as atachment to an e-mail address.

File is generated by another system everyday. XI 3.0 system must take and send this file.

XI3.0 must generate filename as yesterday's yyyymmdd format, and it must send file with same name with yyyymmdd.

XI 3.0 message must be executed one a day automatically (for example at 9.00 Am).

Is there a blog to achieve this message easily?

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

sunilchandra007
Active Contributor
0 Kudos

Hi,

Yours is a file to mail scenario, in which file is picked up and sent as a mail attachment on daily basis.

Following links would be helpful in your case -

1. http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/6d967fbc-0a01-0010-4fb4-91c6d38c5816&override...

2. Section 3.2 in http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/9e6c7911-0d01-0010-1aa3-8e1bb1551f05&override...

3. http://www.riyaz.net/blog/xipi-sending-emails-using-xi-mail-adapter/

Regards,

Sunil Chandra

Former Member
0 Kudos

Hi,

thanks for your help.

But links you send are not clear enought.

I only send one txt file as mail attachment.

It must not be so difficult.

Is there a blog etc. showing it step by step?

Thanks.

sunilchandra007
Active Contributor
0 Kudos

Hello,

> thanks for your help.

> But links you send are not clear enought.

It is not always possible to get the weblog exactly matching to your requirements. The weblog are generally written targeting to some specic requirements. I have given you the links that will be helpful ,it does not claim 100% match to youe scenario.

> Is there a blog etc. showing it step by step?

Many a times you have to pick different things from different blogs to complete your requirements.

Regards,

Sunil Chandra

Former Member
0 Kudos

Hi,

Those Blogs are Really very Helpful

Regards,

Ankit Baid

Answers (5)

Answers (5)

Former Member
0 Kudos

I developed java code sending email with attacment.

Former Member
0 Kudos

Incase you want to use adapter module to send email, you can reuse the below link.

Link: []

This uses Java mail api

Regards,

Sumant

Former Member
0 Kudos

Hi SumantKRaja ,

Could you give full java code with import part and necessary .jar name?

Thanks.

Former Member
0 Kudos

Refer the following Blog-

http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3417300)ID0426134050DB01517382336190791762End...

generate filename as yesterday's yyyymmdd format, and it must send file with same name with yyyymmdd

You need to use the following UDF to generate yesterday's date-

Imports: java.text.;java.util.;

public String yesterday(Container container)

{

long oneDay = (long) 1000.0 * 60 * 60 * 24;

DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");

java.util.Date today = new java.util.Date(System.currentTimeMillis());

java.util.Date yesterday = new java.util.Date(System.currentTimeMillis()-oneDay);

String b = dateFormat.format(yesterday);

return b;

}

Map this with Content_Disposition as mentioned in wiki.

XI 3.0 message must be executed one a day automatically (for example at 9.00 Am).

Use 'Availability Time planning' for CC as mentioned above.

http://help.sap.com/saphelp_nw70/helpdata/EN/45/06bd029da31122e10000000a11466f/content.htm

former_member200962
Active Contributor
0 Kudos
XI3.0 must generate filename as yesterday's yyyymmdd format, and it must send file with same name with yyyymmdd.

To have yesterday's date you need to write a UDF whose input will be current date (todays date) and which will subtract one day from current date and pass yesterdays date.....search on SDN on how to subtract date/ day

Once you are done with the UDF logic then in the same UDF you need to implement Dynamic Configuration logic so that target filename can be set dynamicallly

XI 3.0 message must be executed one a day automatically (for example at 9.00 Am).

This can be achieved by scheduling your sender file adapter to pick files at 9.00 am....technique is called Availability Time planning.

Regards,

Abhishek.

former_member187339
Active Contributor
0 Kudos

Hello....

The blog mentioned in above thread will be helpful in developing your interface. I will try to summarize how to create this scenario in PI

>>I want to prapare XI 3.0 message that doing only send file as atachment to an e-mail address.

Configure a sender communication channel and pick this file. since the file can be XML or Excel or anything.

>>File is generated by another system everyday. XI 3.0 system must take and send this file. XI3.0 must generate filename as yesterday's yyyymmdd format, and it must send file with same name with yyyymmdd.

For generating the filename in mail adapter you either need to specify the name in

1. ContentDisposition of the mail package. or (this is there in riyaz blog and also in wiki)

2. Write a module which automatically updates this details (You can find this in wiki section of sdn)

>>XI 3.0 message must be executed one a day automatically (for example at 9.00 Am).

Can be taken care by automatic scheduling of file adapter

>>Is there a blog to achieve this message easily?

Doing all these things in a single blog or wiki!!! I dont think so, maybe you can come up with one

I suggest you to get ahead and start developing your interface.

Regards

Suraj

Former Member
0 Kudos

Hi,

I'm getting txt file with file sender comm.channel. No problem with this step.

My problem is making atachment this txt file for mall receiver com.channel.

How can i pass file from file sender to mail receiver com.channel?

Thanks.

former_member187339
Active Contributor
0 Kudos

Hello..

few days back had the same requirement..

I have used mail package xsd

1. read the complete inbound payload to the content field (this was done using java mapping), Stefan grube blog on java mapping will help you

2. Map the to, from address, content disposition, description etc in second mapping (this was message mapping). Take help from riyaz blog

3. Call both these mapping 1 and 2 in interface mapping

4. In receiver channel select XIPayload and use mail package option

Your interface is done...

Regards

Suraj