Email attachment name in sender mail adapter to the receiver file adapter
HI ,
Ths is regarding email to file scenario. I am trying to create file (in rceiver file adapter) with the same name as the email attachment that i read from mail sender adapter. I want ro use adapter module for this. I could find from blogs that there is module - GetAttachmentName - available that i can use for this in sender mail adapter.
Can you please let me know what whetehr i neeed to mention any module key and parameters for this.
I assume , i need to do following steps :Please confirm.
1. i can use this module - after payload swap module and before standard mail adapter module in sender mail adapter
2. select ASMA option in advanced tab in sender mail adapter
3. In receiver file adapter select ASMA option in advanced tab in sender mail adapter
4. Also select file name option in ASMA in sender mail adapter
Thanks,
Vamsi
Hi Vamsi,
your scenario is also described here: Re: sender mail adapter - attachment name
If you use the Module getAttachmentName, which is described here,
http://wiki.sdn.sap.com/wiki/display/XI/AdapterModulePI7.0GetAttachmentName
your scenario should work as you described it.
You just need to make sure that the Attachment Name that you read in the first place, is mapped to the Filename Attribute of the
Fileadapter (http://sap.com/xi/XI/System/File/FileName).
regards,
Daniel
Similar Messages
-
Need to get the Mail attachment name as it is to the receiver file adapter
I am doing a Mail to File scenario. I need to get the attachment from the mail and store it on the file server. I am using the PayloadSwap bean in the sender mail adapter. My requirement is to carry forward the attachement name as it is to the receiver file adapter side and store the file with the same name.
Did any one try doing this? I was looking at developing an adapter module but got struck as I could not find whether the attachement name is stored in the XI payload after it has got swapped using the swap bean.
Any help would be appreciated.
VJOops pressed the send key. Take two.
This is becoming a damn nightmare. When I run the adapter I am getting ModuleExceptions. Can you pass your eyes over these Java config settings to see what I am doing wrong. Using NWDS CE 7.1 with PI 7.1 both at SP07. All the imports were taken from PI 7.1 after SP07 was applied. The build id of NWDS is
SAP NetWeaver Developer Studio
SAP NetWeaver 7.1 Composition Environment SP07 PAT0001
Build id: 200901152336
APPLICATION.XML
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN"
"http://java.sun.com/dtd/application_1_3.dtd">
<application>
<display-name>MailPOP_EAR</display-name>
<description>EAR description</description>
<module>
<ejb>MailPOP_EJB.jar</ejb>
</module>
</application>
APPLICATION-J2EE-ENGINE.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE application-j2ee-engine SYSTEM "application-j2ee-engine.dtd">
<application-j2ee-engine>
<reference reference-type="hard">
<reference-target provider-name="sap.com" target-type="service">engine.security.facade</reference-target>
</reference>
<reference reference-type="hard">
<reference-target provider-name="sap.com" target-type="library">engine.j2ee14.facade</reference-target>
</reference>
<reference reference-type="hard">
<reference-target provider-name="sap.com" target-type="service">com.sap.aii.af.svc.facade</reference-target>
</reference>
<reference reference-type="hard">
<reference-target provider-name="sap.com" target-type="interface">com.sap.aii.af.ifc.facade</reference-target>
</reference>
<reference reference-type="hard">
<reference-target provider-name="sap.com" target-type="library">com.sap.aii.af.lib.facade</reference-target>
</reference>
<reference reference-type="hard">
<reference-target provider-name="sap.com" target-type="library">com.sap.base.technology.facade</reference-target>
</reference>
<fail-over-enable mode="disable" />
</application-j2ee-engine>
EJB-J2EE-ENGINE.XML
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-j2ee-engine SYSTEM "ejb-j2ee-engine.dtd">
<ejb-j2ee-engine>
<enterprise-beans>
<enterprise-bean>
<ejb-name>GetMailAttachment</ejb-name>
<jndi-name>GetMailAttachment</jndi-name>
<session-props/>
</enterprise-bean>
</enterprise-beans>
</ejb-j2ee-engine>
EJB-JAR.XML
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans
2.0//EN"
"http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar>
<description>EJB JAR description</description>
<display-name>EJB JAR</display-name>
<enterprise-beans>
<session>
<ejb-name>GetMailAttachment</ejb-name>
<home>com.sap.aii.af.lib.mp.module.ModuleHome</home>
<remote>com.sap.aii.af.lib.mp.module.ModuleRemote</remote>
<local-home>com.sap.aii.af.lib.mp.module.ModuleLocalHome</local-home>
<local>com.sap.aii.af.lib.mp.module.ModuleLocal</local>
<ejb-class>sample.GetMailAttachment</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
</ejb-jar>
SENDER MAIL ADAPTER modules
1 AF_Modules/PayloadSwapBean Local EB 1
2 GetMailAttachment Local EB 2
3 sap.com/com.sap.aii.adapter.mail.app/XIMailAdapterBean Local EB 3
1 swap.keyName payload-name
1 swap.keyValue MailAttachment-1
RECEIVER FILE MODULES
1 localejbs/AF_Modules/DynamicConfigurationBean Local Enterprise Bean 1
2 localejbs/CallSapAdapter Local Enterprise Bean 2
1 key.0 write http://sap.com/xi/XI/System/File FileName
1 value.0 message.interface
VARIABLE FILENAME SUBST WITH ASMA TURNED ON
fName message:interface_name
JAVA SOURCE
package sample;
import javax.ejb.CreateException;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import com.sap.aii.af.lib.mp.module.Module;
import com.sap.aii.af.lib.mp.module.ModuleContext;
import com.sap.aii.af.lib.mp.module.ModuleData;
import com.sap.aii.af.lib.mp.module.ModuleException;
import com.sap.engine.interfaces.messaging.api.Message;
import com.sap.engine.interfaces.messaging.api.MessagePropertyKey;
import com.sap.engine.interfaces.messaging.api.TextPayload;
import com.sap.engine.interfaces.messaging.api.XMLPayload;
import com.sap.aii.af.service.cpa.Channel;
@ejbHome <{com.sap.aii.af.lib.mp.module.ModuleHome}>
@ejbLocal <{com.sap.aii.af.lib.mp.module.ModuleLocal}>
@ejbLocalHome <{com.sap.aii.af.lib.mp.module.ModuleLocalHome}>
@ejbRemote <{com.sap.aii.af.lib.mp.module.ModuleRemote}>
@stateless
<code>GetMailAttachment</code>
@SuppressWarnings("unused")
public class GetMailAttachment implements SessionBean, Module {
private static final long serialVersionUID = 7612238514043673502L;
private SessionContext myContext;
private MessagePropertyKey myFileName;
public void ejbRemove() {
public void ejbActivate() {
public void ejbPassivate() {
public void setSessionContext(SessionContext context) {
myContext = context;
@throws CreateException
public void ejbCreate() throws CreateException {
public void getMessageProperty(MessagePropertyKey FileName) {
myFileName = FileName;
@param moduleContext
Contains data of the module processor that might be important
for the module implementation such as current channel ID
@param inputModuleData
Contains the input XI message as principal data plus eventual
set supplemental data
@return ModuleData Contains the (changed) output XI message. Might be the
response message if the module is the last in the chain.
@exception ModuleException
Describes the cause of the exception and indicates whether
an retry is sensible or not.
@SuppressWarnings("deprecation")
public ModuleData process(ModuleContext moduleContext,
ModuleData inputModuleData) throws ModuleException {
try {
Message msg = (Message) inputModuleData.getPrincipalData();
TextPayload payload = msg.getDocument();
String contentType = payload.getContentType();
// Content Type could be something like
// text/plain;charset="UTF-8";name="file.txt"
contentType = contentType.replaceAll("\"", "");
int i = contentType.lastIndexOf("=") + 1;
String fileName = contentType.substring(i);
msg.setMessageProperty(myFileName, fileName);
inputModuleData.setPrincipalData(msg);
} catch (Exception e) {
return inputModuleData;
JAVA ERRORS
2009-02-04 11:41:14 Information Mail: calling the module processor for channel LMK_Common_Mail_Sender
2009-02-04 11:41:14 Information Swap: swapping by payload-name ? MailAttachment-1
2009-02-04 11:41:14 Information Swap: successfully swapped
2009-02-04 11:41:14 Information Mail: message leaving the adapter (call)
2009-02-04 11:41:14 Information The application tries to send an XI message asynchronously using connection AFW.
2009-02-04 11:41:14 Information Backward validation is enabled
2009-02-04 11:41:14 Error Unable to validate the message with message ID 8702df71-f254-11dd-9b9b-001a64a73518
2009-02-04 11:41:14 Error Returning to application. Exception: com.sap.engine.interfaces.messaging.api.exception.MessagingException: Content is not allowed in prolog.
2009-02-04 11:41:14 Error Mail: error occured: com.sap.engine.interfaces.messaging.api.exception.MessagingException: Content is not allowed in prolog.
2009-02-04 11:41:14 Error Mail: error occured: com.sap.aii.af.lib.mp.module.ModuleException -
Archiving files in the Receiver File Adapter
Hi All,
I am trying to archive the file created in the Receiver File adapter. Reading from the link below,
http://help.sap.com/saphelp_nw04/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/content.htm
I gave the command cp %F <target dir> in the Command Line of "Run Operating System Command After Message Processing". As well as I tried cmd.exe copy %f <target file>
But it does not work. Can anyone please help me out?
Thanks
ShivanjaliHi Aamir,
For my case its not feasible to make a bat file...
I want to write a direct OS command in adapter only.
Do you know what is the basic difference for running OS command before processing and after processing.
In my opinion if i use a OS command after file processing then it ll take a file name with timestamp so there may be a problem...
thanks
Shivanjali -
How to create an Excel file from XML in the Receiver File Adapter Comm Ch
How do I create an Excel file from XML in the Receiver File Adapter Communication Channel? I have my mapping done and I am outputting the file as a comma delimited csv file. However, the target can only process an Excel file (.xls). How can I generate an Excel in XI?
I saw this blog, but I don't know how to create a XSLT transformation.
/people/michal.krawczyk2/blog/2005/12/10/xi-generating-excel-files-without-the-java-nor-the-conversion-agent-not-possible
Any help would be appreciated. Thanks.Here are the steps I took to create an XSLT transformation in XI 3.0:
1. I created my source and target XSDs using XMLSpy.
2. I created the XSLT mapping from source to target in XMLSpy (referencing the souce XSD schema).
3. I created another XSLT mapping to format the target into Excel XML.
4. Import the source and target XSDs in the IR's External Definitions
5. Zip each XSLT mapping (.xls) and import it into the IR's Imported Archives
6. Reference the XSL mappings in the Interface Mapping -
Repeating structure through the receiver file adapter
I wanted to ask wheter it is possible to create repeating structure through the SAP xi receiver file adapter. What I'm trying to accomplish is this:
Item1
Item2
Item1
Item2
(variable number of times).
I can accomplish the following:
Item1
Item1
Item2
Item2
What I could do is have the Item1 and Item2 fields in the same segment in the design time, but this would mean the file adapter would write all the items on a single line instead of two.
There is no way to define line breaks between the the receiver file adapter field parameters ?
There is no way to support nested structures in the recordset definition ie. Item1.Item2 ?Henri,
What Vishal means is following:
Add sequences of the tag <recordset> between pairs of item1, item2:
<documentName>
<<b>recordset</b>>
<item1>
<field-item1>column-value</field-item1>
<field-item1>column-value</field-item1>
<field-item1>column-value</field-item1>
</item1>
<item2>
<field-item2>column-value</field-item2>
<field-item2>column-value</field-item2>
<field-item2>column-value</field-item2>
</item2>
</<b>recordset</b>>
<<b>recordset</b>>
<item1>
<field-item1>column-value</field-item1>
<field-item1>column-value</field-item1>
<field-item1>column-value</field-item1>
</item1>
<item2>
<field-item2>column-value</field-item2>
<field-item2>column-value</field-item2>
<field-item2>column-value</field-item2>
</item2>
</<b>recordset</b>>
</documentName>
A similar problem with header and items is in this thread:
Repeating structure through the receiver file adapter
Hope that helps,
Stefan -
FCC Parameters are required in the Receiver File Adapter
Hi ,
Sorry for posting this question again.. my Structure is
MT_CADVICE_STRING
. . Batach -
1:Unbounded (Node)
. . .Header_String -
1:1
. . .Line_Item -
1:Unbounded (Node)
. . . .LineItem_String -
1:1
for this structure I'm geting data in the XML format.. .. my scenario is simple File to File scenario.. now i want to convert this XML to a normal Text file by using FCC in the Receiver file adapter..
and in the Receiver side i want the file in the bellow format: (each field i want to get in the separate line but at presnt I'm getting the continution of all lines I'm not getting the data in a separate lines..)
Header_string
LineItem_String
LineItem_String
Header_String
LineItem_String
so, any abody can help on this...
And in the Receiver Communication channel i keep the FCC parameters like as bellow :
RecordsetStructure : Batch,LineItem
Batch.fieldSeparator: 'nl'
LineItem.fieldSeparator: 'nl'
Batch.endSeparator: 'nl'
LineItem.endSeparator: 'nl'
For more information.. My source file is like bellow
<?xml version="1.0" encoding="utf-8" ?>
- <nr1:MT_CADVICE_STRING xmlns:nr1="urn:Test.com:SD:CAdvice">
- <Batch>
<Header_String>1 B 1110300014200804108218 36892.80 03 10.000 10.000 0.00 0.00 008000021720080410558000.00 91958.40 649958.40 0.00 649958.40 2678.40 1000003461100000346110000034611000003461123456 18 18 0.00 $</Header_String>
- <LineItem>
<LineItem_String>2 B 1110300014 1 000000000001234567000000000001 5.000 0.00 45000.00 10800.00.00 16.00 279000.00 0.00 rcl/ML0080200804100000000357 200804100.00 01 02 000000002.00 860.13321.00 $</LineItem_String>
</LineItem>
- <LineItem>
<LineItem_String>2 B 1110300014 2 000000000001234567000000000001 5.000 0.00 45000.00 10800.00.00 16.00 279000.00 0.00 rcl/ML0080200804100000000357 200804100.00 01 02 000000002.00 860.13321.00 $</LineItem_String>
</LineItem>
</Batch>
</nr1:MT_CADVICE_STRING >
Regards
JainHi jain
Provide as below definitely it will work,
RecordSet Structure : batch,Line_Item,LineItem_String
batch.fieldSeparator --- 'nl'
Line_Item.fieldSeparator -
'nl'
LineItem_String.fieldSeparator --- 'nl'
All your fields will come in a separate line.
Regards,
Sasi
Edited by: sasitharan on Jul 28, 2008 11:36 AM -
Cretaing a new adapter using the existing file adapter
Hi,
Is it possible to create a new adapter type copying the existing file adapter. That is I want to create a new adapter type for example "FNFS" and use the same module callsapadapter which is used in the File adapter. So that this new adapter type "FNFS" functions like the File adapter,
What are the actions I need to perform to acheive this.
Thanks in advance.what will be the significance of that?
I think if you need some extra functionality then Development of Custom Module is enough.
/people/john.ta2/blog/2006/12/20/to-create-or-not-to-create-an-sap-xi-adapter
Thanks
farooq. -
Module config : XML2PLAIN in the receiver file adapter :
Hi All,
I am facing a problem in using the Module XML2PLAIN in the receiver comm channel configuration.
I am using the same parameters in the another receiver and is working fine,but when I use it another on eit is not working.(and is working fine if I download XML directly).But in the normal format file is getting downloaded with nothing in it .
I could see some special characters(2 = no of fields) in notepad ,which converts to space in wordpad
The parameters which I am using is .
The module I am using is XML2PLAIN
Par name par value
Tran.class com.sap.aii.messaging.adapter.Conversion
Trav.con type text/plain;charset=utf-8
Xml.addheaderline 0
Xml.conversiontype SIMPLEXML2PLAIN
XML.FIELDFIXEDLENGTHS 25,6
XML.FIXEDLENGTHTOOSHORTHANDLING CUT
Cam some one please help me out from this ..what am I missing in this ?
Thanks.Hi Raju,
Guess this can help u
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f02d12a7-0201-0010-5780-8bfc7d12f891
**Reward points if helpfull** -
Attachment name while sending mail
i want to give attachenemt name as order.pdf while sending the mail with attachment ,i am using SO_DOCUMENT_SEND_API1 function module to send the mail with attacnment
Kranti,
Try the code in this link..
Re: Email
Instead of giving ipacking_list-doc_type as XLS, give it as PDF.
ipacking_list-obj_descr : description
ipacking_list-obj_name : name of the file
Regards
Indu -
Conversion in the receiver file adapter channel
Hello all?
I am trying to implement an RFC to file integration scenario.
My source system is SAP R3 and the destination is an application implemented in Oracle and I don´t have the xsd format of this application.
With the mapping tool I was abble to find out the right structure of the xml destination but something is still wrong .
The xml destination that the XI has to generate is :
<?xml version="1.0" encoding="UTF-8"?>
<ps-persistence version="8.12.1">
</ps-persistence>
But untill now we can only generate the follow xml :
<?xml version="1.0" encoding="UTF-8"?>
<ns1:MT_PS xmlns:ns1="http://cobega.es/Numetrix">
</ns1:MT_PS>
==================================
How can I transform the generated xml in order to get the appropriate xml .
Thanks a lot for your reply1. Create a Java Mapping that will do a replace of your tags.
2.
<?xml version="1.0" encoding="UTF-8"?>
<ps-persistence version="8.12.1">
</ps-persistence>
Create your own xsd in XML Spy or other XML editiors and use it in the mapping. Instead of your MT_PS -
Keep attachments in receiver file adapter
Hello,
We receive via Abap proxy a txt file by attachment, and we need to archive that file in other machine using a receiver file adapter but the receiver file adapter doesn´t have any keep attachment option. How can we achieve that?
Thanks!
LuisYes, I thoug that was possible but in fact the attachment is intended to be something that should be not accessed from the integration server and so not mapped.
http://help.sap.com/saphelp_nw2004s/helpdata/en/b6/0b733cb7d61952e10000000a11405a/frameset.htm
I think that the adapter module will be the better choice.
Regards,
Sandro -
Dynamic File name in Receiver File adapter
Hi,
My Scenario is Proxy to File.
I must create filename dynamically in the receiver file adapter by taking the sales order number and divison from the source.
How can i create a dynamic filename? i searched the forum, but i could not get the correct answer,
Please help me out.
Regards
SrinivasHi Srinivas,
> My Scenario is Proxy to File.
> I must create filename dynamically in the receiver file adapter by taking the sales order number and divison from the source.
public String targetFileName(String Sono, String Div, Container container) throws StreamTransformationException
DynamicConfiguration conf = (DynamicConfiguration)container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String MyFileName = sono + div + "<filename>"+".xml";
conf.put(key, MyFileName);
return MyFileName;
File name you can format according to your requirement.
And one more thing for this you have to specify the ASMA properties. For this check the below link step-1 and step-2.
/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
Regards
Ramesh -
Receiver file adapter with attachments.
Hi
I would like to pass a file receiver an attachment from a proxy. I have seen bits and pieces with attachments. I have read that its similar to the mail adapter.
In the module
localejbs/AF_Modules/PayloadSwapBean
module configuration:
Parameter Name: swap.keyName
Parameter Value: payload-name
Has anyone succeeded and would you explain the details?
Thanks in advance
IanHi,
As far as I know, receiver file adapters do not supprt attachments.
You can use the payloadSwapBean to swap the attachment and the actual proxy payload and then send it to the file adapter.
Don't think it will be possible to send both the attachment and the payload to the receiver file adapter though.
Regards
Bhavesh -
Change file extension in receiver file adapter
File to File Scenario
Posted: Sep 11, 2006 3:47 PM Reply E-mail this post
I am working on a File to File scenario.
Source System gives out a file: abc ( with no extension)
We need to archive it as: abc.done
And we need to send it to a FTP server ( receiver File adapter) as abc.txt.
How can I append a file extension when I archive and
how can I change the file extension in the receiver File adapter?
FYI, we are using XI as FTP server so I have created dummy message interface with no mapping.Hi,
If I understood correctly once XI picks up the file it should be archieved as filename.doc and then it should be FTP'ed to a different location with a change in extension filename.txt.
1. To Archive in the sender communication channel you can use OS Commands after prosessing (>=SP14) to rename the file and archive it. Suggested write a batch file which will rename the file and call the batch file from the OS Command of the sender file adapter. You can either use Archive functionaliy of the Sender adapter or you can write one more command in batch file to move the file to different folder. Make sure you are using fullpath while writing batch file.
2. As said use dynamic configuration in a dummy mapping and then get the source file name and change the extension.
http://help.sap.com/saphelp_nw04/helpdata/en/43/03612cdecc6e76e10000000a422035/content.htm
Thanks,
Prakash -
Dynamic Filename on Receiver File Adapter
Hi,
I am running XI 3.0 SP 14.
The scenario is
SAP R/3 (IDOC) > XI (Receiver File Adapter)> FTP Server
There is no mapping on the XI side, we just drop the IDOC XML on to the ftp server.
I would like to configure a dynamic file name on the Receiver File Adapter where if the 'MSATZ' Field
within the E1EPD04 segment of the IDOC is populated then I would like to send a separate
Filename than the one specified on the 'File Name Scheme'.
Has anybody done this or any suggestion how I should go about this please.
Thank you.
Warm Regards,
RanjanHi Guys,
When I tried to create the User defined function as below, I got the Null value for the "StreamTransformationConstants.DYNAMIC_CONFIGURATION" object.
My code looks like this,(this is part of the debuging code)
Start
public String Create(String a,String b,Container container){
if (container.getTransformationParameters() == null)
return "conf.null";
if (container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION) == null)
return "Dynamic.null";
return b;
--End
On the output I get the value "Dynamic.null". I do not know why the object value is Null.
Any suggestion pls.
Thank you.
Warm Regards,
Ranjan
Maybe you are looking for
-
How to write single line text file
Hi, I need to write a single line text file using oracle forms 10g that's usually quite long 8million+ characters, I looked into utl_file but came accross the single line limit, is there any way to do this either to the client pc or to the server Tha
-
Guys, I'm looking for a link to install Oracle 10g Analytic Workspace Manager 10.1.0.4. Can someone help me with the link?. Thanks, Bhagat
-
Blatent error with Schema Validation Mode
I'm using the XDK v10 Beta and am having severe issues with what I consider to be the valid addition of a node and what the document considers to be valid. If I use the XMLElement.canAppendChild() method, often false it returned even when it is allow
-
Certification Query: SAP Certified Associate Enterprise Architect
Hi Gurus I am planning to take "SAP Certified Associate Enterprise Architect" certification exams during this Teched. Kindly enlighten me the study materials, pre requsites, scope of certification, and any additional information on the same will be h
-
One library split between multiple drives?
I'd like to have about 1/3 my library on my laptop, and leave the rest on my external drive, so that I have some music available when I'm travelling, but don't fill up my (small) laptop drive. I know I can just move some of the files in Windows Explo