File Adapter Name Generation
Hi,
I have to send the data to outbound file adapter.
My message contains the Vendor Name.
Can I create the file name dynamically by using the vendor name which is available inside the message?
Please treat this as very urgent.
Thanks
Mohan
Hi,
please take a look at this post:
Re: Renaming file at receiver end
Regards,
michal
Similar Messages
-
File Adapter: Name of file based on payload
Hi everybody!
In my scenario I need to create a file whose name is based on a field in the payload. I. e. the payload concerns production order 123456 and the resulting file should be named "123456.txt".
How can I do that?
Regards, JoergHI
That means your file name would be decided at run time . so u can use adapter specific mesage attributes in ur communication channel
please refer tto the same here
/people/william.li/blog/2006/04/18/dynamic-configuration-of-some-communication-channel-parameters-using-message-mapping
Dynamic File Name Part 1
/people/jayakrishnan.nair/blog/2005/06/20/dynamic-file-name-using-xi-30-sp12-part--i
Dynamic File Name Part 2
/people/jayakrishnan.nair/blog/2005/06/28/dynamic-file-namexslt-mapping-with-java-enhancement-using-xi-30-sp12-part-ii -
File adapter don't want to ignore the header row in file
Hi gurus!
In my sender communication channel I specified Document Offset = 1 to spent the first row in file(header)
But it doesn't work.
Do you have any ideas?Under Document Offset, specify the number of lines that are to be ignored at the beginning of the document.
This enables you to skip comment lines or column names during processing. If you do not make an entry, the default value is zero lines.
http://help.sap.com/saphelp_nw04/helpdata/en/2c/181077dd7d6b4ea6a8029b20bf7e55/frameset.htm
But in Receiver File adapter
NameA.addHeaderLine=0
is used to have no Header line in the target structure
http://help.sap.com/saphelp_nw04/helpdata/en/2c/181077dd7d6b4ea6a8029b20bf7e55/frameset.htm -
Change status(Active/Inactive) of file adapter by the external command
Hi, all.
Is it possible to change status(Active/Inactive) of file adapter by the external command?
Let's say, like
"$ switch_file_adapter_status.sh <File Adapter name> <active|inactive>"
or something like that.
Actually, we have the following requirement for the file adapter.
For example, we have many "file adapter to R/3" scenarios and we only want to allow data transfer between 9:00 a.m. to 9:00 p.m.(R/3 service time).
In order to achieve this requirement, one option would be to switch file adapter status between active and inactive by external command line.
And this command will be controlled by the job scheduler(like Tivoli).
Does XI(3.0 or above) have this kind of feature?
Best Regards.Hi,
I don't think that this is possible.
But one Solution for your problem could be a job on xi who execute the Queue.
So that Adapter work the hole time and send the Message to XI Queue which process them not automatically.
And the XI Queue you can trigger with a Job like normal R/3 Jobs.
Hope that helps,
Regards,
Robin -
Dynamic File Name for Receiver File Adapter
Hi All,
How can we use dynamic name for Receiver file adapter?
Can anyone help.
Thanks in Advance
ChemmanzHi Chemmanz,
The dynamic filename generation concept is as follows.
In your filename field. just give a variable with % symbols. (eg: %file% ).
Now, under the option Variable Name Substitution, you can give how the value has to be created.
It can be your interface name, sender service name, etc or it can be some value dynamically from your payload.
For the former, your give
message:interface_name ,etc
and for the payload part you give,
Payload: "your element root which u wanna acecss"
Just check this link out,
http://help.sap.com/saphelp_nw04/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/content.htm
And read the contents under variable substitution and it will help you understand the concepts better.
If you have any clarifications, do get back,
Regards,
Bhavesh -
Changing the file name dynamicallly in file Adapter
Hi i want to change the file name directly from Java Mapping in the file adapter
for this i have written this code
DynamicConfiguration dynamicConfiguration = (DynamicConfiguration)map.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey keyFile = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
DynamicConfigurationKey keyDir = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","Directory");
dynamicConfiguration.put(keyFile,fileName);
dynamicConfiguration.put(keyDir,outputpath);
but it gives a null pointer exception at dynamicConfiguration.put(keyFile,fileName);
please suggest.
regards
Nilesh Taunk.Hi Nilesh,
If your requirement is to create , the file name dynamically for your receiver file adapter, you can do so using your <b>FILE ADAPTER CONFIGURATION</b> itself, and need not go for any JAVA Mappping / Java Code at all.
The dynamic filename generation concept is as follows.
In your filename field in the receiver file adapter, just give a variable with <b>%</b> symbols. (eg: %file% ).
Now, under the option <b>Variable Name Substitution</b>, you can give how the value has to be created.
<b>It can be your interface name, sender service name, etc or it can be some value dynamically from your payload.</b>
For the former, your give
<b>message:interface_name</b> ,etc
and for the payload part you give,
<b>Payload: "your element root which u wanna acecss"</b>
Just check this link out,
http://help.sap.com/saphelp_nw04/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/content.htm
And read the contents under variable substitution and it will help you understand the concepts better.
Also, in your FILE Adapter under the option FILE CREATION MODE, you have options like,
1.Add Counter,
2. Append
3. Create
4. Add Time Stamp
If you have any clarifications on this approach, do get back.
Regards,
Bhavesh -
File Adapter - Create File Name from Payload
Hello,
I have a scenario where I'm sending deductions to external vendors (wage types) following a payroll run, via XI. Part of the message payload includes a data element 'Vendor Name' (e.g. Zurich Insurance). When the XI File Adapter creates the file, I want to create the files as /usr/file/xi/<Vendor Name>.csv
How to I pick up the 'Vendor Name' from the message payload and pass this into the "File Name:" field of the "File Access Parameters in the File Adapter communication channel configured?hi,
The dynamic filename generation concept is as follows.
In your filename field. just give a variable with % symbols. (eg: %file% ).
Now, under the option Variable Name Substitution, you can give how the value has to be created.
It can be your interface name, sender service name, etc or it can be some value dynamically from your payload.
For the former, your give
message:interface_name ,etc
and for the payload part you give,
Payload: "your element root which u wanna acecss"
Just check this link out,
http://help.sap.com/saphelp_nw04/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/content.htm
And read the contents under variable substitution and it will help you understand the concepts better.
If you have any clarifications, do get back,
Regards,
Bhavesh -
File name in sender file adapter
Hi,
Our ftp server is sending the file names as:
AP_INV_<i>nn</i>.XI.<i>sss</i>.<i>xxx</i>.D<i>yyyymmdd</i>.T<i>hhmmss</i>
where nn sss xxx yyyymmdd hhmmss are all variable. The only fix part is AP_INV_ & XI. I tried AP_INV_* but it does not work. I tried AP_INV_.XI... but it also does not work.
Any idea here please !!!!Hi Dehra,
Check these thread. It may help you:
File name modification in a File adapter
Regards,
Subhasha Ranjan -
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,
VamsiHi 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 -
Setting dynamic file name in Receiver file adapter - not from payload
Guys I just remember reading a weblog but can't find it now that I need it, on how to set the file name in message mapping dynamically but not using any payload field.
Please let me know if you remember this.
Thanks a lot,
Viktor Vargaalso u can check in
<a href="/people/jayakrishnan.nair/blog/2005/06/28/dynamic-file-namexslt-mapping-with-java-enhancement-using-xi-30-sp12-part-ii file name(XSLT Mapping with Java Enhancement) using XI 3.0 SP12 Part -II</a>
<a href="/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14: The same filename from a sender to a receiver file adapter - SP14</a> -
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 -
Dynamic File name in File Adapter
Hi,
I have a requirement to pass dynamic file name in File Adapter.
Is there any way to pass a variable for the file name attribut in file adapter.
I am looking for some options apart from %yyMMddHHmmss%,%SEQ%...etc
Please suggest if any of you have information on how to put values from a variable to file name attribute in file adapter
regards
SaijuHi Saiju,
Yes there is.
Assign your file name to a variable, let's say 'fileName'.
Now go to your invoke activity(for the specific fileadapter) -> Property tab-> find a property call jca.file.FileName -> in the value field assign 'fileName' variable.
That's it... (assuming you are using 11g)
Arik
Edited by: Arik on Jun 27, 2012 3:12 PM -
Error dynamic File Name in Receiver File Adapter
Hi all,
Dynamic file name for Receiver file Adapter Problem
my multi mapping look like this in design mode
messages
message1
SD01_E
FileName
row
message2
SD02_E
FileName
row
by processing the xml look like this:
<ns2:SD01_E xmlns:ns2="urn:lsv.de/SAP/XXX">
<FileName>L40SA939.xiConstant</FileName>
- <row>
or
<ns2:SD02_E xmlns:ns2="urn:lsv.de/SAP/XXX">
<FileName>L40SA939.xiConstant</FileName>
- <row>
in file receivere adapter i have try this but it dos not work
payload:SD01_E,1,FileName,1
Error:com.sap.engine.lib.xml.parser.ParserException: XMLParser: No data allowed here: (hex) 0(:main:, row:1, col:0)
is there any way to have access to Filename in different root elements??
regards
RalfHi Ralf,
i think, you need for each XML msg (each different root element) a new adapter -> a new IF determination, new rec agreement and a new channel.
Regards,
Udo -
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 -
Reciever File Adapter - Temp File Name Scheme using Variable Substitution
How can I create a temporary file that uses variable substitution?
We are having a problem with files merging when we write files using the "Use Temporary File" setting on the FIle Adapter. So two independent files are merging into a single file. We are not using the "Append" setting.
We would like to use a Temp File Name Scheme that would append the message id onto the temporary file name.
Using variable substitution we created a msgid variable. When added to the temporary file name using %msgid% the temporary file name is created with %msgid% in the name instead of the actual message id. We put the variable into the "File Name Scheme" as well and the end completed file used the message id in the name.
Any Ideas?
Thanks,
MattHI Matthew,
Why are you adding the message id into the temporary file??
I understand that you want the output of the filename to contain message id .. and hence you are using variable substitution for the same.
Temporary file name will anyways get overwritten by the actual file name (here the actual filename will be using variable substituion).
So i suggest to achieve your scenario you can add any name in the temporary file and maintain the desired filename you require as output in the variable subsititution.
Temporary File Name option actually acts as a lock - unlock mechanism from PI side while the file is getting written to the file server so that while PI is writting the file no third party application batch program picks it up.
I hope this helps.
Cheers
Dhwani
Maybe you are looking for
-
when I go on the camera, it is stuck I am not able to take pictures :(
-
My Mac Pro has stopped booting. When I hit the power button, all that happens is that the GPU fan spins like mad; nothing going to my monitors, no chime, nothing. This happens with no peripherals attached, just the displays, mouse and keyboard. Very
-
Compund path or white text ona red background with a drop shadow
I have had business cards printed before with white text on a red background & the white wasn't 'punched out' (compound path) of the red so the white didn't print - the solution I was given was to create a compund path in illustrator before saving th
-
Infinity2 just hanging on web pages
I have started to notice in the last couple of days that I log on to a website and it just hangs.. I keep having to refresh to get it going and sometimes it just takes ages getting web pages to load! If I do a speed test I am still getting 62mb down
-
Evaluate Regular expression complexity
Hi all I've a problem on regular expression usage in my application. I'm using a regular expression to identify objects and fetch them to be served depending on an input string with has to be matched. each object has a property representing a regular