Variable Filename in Sender-Fileadapter
Hello,
i have a question about the possibility to implement the following part of a scenario:
Step 1: An E-Mail with a filename will be sent to the XI
Step 2: There starts an BPM process
Step 3: The XI read the filename from the mail
Step 4: The Sender-Fileadapter gets the filename which was sent by mail
Step 5: The File "filename" is read from the filesystem
Now the question is, how do I get the filename to the configuration of the Sender-Fileadapter?
Can i use variable-substitution? When yes, how?
Do i have to implement an adapter-module?
Is this possible at all? Or do i have to implement the scenario in an other way?
Thorsten
Hi Thorsten,
I feel your assumption is wrong.
>Step 1: An E-Mail with a filename will be sent to the >XI
Step 1: An E-Mail with an attachment with some name will be sent to the XI
>Step 4: The Sender-Fileadapter gets the filename >which was sent by mail
You are assumption that Sender File Adapter is wrong.
Possiblity is that you will read the attachement name from Mail Message(Mail Adapter) using Dynamic Configuration(in mapping) and you can use this name further according to your requirement.
This is what I grasped from your explanation. If any where my understanding is wrong please let me know your exact requirement.
thanks,
Gujjeti
Edited by: Praveen Gujjeti on Apr 23, 2008 2:07 PM
Similar Messages
-
Send Invoice as PDF Attachment with variable Filename
Hello!
We got a requirement from one customer. We should send our invoices as PDF-Attachment via E-Mail but the attachment must have a variable filename. At the Moment we can send invoice as PDF-Attachment but only with a fix filename.
How can we change the filename in our Adobe Forms?
Best Regards
MarkusHi Florian!
Answer 1:
The original Name is Druckdaten.pdf
Answer 2:
Our entry in NAST-NACHA = 1
Answer 3:
I can implement some ABAP-Code
Here some Screenshots:
Configuration of printer E-MAIL:
Best regards
Markus -
PayloadZipBean - variable filename inside the archive
Hi,
I'm using the Adapter-Specific Message Properties in a sender fileadapter to determine the incoming filename, which has variable components (i.e. date and time). After changing the prefix and suffix in a Message-Mapping the new name is applied in a receiver fileadapter. The new name is now part of the payload in the tag <Filename>. The receiver fileadapter contains the PayloadZipBean to compress the output file, everything works fine.
Now I want the file inside my compressed archive always to have the same name as my archive has. In Stefan Grube's blog about the PayloadZipBean I only found the possibility to choose a fix name by using the MessageTransformBean (name="file.txt").
Example:
1. variable input filename: IN_RNK_20080227_1006.txt
2. filename after Message-Mapping: OUT_RNK_20080227_1006.gz
3. archive filename after receiver adapter: OUT_RNK_20080227_1006.gz
filename inside the archive: MainDocument (this is the default (payload-name))
I would like to name the file inside the archive OUT_RNK_20080227_1006, too.
Question 1: Is there any possibility to read out the mapped <Filename>-tag from the payload to use it for the element inside my archive (File Name Scheme and Variable Substitution don't work when using Adapter-Specific Message Properties).
Question 2: Is there a way to modify the name of the payload so that I can change "MainDocument" to "OUT_RNK_20080227_1006"?
I'm on XI 3.0 - SP19.
Many thanks,
Ralph>
Stefan Grube wrote:
> In this thread there is a module for reading the content type and setting the dynamic configuration:
> sender mail adapter - attachment name
> It should be not be so difficult to derive the reverse way
Thanks for this info Stefan.
[Stefan Grube's webinar on custom adapter module development|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/64a6bdab-0c01-0010-079a-b3707717cecd?prtmode=navigate]
The code of the EJB module we had to write to get the filename from the Dynamic Configuration (ASMA) and then set the content type of the message is given below.
* Created on Apr 23, 2008
package zfilezipper;
* @author Krishneel Goundar
import javax.ejb.CreateException;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import com.sap.aii.af.mp.module.*;
import com.sap.aii.af.ra.ms.api.*;
* @ejbHome<{com.sap.aii.af.mp.module.ModuleHome}>
* @ejbLocal<{com.sap.aii.af.mp.module.ModuleLocal}>
* @ejbLocalHome<{com.sap.aii.af.mp.module.ModuleLocalHome}>
* @ejbRemote<{com.sap.aii.af.mp.module.ModuleRemote}>
* @stateless
public class SetContentTypeEJB implements SessionBean, Module{
private SessionContext myContext;
public void ejbRemove() {}
public void ejbActivate() {}
public void ejbPassivate() {}
public void setSessionContext(SessionContext context) {
myContext = context;
public void ejbCreate() throws CreateException{}
public ModuleData process(ModuleContext moduleContext,ModuleData inputModuleData) throws ModuleException{
try {
Message msg = (Message) inputModuleData.getPrincipalData(); //Used to read dynamic configuration data
TextPayload payload = msg.getDocument(); //Used to set 'contentType' value
//The name of the file to be zipped is read from the dynamic configuration.
String fileName = msg.getMessageProperty("http://sap.com/xi/XI/System/File", "FileName");
if(fileName == null) //If no file name can be determined we set 'contentType' to "defaultbeanile.txt"
payload.setContentType("text/plain;charset = \"UTF-8\";filename=\"defaultbeanfile.txt\"");
else //If a file name can be found we set 'contentType' to the name of the file.
payload.setContentType("text/plain;charset = \"UTF-8\";filename=\"" + fileName + "\"");
//After setting the value of 'contentType' we need to update the ModuleData object (inputModuleData).
inputModuleData.setPrincipalData(msg);
} catch (Exception e) {
ModuleException me = new ModuleException(e);
throw me;
return inputModuleData; //Return the updated ModuleData object.
Edited by: Charu Kulkarni on Apr 28, 2008 1:41 AM -
Value of user variable passed in sender/receiver queries
Hello experts,
I have to BEx queries, one sender and one receiver, I linked them in RSBBS
The problem is that I have InfoObject 0FISCPER as a user variable in the sender query and I fill it with for example "avril 2010" but in the receiver query 0FISCPER is also a user variable but it always receive "#" as value, other values are passed without problems
Regards,
Thibault JacobsHI Thibault,
Try making the User input variable a Mandatory one and then Check ,it shud work.
Hope u have made the necessary settings in RSBBS and activated it.
Rgds
SVU123 -
The variable $filename and the the *.fm extension
When you need the title of the document importing into a document, you can use the variable <$filename>.
This is useful as you can have a template that changes its name with the name of the file.
However, the variable always writes the document name with the file extension (for example help.fm) making the variable useless.Gareth,
Please also enter a feature request using the official request route via Bugbase & Wishlist and provide some use cases. -
Putting filename in sender adapter
hi all XIs
here iam dealing with file to file.
how i can get the same file name at reciever as like sender file name.
if we put file name at source side under file acess parameters and at the same time if we put same filename at reciver side under file acess parameters then we can achieve same file name at reciver directory in reciever side server.
if this is the case then what is the use of setting adapter specific message atributes on sender,reciever side.
waiting for u r answer.
bye .
regards.
seeta ram.Hi Seeta Ram,
In the sender file adapter ,
you select Adapter Specific Message Attributes and check Filename.
Now you can access this file name in mesasage mapping.
you need to create an extra field in your target message that should not be passed in the target file.
pass this file name in this target message field using an UDF.
and in target comm channel, enable variable substitution and declare a variable as shown in the following link.
/people/jayakrishnan.nair/blog/2005/06/20/dynamic-file-name-using-xi-30-sp12-part--i
In case you need any more help, just let me know.
you can put the follwing code in udf to access the file name.
String FileName;
DynamicConfiguration conf = (DynamicConfiguration)inputparam.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
FileName = conf.get(key);
return FileName;
Regards
Pushkar
Message was edited by:
pushkar anand -
Custom Filename for ESB FileAdapter Write
Hi,
I have a ESB service that monitors and deqeues from the oracle.apps.po.event.xmlpo business event via the Oracle Applications adapter. This works fine as the WF_EVENT_T schema is routed via an XSL to a custom XML which is used later.
However, I want the file to use a custom filename with the file adapter. In principle I know how to do this using the ehdr:setOutboundHeader functionality and have got this to work when setting a static filename.
However, I want to be able to create the filename based on the Purchase Order Number coming from the WF_EVENT_T schema. It seems that the ehdr:setOutboundHeader function has to be set before any of the XML Template matches, which means at this point the Purchase Order number is not available. Below is the main parts of the XSL.
<xsl:variable name="CustomFilename" select="'/ns2:PONo"/>
<xsl:variable name="AssignFilename"
select="ehdr:setOutboundHeader('/ns1:OutboundFileHeaderType/ns1:fileName',$CustomFilename,'ns1=http://xmlns.oracle.com/pcbpel/adapter/file/Capture_PO_Event_Data/;')"/>
<xsl:template match="/">
<ns2:HCNPOWFEVENT>
<xsl:for-each select="/imp1:WF_EVENT_T/PARAMETER_LIST/PARAMETER_LIST_ITEM">
<xsl:if test='NAME = "DOCUMENT_NO"'>
<ns2:PONo>
<xsl:value-of select="VALUE"/>
</ns2:PONo>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="/imp1:WF_EVENT_T/PARAMETER_LIST/PARAMETER_LIST_ITEM">
<xsl:if test='NAME = "ECX_TRANSACTION_TYPE"'>
<ns2:POType>
<xsl:value-of select="VALUE"/>
</ns2:POType>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="/imp1:WF_EVENT_T/PARAMETER_LIST/PARAMETER_LIST_ITEM">
<xsl:if test='NAME = "ECX_TRANSACTION_SUBTYPE"'>
<ns2:POSubType>
<xsl:value-of select="VALUE"/>
</ns2:POSubType>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="/imp1:WF_EVENT_T/PARAMETER_LIST/PARAMETER_LIST_ITEM">
<xsl:if test='NAME = "ECX_PARAMETER5"'>
<ns2:OrgId>
<xsl:value-of select="VALUE"/>
</ns2:OrgId>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="/imp1:WF_EVENT_T/PARAMETER_LIST/PARAMETER_LIST_ITEM">
<xsl:if test='NAME = "ECX_PARTY_ID"'>
<ns2:ECXPartyId>
<xsl:value-of select="VALUE"/>
</ns2:ECXPartyId>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="/imp1:WF_EVENT_T/PARAMETER_LIST/PARAMETER_LIST_ITEM">
<xsl:if test='NAME = "ECX_PARTY_SITE_ID"'>
<ns2:ECXPartySiteId>
<xsl:value-of select="VALUE"/>
</ns2:ECXPartySiteId>
</xsl:if>
</xsl:for-each>
</ns2:HCNPOWFEVENT>
</xsl:template>
</xsl:stylesheet>
Any ideas on how this can be achieved ?Ok I was able to get fileadapter filenames modified.
First you cannot do this after a dbadapter query as that functionality seems to be broken. The best way to solve it for me was to simplify the problem, I started with placing the setoutbound header data after reading a simple file and ignoring the files content altogether. I do the set inside a match of the xslt using a constant value, again for simplicity. For the test just put in 'ateststring.txt' in the setoutbound header call, no need to select data from the document at this point; we will get to that. Now get that to work.
Once you have that working take a value from the incoming document and select it into a variable named myvariable then replace the 'ateststring.txt' with $myvariable. So basically its a three step process for the final solution. Select the data of interest from the document into a variable. add a select statement to make the method call just after that. Make the method call inside the select statement and prepend the variable name with the $ symbol.
So far I have only tested this file to file and file to ftp, I suspect that jmsadapter to file will work fine too. So the trick for me was to understand that if an incoming document is the result of a query that just wont do. My requirement was to take an input JMS request, use that to drive a query, take the data from the query and write it to a filename as defined in the JMS request. No matter what I did to set the frustrating fileadapter/ftpadapter filename in the header I was unable to do so. I used constant strings etc in every part of the document ( before select, inside select, outside select etc ). It wasnt until I went file to file that I was able to get this to work at all. And then not in the xslt header etc, it MUST be in an area of the document that resulted in a select match, which after review makes sense.
To work around the query to file issue, I place the results of the data query into a temporary filename%SEQ%.tmp, along with the query results I add the real filename inside the document. I have a file listener that listens for the filename using wildcards filename*.tmp, it takes the file reads it in, pulls the permanent filename from the incoming document, and sets that filename in the header using the steps worked out above by selecting the filename into myvariable.
You cannot ( to my knowlege ) store variables in ESB so I found I had to put them inside the documents to move the data around. When I am all done with the work through the routing service I strip out the variable data fields that I needed to carry along with the data.
Please let me know how you are going with this, I hope this saves someone else a bit of frustration.
Thanks again,
John -
FileName in Sender File Adapter Module
Hi Folks,
In my sender file adapter have written a module to read the picked file name. The protocol used is NFS.
Notice that the file name read in the module has the absolute path, including the directory path. E.g The file name xyz has to be picked from source directory
XIServer\Outbound. In the module when I retrieve the file name, it comes up as
XIServer\Outbound\xyz. Is this expected behaviour?
I was expecting just the file name<xyz> to be retrieved.
Thanks,
AnandHI,
Create an UDF and write this code.
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key =
DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String ourSourceFileName = conf.get(key);
return ourSourceFileName;
in Adapter u will have Adapter specific parameters check the file name check box.
Using this UDF u will get the file name at target side.
Regards,
Phani. -
Sender FileAdapter (Scenario)
Hi Here is my Scenario ,
i need to pick up file of any type (.txt , .pdf,.jpeg)
i donot want the content of the file to be as payload, i need only the file name as the payload.
For this i have checked the : Adapter specific configurations , filename in the Sender File Adapter.
Now i see in the sxmb_moni that the payload throws a error of kind mapping.
wat couls be the problem. any view how to get filename in payload alone.
advice , any links
sriniHi Farooq,
i have created a Adapter Module , well deployed it in the NWDS and could see the same in Visual Admin.
Now when i use locaejbs/JNDI-Name
( it throws a error --> Error: java.lang.ClassCastException: class com.sap.zfilename.Zsrinifilename_finalLocalHomeImpl0_0 can not be casted to ModuleLocalHome or SModuleLocalHome)
So i heard from many saying to remove the .jar files from .ear, i donot which file exactly should i delete from .ear file
XsriniFile_FinalProj.ear
I have following files :
Manifest.mf
Sap_manifest.mf
sda-dd.xml
aii_adapter_xi_svc.jar
aii_af_cci.jar
aii_af_cpa.jar
aii_af_mp.jar
aii_af_ms_api.jar
aii_af_ms_spi.jar
aii_af_trace.jar
aii_util_misc.jar
aii_util_xml.jar
ejb20.jar
exception.jar
application-j2ee-engine.xml
application.xml
XFileName_final.jar
I was said to delete extra librarf files and then deploy , what all the file should i delete and deploy.I deleted hilighted one and tried to deploy but it thows error as follows: -
File receiver adapter with the same filename than sender
Hi guys,
I am experiencing a problem when I use the <b>Adapter Specific Message Properties</b> to be able to receive a file with the same name as the sender.
I've been following the example of Michal Krawczyk (XI: The same filename from a sender to a receiver file adapter - SP14) but i get a problem related with the content converter parameters.
The error I receice in the File Adapter is the next:
<i>Could not process due to error: java.lang.Exception: Exception in XML Parser (format problem?):'java.lang.Exception: Message processing failed in XML parser: 'java.lang.Exception: Consistency error: more fields found in XML structure than specified in conversion parameters!</i>
I have been trying to do all the combinations with the content conversion parameters but the result is allways the same, MORE FIELDS FOUND IN XML ....
My XML structure is the next:
<ns0:MT_MDFranceN xmlns:ns0="urn:s-n:HR:MasterDataFrance">
<lines>
<line>
<header/> 1..1
<data/> 0...unbound
</line>
</lines>
</ns0:MT_MDFranceN>
In the header I write the name of the file with the code provided by SAP and Michal, so the name of the file is stored there.
any help?
Thanks!!!!!I have changed the XML because, as you said, there is no need to introduce the filename inside the payload. Now the structure is the next:
<i><?xml version="1.0" encoding="UTF-8"?>
<ns0:MT_MDFranceN xmlns:ns0="urn:s-n:HR:MasterDataFrance">
<lines>
<line>
<data/>
</line>
</lines>
</ns0:MT_MDFranceN></i>
Record Structure: lines,line
line.addHeaderLine 0
line.endSeparator 'nl'
lines.fieldSeparator 'nl'
line.fieldFixedLengths 1300
A sample of the payload is the next:
- <ns0:MT_MDFranceN xmlns:ns0="urn:s-n:HR:MasterDataFrance">
- <lines>
- <line>
<data>EDI_DC40_U5300000</data>
<data>E2HR_HD001 530000000000007802</data>
<data>E2HR_KY001 530000000000101TS 20070104000010 20070129</data>
000000601</data>
</line>
</lines>
</ns0:MT_MDFranceN>
And..... I still have the same problem, the same message in the file adapter:
<b> 'java.lang.Exception: Consistency error: more fields found in XML structure than specified in conversion parameters</b>
Any idea of what can be the problem?
thank you very much!!! -
File-to-file scenario: no mapping, filename from sender file
Hi all,
file-to-file without mapping.
we want to use XI to transport just files from XI file directory to another ftp-server (+ archiving on xi file directory)
we configered an sender file adapter that picks the file up, but
we have problems configuring the receiver adapter in that way that the filename or the original file is used
Is that possible? with which parameter settings
filename is not content of the XI message content so "message:FileName" doenst work
Thank you very much
regards
HansHi Hans,
Check this link:
How to send any data (even binary) through XI, without using the Integration Repository
OR
Copy a file with same filename using XI
Sachin
Edited by: Sachin Dhingra on Nov 7, 2008 8:19 PM -
How to put filename of sender message in the Alert?
Hi,
I have a requirement that if the outbound FTP fails to send the file, an Alert should be sent to recepients which has the subject "File [filename] failed to transfer."
How can I achieve this? How do I get the filename of the sender message?
Regards,Hi,
I have a requirement that if the outbound FTP fails to send the file, an Alert should be sent to recepients which has the subject "File filename failed to transfer."
S u can do it.
Please go through these..
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/00e97ba2-85ce-2b10-20bc-bc05cd172154?overridelayout=true
and
http://ww.****************/Tutorials/XI/AlertConfiguration/AC3.html
also
Re: Best practise for Alert configuration
Babu -
Webi - store report in Variable filename.
Hi,
I have BO Webi report say XYZ which is schedule and run on weekdays. once it is refresed I wanted to give name as XYZ_YYYYMMDD.XLs ( where YYYYMMDD is system date).
in CMC there is option to name the report with some extension ( CMS-> Folder->Schedule->Destination and specify filename radio button). but the one I am looking is not available.
is there any way to change the report name with some variable value and store in Excel ?
Your early response would be appreciated.
Regards,
AviYou can select 'Date and Time' when check specify file name. Select 'Title' put an hyphen and select 'Date and Time' and also check 'add file extension'.
-
Variable filename and folder in receiver cc
Dear experts,
On PI, I need to create a (text-) file with a variable name and folder. The scenario is as follows:
idoc-> PI -> txt file
In my incoming Idoc I get the following data:
- directory where the txt file should be saved;
- name that the txt file should get.
How can I realise this in PI? Using variable substitution? As I never done this before, I have a hard time getting this to work...
Please help.
Thanks in advance
WilliamHi,
Use Dynamic Configuration:
Input will be 2 variables var1, var2.
String Name1 = var1;
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key1 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName");
conf.put(key1, Name1);
String Name2 = var2;
DynamicConfigurationKey key2 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "Directory");
conf.put(key2, Name2);
return "";
Maping:
Var1---
UDF----TargetMessageNode.
Var2---
Under ID: Enable ASMA in file receiver adapter and chk FileName and Directory.
and put * under File name and / underTarget Directory(File receiver).
NOTE: U can alter this UDF according to ur req.
Thanks
Amit -
How to use sql variables in jdbc send adapter??
Hi,
i wanna use a variable in the sql statement in the jdbc send adapter.
i know i can key sql statement in the "Query SQL Statement" in the jdbc send adapter.but i dont know how to use variables in the sql statement.
i mean, for example, the sql statement is "SELECT * FROM t_student WHERE READFLAG = 0", but now i wanna instead of "0"(the value of the READFLAG) using a variable.
and if i can use a variable to replace the "0"(the value of the READFLAG above sql statement), then how can i send a value to the variable??
request help in the regard.
thx in advance.
BrianHi,
Use the place holders to pass the data at runtime. Check the below structure for more details.
Hope this helps.
Thanks and Regards,
Kalpesh
<root>
<stmt>
<Student action="SQL_QUERY">
<access> SELECT * FROM t_student WHERE READFLAG = '$FLAG$ </access>
<key>
<FLAG>0</FLAG>
</key>
</Student>
</stmt>
</root>
Maybe you are looking for
-
I have an iPhone 4s. My problem is that I can't see the icon of FaceTime and iMessage. I need to use these apps. What should I do?
-
1st Gen iPod Touch v. Current Gen Model
So, I'm debating about buying an iPod touch to help with time & task management (I'm a bit disorganized), and noticed that Apple has some refurbished models of the 1st generation iTouch for sale at a decent discount. I'm wondering what the difference
-
HT202157 i pluged in my apple tv but it flikering on my tv screen
i plugged in my apple tv but it flickering on my tv screen
-
How do you make the picture you are receiving clear? Whenever my sister and I connect the video I see of her is blurry, is there a way to manuel focus the picture? It seems to get a little clearer when there is more light in the room on her side but
-
I've never had this problem before and I don't think that I have downloaded anything that would affect this issue. I do have the Download Manager Tweak 0.9.2 installed.