TargetFilename in the Outbound File Adapter
Hi all,
I have created an interface that sends projects form SAP PS (by tRFC) to a file directory (using an outbound file adapter). Each project is created as a individual file. All this works well, but the filenames created for the files are not very intuitive for the users looking at the files at the receiver point since there are quite a lot of similar files only distinguished from each other by a timestamp (usualy only separated by milliseconds).
Is there a way to make the file adapter append data from one XML tag in the file name? I.e:
file.TargetFilename='<project></project>'.txt
file.writeMode=addTimeStamp
giving i.e a file '1234567_timestamp.txt'
This way I can include i.e. the project number + timestamp as filename making it user friendly for the people using the files.
Any suggestions will be appreciated.
Best Regards
Odd Hilt
HI
Read the file without using key field. Just define the FCC parameters Header and Items PI will pick the file.
DT_Source
Record
Header 0..1
PO_Number String 0..1
Items 0..unbounded
Items String 0..1
Do the FCC
Header.fieldnames PO_Number
other config for Header
Items.fieldnames Items
other config for items
Thanks
Gaurav
Edited by: Gaurav Bhargava on Nov 12, 2008 10:27 AM
Edited by: Gaurav Bhargava on Nov 12, 2008 10:27 AM
Similar Messages
-
Get the filename after an outbound file adapter operation
Hello,
I am calling an outbound file adapter operation in BPEL (10.1.3.3) - using a filename mask with a sequence (i.e. po_%SEQ%.xml). I would like to provide the filename created at run-time (i.e. po_123.xml) to my BPEL process so I can send this in an e-mail. Is this possible?
Thanks in advance!
Rod
Message was edited by: Rod - fixed a typo
Rod TunnelsWell, I took a different approach - which looks like it will work. Instead of letting the adapter decide the filename - I'm generating that in BPEL and passing that to the adapter using the header variable. So ... nevermind. ;-)
-
Dynamic file names in outbound file adapter
I have to configure a flow in XI system wich takes an input file from one machine and after mapping process leaves the output file in target machine with the same name of input file.
Name of input file won't be always the same (*.dat) so i cannot hardcode this name in outbound file adapter.
Does anyone know how to transfer input filename from inbound file adapter to XI message and then to outbound file adapter?
I know there is an option to create dynamic file names in file adapter but i think it isn't enought to solve my problem.I have to configure a flow in XI system wich takes an input file from one machine and after mapping process leaves the output file in target machine with the same name of input file.
Name of input file won't be always the same (*.dat) so i cannot hardcode this name in outbound file adapter.
Does anyone know how to transfer input filename from inbound file adapter to XI message and then to outbound file adapter?
I know there is an option to create dynamic file names in file adapter but i think it isn't enought to solve my problem. -
Append functionality in Outbound File Adapter
Hi all,
I have a question regarding append functionality in outbound file adapter.
When I append files for example I get a XML file with different XML files in one file, but is it also possible to collect and bundle the files and get a same result when u use BPM?
Do I have to add some parameters?
Kind regards,
Kamran VakiliIt is not possible, when you append XML files.
The result XML file is not valid, as you have multiple declarations and root tags.
The append mode for the file adapter should be used only for flat files.
Regards
Stefan -
Hi,
I need some help in configuring file adapters:
Process: I have a inbound adapter where i am feeding 4000 - 5000 rows of data from a flat file. I use these records to query a database and get response. I have a outbound file adapter where I write database response to a file.
Problem: I have set the, write new file to 100 records. But if there are 3950 records going to outbound file adapter, It is only writing 3900 records in the output file directory.
I need to write all records to the file. Please help me achieve this.
Thank You
AnilHi,
the batching criteria (100) is not met.
You could improve the bahaviour by setting "Elapsed Time Exceeds" parameter, but still, there are some probs because critaria is only evaluated on invocation (anyone has an answer to that?!):
from Doc:
Elapsed Time Exceeds: Specify a time which, when exceeded, causes a new outgoing file to be created.
Note:
The Elapsed Time Exceeds batching criteria is evaluated and a new outgoing file is created, only when an invocation happens.
For example, if you specify that elapsed time exceeds 15 seconds, then the first message that is received is not written out, even after 15 seconds, as batching conditions are not valid. If a second message is received, then batching conditions become valid for the first one, and an output file is created when the elapsed time exceeds 15 seconds. -
How write the Outbound file name in the Inbound file
Friends,
I have a scenario like this.
Outbout filename - sample.txt
In sample.txt, i have having data like 20
Inbound filename - vivek.txt
i need data the like sample, 20
(NOTE: sample is the outbound file)
How to get this scenario.
Thanks in advance.
regards,
Vivek.Hi Vivek,
If your PI is of SP14 and more you have an option called Adapter Specific Message Attributes.(ASMA) in communicatoin channel configurtaion, Which will help you in capturing the Sender file name during runtime.
So you will have to enable that option (ASMA) in Commchannel and capture file name in UDF using Java Code with the help of sap related API and map it to the target field which u would like to get populated.
follow the thread it has the discussion about acessing the Source file name.
Re: Getting file directory using dynamic configuration:Code needed
Thanks,
Ram. -
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 -
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 -
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 -
Duplicate message handling in the sender file adapter
Hi,
I enabled duplicate file handling check in the sender file adapter so that whenever there is a duplicate file it should send me an alert also it should disable the channel so that i do not get that duplicate file alert message again and again.
My question is will it activate the channel again as soon as a new file arrives or do i need to manually do that.
Michal's PI tips: Duplicate handling in file adapter - 7.31Hi Hema,
You will have to activate the channel manually. The idea behind the 'disable' functionality is to avoid further file processing through that channel which can only start once the channel is activated again manually.
Regards,
Abhishek -
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 -
CUT parameter in the content conversion of the Receiever File Adapter
Hi,
I have mentioned the CUT parameter in content conversion in the receiver file adapter, it is working fine. The only problem is it inserts one blank line in the file. Is there any way to remove this blank line other than running script.
Your help is appreciated.
Thanks,
PrateekHi Prateek,
If your File Content COnversion is Row Level(not in field level)?
i.e fieldSeparator = 'nl' if so try like this-
endSeparator = 0
Hope it will remove the blank line.
Regards,
Moorthy -
How can I extend the JCA File Adapter
I would like to extend the JCA File adapter. I want to overcome the file size limit of the File Adapter.
I want to the JCA Fileadapter to have the following functionalites.
1. Split a file into smaller chunks, The chunk size will be set at design time and will be in bytes, an example would be split the file into 500K chunks.
2. Each file chunk will contain a Correlation Identifier and Message Sequence identification fields so it can be rebuilt by the receiver.
Is the beat approach is to write my own JCA File Adapter if I do how do I incorporate it within Jdeveloper?In short, you will have to do the following:
1. Develop an adapter which is compliant to JCA 1.5 spec. You should be able to run that as a web application within the OAS.
2. It should create a WSDL which is adhering to the WSDL Spec 1.1. Then JDeveloper will consume the same without any issues during the design time.
Alternately,
You can check with Oracle with the new featuren requrest for enhancing the File adapter. -
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.
Maybe you are looking for
-
Install and uninstall of dmg file using Apple script in Mac 10.6 and higher version.
Hi , Could anyone please help me to write a Apple script to Install dmg file and do clean uninstall in Mac 10.6.8 and higher version. My requirement is: When i run script : it has to install the dmg file which is located inside one desktop folder say
-
Can i input a Video or Tv signal into my laptop to burn to DVD?
I Want to know if i can record out of our sky plus box into my laptop and burn to DVD.
-
I am using invoke-webrequest command to load a file on server with POST command, and the file does get loaded. However the command hangs in console until I hit enter. Here's what I m executing: Invoke-RestMethod -Uri $url -Method POST -ContentType $
-
ABAP Keyword documentation is not working
Hello experts, When I press F1 on a key word the window for the documentation is coming up, but it is empty. I think it is question of some kinda settings. Could anyone help me to solve the problem?
-
Hi, How can we know that lock objects has been created for table or particular records.. Naveen M.