Receiver file adapter to handle multiple structure
Hi all,
I have an issue writing file to the file server using receiver file adpater, I am using file content conversion and my file adapter.
My data type of the output file has 3 hierarchy.
header
Item
subitem
for every item ,multile subitem would occur, but i am getting error in the communication channel, the adapter takes the fixed field length of the "Item" and looks for the subitem while writing the file.
Let me know if any one has come across this issue.
thankx in advance,
Shree
Hello!
Is there really no possibility to convert a structure with a deeper hierarchy of 2?
I'm trying to convert a structure like this into a flat csv-file
<root>
<STRUCTURE1>
<value1>value</value1>
<value2>value</value2>
<value3>value</value3>
<STRUCTURE2>
<valuea>value</valuea>
<valueb>value</valueb>
<valuec>value</valuec>
<STRUCTURE3>
<valueZ>value</valueZ>
<valueY>value</valueY>
<valueX>value</valueX>
</STRUCTURE3>
</STRUCTURE2>
</STRUCTURE1>
</root>
I implemented that the values are printed in lines separated by ";". A new dataset is printed in a new line. I'm just missing my headerline. That won't work.
Any idea?
Similar Messages
-
Receiver file adapter posts multiples for singel source files
Hi,
I am using wild character in my input source ftp adapter but my receiver file adapter is creating multiple duplicate files. I am not sure why this happens as QOS is set to "Exactly Once" with archive processing mode. I tried with delete mode and the same error occurs. We had no problems testing it in our Dev environment but in QA its acting so strangely...Any advise is appreciated..
-TeresaHi,
2. Homany files you posted at oubound directory?
1. You said duplicate files at receiver side, is the files having time stamp? if so those are not duplicate files.
Thanks,
Satish. -
How to create multiple files with Receiver File Adapter in SAP PI 7.31 Java Stack
Dear Friends,
I am using Sender JDBC Adapter and Receiver File Adapter in Integration Flow in SAP PI 7.3 EHP 1 SP08 Java Stack environment. The requirement is that we need to create multiple files based on the row count in jdbc resultset. If there are 5 rows in resultset, we need to create 5 XML files with one row elements in one file. Similarly if there are 10 rows, we need to create 10 XML files.
So how can we create multiple files in this scenario. I tried placing a for loop in the Java Mapping as below in the transform method:
DynamicConfiguration conf = arg0.getDynamicConfiguration();
StringBuffer sbFileData = new StringBuffer();
for (int i =0; i < record.size(); i++ {
. // Create XML for each row and Marshal the object into to the String Buffer
String strFileName = "DC_" + new SimpleDateFormat("ddMMyyyyHHmm").format(new java.util.Date())+"_"+i+".xml";
conf.put(KEY_FILENAME, strFileName);
arg1.getOutputPayload().getOutputStream().write(sbFileData.toString().getBytes("UTF-8"));
arg1.getOutputPayload().getOutputStream().flush();
So here I'm flushing the OutputStream for each record. But it's not creating the multiple file, instead it creates only one file will all record XMLs appended to each other.
Please let me know if I missing something or need to do some thing else.
Regards,
Shreyansh ShahHi
You can easily achieve this using graphical mapping. Create your target message type like below
MT_Target
Details 0 to 1
Data 0 to 1
Source sample structure
<resultset>
<row>
<column-name>column-value</ column-name>
</row>
Then do the message mapping like below
map <row> with MT_Target
contant ----> Deatils
column-name ------>Data
In the signature tab of message mapping, choose the occurrence of your target message type as
0 to unbounded.
This will generate multiple files from multiple rows.
Let me know if you have any doubt. -
Multiple Header line in Receiver File adapter
Hi,
I have an issue in Receiver File adapter with multiple header lines. I am able to get only 1 header lines in the receiver file but not multiple header lines with 'nl' since it is static in file mode
[CommunityTag:Header]
empNo,EmpName,Age
[CommunityTag]
I tried with the below in content conversion one as below with no luck
Root.addHeaderLine=1
Root.headerLine=[CommunityTag:Header] 'nl' empNo,EmpName,Age 'nl' [CommunityTag]
Root.fiedSeparator=,
Root.endSeparator='nl'
I am getting the Header line as same row as static text.
Can you advise this.Hi Gabriel, I suggest to produce the header lines from additional nodes in the message payload. That means you need to modify the data type of the target message in order to generate an extra structure in the payload. Use constants in message mapping to generate the header column names, e.g.
<Header>
<H1>CommunityTag:Header</H1>
<H2>empNo,EmpName,Age</H2>
<H3>CommunityTag</H3>
</Header>
In content conversion you have to convert the Header row with
Header.endSeparator='nl'
You won't need parameter addHeaderLine anymore then.
Regards, Martin -
Receiver file adapter creates empty files, Empty-Message Handling SP19
Hello,
We have just upgraded the system to SP19.
One of the new features is that it should be possible to determine how XI messages with an empty main payload are to be handled in the receiver file adapter.
If the parameter Empty-Message Handling is set to 'Ignore' no file should be created if the main payload is empty. In our case an empty file (size 0 kb) is still created even though the main payload is empty and the flag is set to 'Ignore'.
Has anybody experienced the same problem?
// Best regards HansThis should work:
Use your own adapter module that parses incoming message and checks if it has any record sets in the document. If it does not have any record sets, then set the message to empty and then give this modified message to File receiver.
For example, see the example code below:
Module imports..
Audit log import..
DOM imports/SAX imports..
public ModuleData process(ModuleContext moduleContext, ModuleData inputModuleData) throws ModuleException {
try {
// get the XI message from the environment
Message msg = (Message) inputModuleData.getPrincipalData();
AuditMessageKey amk = new AuditMessageKey(msg.getMessageId(),AuditDirection.INBOUND);
Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS,"RemoveRootTag: Module called");
XMLPayload payLoad = msg.getDocument();
Document doc = parseXmlFile(payLoad.getInputStream());
if(doc != null){
if(!doc.getDocumentElement().hasChildNodes()){
Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS, "Document is empty!!");
payLoad.setContent("".getBytes());
msg.setDocument(payLoad);
// provide the XI message for returning
inputModuleData.setPrincipalData(msg);
} catch (Exception e) {
// raise exception, when an error occurred
ModuleException me = new ModuleException(e);
throw me;
// return XI message
return inputModuleData;
private Document parseXmlFile(InputStream xmlpayload) {
try {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(false);
// Create the builder and parse the file
Document doc = factory.newDocumentBuilder().parse(xmlpayload);
return doc;
} catch (SAXException e) {
} catch (ParserConfigurationException e) {
} catch(IOException e){
return null; -
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 -
Process different structure in receiver file adapter
Hi, all XI&PI masters
We have a trouble of processing a file in receiver file adapter, converting to tab deliminated file.
Scenario: Proxy to File
We've configured PI to process following data and we've got flat file successfully.
<ns1:MT_test_s xmlns:ns="http://...">
<recordset>
<data>
<value1>test1</value1>
<value1>test2</value1>
</data>
</recordset>
<info>
<value1>test0</value1>
</info>
<ns1:MT_test_s>
We also want to process a data without <data> structure below.
So we've already set occurence of recordset and zsdata to 0..unbound.
However, we are getting an error from receiver file adapter, since there is the recordset structure.
(No problem if recordset is not included...)
<ns1:MT_test_s xmlns:ns="http://...">
<recordset/>
<info>
<value1>test0</value1>
</info>
<ns1:MT_test_s>
Please help me if anyone know how to solve this problem.
Thank youcreate your target data type without the recordset node.
Then do the mapping from source to target and configure your scenario.
This is the ideal solution
/people/shabarish.vijayakumar/blog/2007/08/03/file-adapter-receiver--are-we-really-sure-about-the-concepts -
Send multiple files in different directories using Receiver File Adapter
Hi Experts,
I have one File to File without ESR scenario where I have to pick multiple files from different directories and to save them in different directories on receiver side.
Can anyne help me to send multiple files in different directories using receiver file adapter.
Is it possible??
Any help will be appreciated.
Regards,
Danishhi ,
that is possiable without esr,
we need to create one sender communication channel , in that we nend to use "adavnced selection for source file " for sending multiple files from multiple directories.
we need to create 'n' receiver communication channels and 'n' receiver agreements based on communication channels .
in receiver determination, provide multiple receivers
In interface determination , provide * symbol for receiver communication components
thanks, -
Save file in multiple directories using receiver file adapter?
Hi,
Is it posible to save file in multiple directories using receiver file adapter?
Regards,
AshishWell, there is a round about way to do that -
The idea is to use multi mapping. 1:n mapping
1) Map ur message to 2 different record set nodes. Since you want to use the same file both the mapping will look exactly the same. make sure that the filepath and filename are a part of the output payload message
2) In the file adapter config. make sure the the file name and file path are from these payload fields. You can use a context object to refer these fields. Voila...the files are created in the 2 direcoties you mentioned.
of course the simplest way is to route the same message to 2 business systems/services and write them out using 2 ccs.,
Arvind R -
Empty Message Handling with Receiver File adapter
Hi,
We were using the "Empty-Message-Handling" (status set to Ignore) of Receiver file adapter to stop a 0 KB file from being written to the specified directory.
However, inspite of this, a 0KB file continues to be written.
The specifications are given below-
File Construction Mode - Add Time Stamp
Put File - Directly
Empty Message Handling - Ignore
Maximum Concurrency - 1
File Type - Binary
Can anyone please help with this.
Thanks and Regards,
ShiladityaHI,
In one of thread the same problem was coming. Just look at the thread.
Receiver file adapter creates empty files, Empty-Message Handling SP19
Or
Follow the weblog for the same requirement.
/people/gowtham.kuchipudi2/blog/2006/01/13/stop-creation-of-an-empty-file-from-file-adapter-using-module
Thnx
Chirag
Reward points if it helps. -
Hi all,
I am trying to convert the XML to Plain file in receiver file adapter. I am using module - StrictXml2PlainBean
My target structure is -
<MT_Name>
<records>
<Header>
</Header>
<Item>
</Item>
</records>
</MT_Name>
<Header> and <Item> are at same level.
When I use --
1. Header.fieldSeparator = ,
2. Item.fieldSeparator = ,
3. recordTypes = Header,Item
Then I get this error -
Message processing failed. Cause: com.sap.aii.af.app.modules.conversion.xml2plain.ConversionException: Invalid structure name encountered during conversion: records at XML element MT_Name,records
When I use --
1. records.fieldSeparator = ,
2. singleRecordType = records
Then I get this error -
Message processing failed. Cause: com.sap.aii.af.app.modules.conversion.xml2plain.ConversionException: The element nesting level for the structure MT_Name is too deep (reference: 3 levels, found: 4 levels) at XML element MT_Name,records,Header,Item
To add more details to the scenario, multiple records can be generated but one record will have only one Header, with multiple Items.
Any help in this regard will be highly appreciated.
Thanks,
AbhiHi Abhi,
Here you go....
For your target structure as:
<MT_Name>
<records>
<Header>
</Header>
<Item>
</Item>
</records>
</MT_Name>
Where I have assumed that <Header> and <Item> are at same level.
DO NOT use any Module just simply configure the receiver channel as below:
In the file Receiver Channel
Recordset Structure = Header,Item
Name Value
Header.fieldSeparator ,
Item.fieldSeparator ,
I have tried this and it works.
Let me know if you are facing any issues.
Cheers
Dhwani -
Creating .RTF output files - PI7.0 Receiver file adapter
Hi Experts,
I am currently facing an issue with the Receiver File adapter where in the output files are required to be of the format of .RTF (Rich Text Format).
The scenarios is an outbound proxy from SAP ABAP - > PI 7.0 -> .RTF File
All the data required to be present in the file will be coming in the source structure
Can the File Receiver Adapter handle this ?
Is there a way to generate Files with extension .rtf ??
It is a requriement since the output files will be used as Reports , and so the desired format.
I am unsure if I will have to use XSLT mapping , in this because i am new to that , Kindly let me know how to go about it ,. any links or pointers on how to achieve the same will be welcome.
thanks
Dev
Edited by: sd on Feb 17, 2010 8:23 AMThanks for your reponse Praveen
Can you please let me know how can i put the extension as .rtf for the output files i am generating ??
as far as the formatting is concerned ... it is like ... the header needs to be of a particular Font , a particular font size , bold etc and so is the case for line items
I am unsure if it is possible using an Adapter module as well
thanks
Dev -
Receiving file adapter content conversion issue
Guys,
Could someone please help me with a Receiving file adapter issue?
My output structure is something like this:
Vendor_file_MT (occurence 1)
--Recordset (occurence 0..unbounded)
Vendor (occurence 1)
Field1
Field2
Field3
Field73
Field74
My content conversion is very simple:
Recordset Structure: Vendor
Parameters:
Vendor.fieldFixedLengths 30,30,30, (...) ,1,27
Vendor.fixedLengthTooShortHandling Cut
Vendor.endSeparator 'nl'
If I don't do the content conversion, it works fine, I get all the fields in the XML format.
When I do the content conversion however, I get multiple lines but only the very first field of each line.
What could be the problem? What am I missing here? Any idea?
Your help would be much appreciated.
Thanks,
ViktorVarga:
Its little strange that its not working even after adding that. Did you check the receiver channel in your RWB for any logs. Add the statement in my previous post and Also try to clear the Cache and activate the channel again..See if it works
Glad it worked
Edited by: Guru on Apr 21, 2008 3:15 PM -
Problem with file content conversion in receiver file adapter
Hi All
I have a problem with file content conversion in receiver file adapter.
This is my recordset structure: Header_Record,1,Claim_Record,*,Check_Rec,1
These are the content conversion parameters:
Header_Record.fieldSeparator = ,
Header_Record.endSeparator = 'nl'
Claim_Record.fieldSeparator = ,
Claim_Record.endSeparator = 'nl'
Check_Rec.fieldSeparator = ,
Check_Rec.endSeparator = 'nl'
In SXMB_MONI, i can see that the data is correctly extracted from proxy, and correctly mapped to receiver message, and i see a checkered flag (success).
But, Adapter status is RED with the following error message:
Conversion initialization failed: java.lang.Exception: java.lang.Exception: Error(s) in XML conversion parameters found: Parameter '1.fieldFixedLengths' or '1.fieldSeparator' is missing
In communication channel monitoring, i get the following error message:
Message processing failed. Cause: com.sap.aii.af.ra.ms.api.RecoverableException: Channel has not been correctly initialized and cannot process messages
What is going wrong here? Can anyone please tell me?
Thanks
ChandraPosted in Incorrect forum.
Posted again in Process Integration forum -
Problem with fixedlenthgs in receiver file adapter
HI,
I am doing XML to flat file scenario and using mutli mapping concept without BPM.
in the receiver file adapter I am using FCC with fixedlengths,then it generated just 3 output files out of nearly 100 source files.the errored one are succcessful in the SXMB_MONI and failing in RWB-->Message moni with waiting status and MDT says that XI_J2EE_ADAPTER_FILE ,Error Code PROCESSING_ERROR .
i tried in SDN and then found something like enable the disablesecurity check box in variable substitution parameters ,then I got 4 files out.
these are my FCC params for all structures:
struc1.fieldFixedLengths
struc1.fixedLengthTooShortHandling
struc1.endSeparator
and I tried with fieldSeparator then it gives successfully all output files.
so,where is the problem?I didnt understand?
any suggestion.
thank you,
regards,
Babu SriBhavesh,
I felt the same way,but assumed that ,in that way fixedlenghths wont work.
in my target structure most of the fields have 0-1 occurences ,and even in the source structure too.so,I think it might be the reason.Then I have to make all my about 60fields 1-1 madatory and using mapWithDefaultValue function, as my sources are optional.
you think it will work just using the "mapWithDefaultValue" function without changing my occurences to 1-1 in the target structure(mandatory)?infact I can try but ,cos of pain for changing like 60 fields....:) and even dont know which fields are causing the problem,so that we can apply "mapWithDefaultValue" function only on those fields.
thank you,
Babu Sri
Maybe you are looking for
-
How to fetch data in Excel throuth oracle forms 10g on client machine
I am using developer suite 10g forms and i want to fetch data in excel through forms 10g on client machine presently i m using OLE for fetching the data in excel , it is working fine but it generates the excel file on server machine and i want get th
-
TimeMachine migrates to the wrong date. How do I specifiy which date to migrate from?
Recently, my MacBook Pro 2011 unibody, 10.7.5 crashed due to bad sectors. After installing a new a hard drive, I preformed a restore via the migration assistance. It all went well except that it restored to not the latest date. The cause of this is w
-
Hi, I am designing and implementing OGG to replicate a set of about 200 tables from a master system to two target systems. Updates to these tables only occur on the master system so this is a 1:n uni-directional situation. The master and target syste
-
How to set up guest password?
I still cannot figure out how to set up a guest password on my wireless network. I'm trying to use 192.168.1.1 but dont see an obvious place to set the information. And do I have to connect to router to the laptop before making the changes?
-
Menu bar lags in appearing after I boot up my cpu (brand new macbook pro retina display 13"
I just bought a new cpu and i noticed that after i boot it up after shut down i will not see the top menu bar load until i force click the top of the screen where is should be. What can cause this issue?