cancel
Showing results for 
Search instead for 
Did you mean: 

Send transformed IDoc as an attachment.

Former Member
0 Kudos

Hi,

I have a query on Mail adapter.

An Idoc is being transformed to a "shipment" structure and the transformed data which is shipment is to be sent via email as an attachment to the user.The name of file/attachment is to be created dynamically from fields in IDoc.

Please suggest the solution.

Thanks!

Indu Khurana

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi

Use Dynamic configuration with mail package XSD.

Refer the below blog,

http://wiki.sdn.sap.com/wiki/display/SI/DynamicEmailAttachmentnameforReceivedMails

Regards

Ramg

Former Member
0 Kudos

Hi Ramg

Thanks a lot for your reply.

I am using mail adapter the very first time and I am a bit confused in the implementation.

I have transformed IDOC to shipment structure and now i have created another mapping wherein the source str is shipment and target is MAIL XSD. Will checking " use attachement " in ID send the data in shipment structure as an attachement?

And I have no field in target str to save the filename which I am getting from IDOC fields!

Thanks!

Former Member
0 Kudos

You have to map the output to "content-disposition"

its explained clearly in the above given blog.

Regards

Ramg

Former Member
0 Kudos

Hi Ramg,

I have configured as described in the blog but the following error is coming:

"error occured: com.sap.aii.af.ra.ms.api.RecoverableException: java.net.ConnectException: Connection timed out: connect"

What could possibly be the reason ,do I need to add some EJB or any other configuration?

I have used gmail as server address.

Thanks!

Indu

former_member200962
Active Contributor
0 Kudos

Can you check with your BASIS team and confirm that the required ports are opened for sending mails to your Gmail account.

I assume that you have configured the receiver email channel properly!

Regards,

Abhishek.

Former Member
0 Kudos

Rec mail adapter configuration:

transport protocol: SMTP

MSG protocol: XIPAYLOAD

AE: IS

URL: SMTP://gmail..

Configure user authentication checked

Have given user id and password of my gmail a/c

use mail package checked

keep attachments checked

use adapter specific adapters checked.

Former Member
0 Kudos

x

Edited by: Indu Khurana on May 6, 2010 3:21 PM

Former Member
0 Kudos

Hi Abhishek,

I am creating the attachment/file name through dynamic configuration in XSLT but the name of attachment is not coming as required,its any random generated name:

code used:

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:map="java:java.util.Map"

xmlns:dyn="java:com.sap.aii.mapping.api.DynamicConfiguration"

xmlns:key="java:com.sap.aii.mapping.api.DynamicConfigurationKey">

<xsl:output method="xml" version="1.0" encoding="UTF-8" />

<xsl:output indent="no" />

<xsl:param name="inputparam"/>

<!-- mail parameters -->

<xsl:template match="*">

<ns:Mail xmlns:ns="http://sap.com/xi/XI/Mail/30">

<xsl:variable name="X" select="Shipment/InternalShipmentNum"/>

<Subject>Mail to DSV for shipments</Subject>

<From>a</From>

<To>c</To>

<!--change dynamic configuration -->

<xsl:variable name="dynamic-conf" select="map:get($inputparam, 'DynamicConfiguration')"/>

<xsl:variable name="dynamic-key" select="key:create('http://sap.com/xi/XI/System/File', 'FileName')"/>

<xsl:variable name="dynamic-value" select="dyn:get($dynamic-conf, $dynamic-key)" />

<!xsl:variable name="new-value" select="concat($dynamic-value,'test')" />

<xsl:variable name="dummy" select="dyn:put($dynamic-conf,$dynamic-key,$new-value)"/>

<!--Content type -->

<Content_Type>application/xml</Content_Type>

<!--Content Disposition->

<Content_Disposition>attachment;filename"<xsl:copy-of select="$new-value"></xsl:copy-of>"</Content_Disposition>

<!--Content Description -->

<!Content_Description><xsl:copy-of select="$dummy"/></Content_Description>

<Content>

<xsl:copy-of select=".">

<xsl:apply-templates/>

</xsl:copy-of>

</Content>

</ns:Mail>

</xsl:template>

</xsl:stylesheet>

Please suggest ! I need the value in "Shipment/InternalShipmentNum" as name of attachment.

Thanks in advance!

Indu Khurana

former_member181962
Active Contributor
0 Kudos

This discussion has very informative replies reagrding a similar query:

Regards,

Ravi Kanth Talagana

Former Member
0 Kudos

Hi,

I need a solution to send the entire output(not one/two fileds) payload as an attachment.Input payload is idoc.Putting filename in content disposition is not working.

Thanks!

Former Member
0 Kudos

Could (anybody ) you please give your number or call me at 9910127818

Thanks !

Edited by: Indu Khurana on May 6, 2010 4:28 PM