Q: File Adapter - enforcing file structure
A simple question - if I have a BPEL process picking up a CSV file via File Adapter, how do I enforce the structure in the CSV file? e.g. if a record in the file is short a comma, I want that record to be fished out as erroneous.
From what I can tell after a few short test cases, if a record in the CSV file is short a field (i.e. missing a comma), the terminatedBy="," property in the XSD will case the adapter to parse the input file, including EOLs, until it reaches the next comma, typically spilling over into the next record. It does not recognize that short record as erroneous.
If this is unclear, please note and I'll try to further elaborate.
Thanks in advance -
Well, the terminatedBy for only the last field in the record is EOL. The other fields are terminatedBy a comma. Here's a sample XSD for the process in question -
<?xml version="1.0" encoding="UTF-8" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd"
targetNamespace="http://TargetNamespace.com/readTheFile"
xmlns:tns="http://TargetNamespace.com/readTheFile"
elementFormDefault="qualified"
attributeFormDefault="unqualified" nxsd:encoding="ASCII" nxsd:hasHeader="true" nxsd:headerLines="1" nxsd:headerLinesTerminatedBy="${eol}" nxsd:stream="chars" nxsd:version="NXSD">
<xsd:element name="Root-Element">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Customer" minOccurs="1" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Name" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="," nxsd:quotedBy=""">
</xsd:element>
<xsd:element name="Address" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="," nxsd:quotedBy=""">
</xsd:element>
<xsd:element name="Street" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="," nxsd:quotedBy=""">
</xsd:element>
<xsd:element name="City" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="," nxsd:quotedBy=""">
</xsd:element>
<xsd:element name="State" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="," nxsd:quotedBy=""">
</xsd:element>
<xsd:element name="Zip" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="," nxsd:quotedBy=""">
</xsd:element>
<xsd:element name="Phone" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy=""">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<!--NXSDWIZ:d:\temp\customer_sample.csv:-->
<!--USE-HEADER:true:-->
Similar Messages
-
How to use File Adapter with hierarchial Structure?
Hi,
How to use File Adapter with hierarchial Structure like..
Data:
--Header Details:
Line Item Details:
Data
Bcoz I am getting a Flatfile in a hierarchial way as shown below.
Header Details :1
Line Item a
Line Item b
Header Details :2
Line Item c
Line Item d
KishoreHey Kishore,
In order to create a structure you need to use the file with convertion mode on the sending communication channel of the file adapter.
check the link for the needed configuration paramters.
If the structure is more complexed you can use the Contetnt master(CM) from itemfield which allows to ceate XML file from complex flat files and more.
<a href="http://help.sap.com/saphelp_erp2005/helpdata/en/0d/5ab43b274a960de10000000a114084/frameset.htm">File sender adapter</a>
If you have any question i'll be more than happy to assist.
Nimrod Gisis -
Error in Receiver File adapter using File content Conversion
Hi,
I am getting the following error in the receiver file adapter.
Conversion initialization failed: java.lang.Exception: java.lang.Exception: Error(s) in XML conversion parameters found: Parameter 'statement.fieldFixedLengths' or 'statement.fieldSeparator' is missing
I am using the below parameters for FCC:
Recordset Structure - statement
statement.endSeparator - 'nl'
statement.fieldSeparator - '0X09'
statement.fieldNames -xblnr,wrbtr,newbs,kostl,newko,prctr,xref1,rke_wwfud,rke_wwst3,blart,bukrs,bldate,budat,gjahr,monat,ctype,waers,bktxt,posnr,wbs_element,mwxkz,businessplace,businessplace,c_waers,c_wrbtr,g_ctype,g_waers,g_wrbtr,h_ctype,h_waers,h_wrbtr,trade_id,lob,sgtxt,zuonr,reason_rev,ldgrp,tcode,lifnr
ignoreRecordsetName - true
Please let me know where i am going wrong.
Thanks,
AparnaHi Aparna,
I feel the problem in your content conversion parameters is with
statement.fieldNames and ignoreRecordsetName
When you are confirguring receiver file adapter for file content conversion the above one is not required. Please refer below link for details on configuring content conversion in file adapter
[http://help.sap.com/saphelp_nw04/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/frameset.htm]
Hope this helps !!
Regards,
Amit -
Sender File Adapter with file conversion
Hi guys,
Im using a Sender File adapter with file conversion. The message to be processed has a structure with fixed lengths and in your content are some values that needs to be ignored.
An example:
value1 <b>value2</b> value3
I want to ignore <b>value 2</b> but I cant find a parameter for that! Do I need to define dummy fields on my data type and ignore those fields during mapping? Or there is a specific parameter for that?
Thanks in advance,
Ricardo.hi,
there always is another way:)
you can import the whole line to one field
and cut it inside the adapter module
(then you can define start and stop of the substring that you need to use)
but of course it's not standard even though it's quite easy to achieve in java
Regards,
michal
<a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a> -
File Adapter or File Transport which one will give more performance
Hi all,
File Adapter or File Transport which one will give more performance ? in OSB?
Which one to select any one did performance analysis?
Thanks
PhaniWhy don't you just go read some benchmarks?
http://www.barefeats.com/mbpp18.html -
Sender File adapter with nested structure
friends,
Source structure is looks like below
<mt_details>
<header>
<key> </key>
<id > </id>
<name> </name>
<contact>
<key> </key>
<pno> </pno>
</contact>
</header>
</mt_details>
If both the nodes i.e <header>&<contact> are at same level then the sender adapter picking the file as requried.But in this case the <contact> node is subnode of <header> Please help how in configuring the sender file adpter(Fixed file).
Sample file :
HDRE100testname
PHO999999999
Ravi PalHi Ravi,
I dont think this is possible, Just read the following link,
http://help.sap.com/saphelp_nw04/helpdata/en/2c/181077dd7d6b4ea6a8029b20bf7e55/content.htm
and the content under FILE STRUCUTRE says,
<i>The structure of these substructures must be fixed and corresponds to the description of the row structure logic in the table below.</i>
The strcuture that you want is not supported.
Regards,
Bhavesh -
Exception handling in File adapter when directory structure is incorrect
hi,
How can exception handling part be done in File adapter in cases where directory structure is incorrect, or directory
we are referring to is not present.
thanks
YatanIf you are polling then there will be error message in log files.But i dont think we can do exception handling in such cases.
Cheers -
XI 3.0 File Adapter: Converting File Content in Sender Adapter
Hi,
This is probably a basic question but does anyone have an example of the parameters used when you are using the 'Converting File Content' option on the File Adapter ?
Also, where do the record sets have to be defined ? Are these data types in the Integration Builder ?
The documentation is to say the least a bit flaky.
Any help would be appreciated.
Kind regards
Colin.Hello,
I'm wondering if someone has experience setting up conversion for different record structures. The example shown (in a greate way) only picture one kind of structure.
How should it be done if the file would contain
10Mat1
20100PCS
The first record structure has columns
ID(2),Material(10)
The second redcord structure has columns
ID(2),Quantity(3), Unit of messure (3)
Brgds
Kalle -
Receiver File Adapter with File content Conversion
I have a requirement to send 2 different files to the target directory. Source is the same and different mapping for the 2 files.
This I can achieve through multi-mapping but there is a problem. How can I use the File content for receiver File adapter which is using Multimapping.
The structure of the 2 files also different.Why would you need FCC on receiver file adapter? If you need different files to be generated from the source, you could create two receiver channels with different mappings and just add them to the same Receiver Detemination. Isn't feasible?
-
Hi,
I am facing some problem in FCC for Receiver adapter. It has to convert from XML to CSV File.
<?xml version="1.0" encoding="UTF-8" ?>
- <ns0:PaymentFull_Target xmlns:ns0="http://sdn.com/Payment">
- <RECORDSET>
- <Header>
<LineItem>1</LineItem>
<SaleNumber>102</SaleNumber>
<TransNumber>105</TransNumber>
<Store>1326</Store>
<variant>Z6</variant>
<TransType>NEW</TransType>
<Adjustm_Type />
</Header>
- <Header>
<LineItem>2</LineItem>
<SaleNumber>102</SaleNumber>
<TransNumber>105</TransNumber>
<Store>1326</Store>
<variant>Z6</variant>
<TransType>NEW</TransType>
<Adjustm_Type />
</Header>
- <Header>
<LineItem>3</LineItem>
<SaleNumber>102</SaleNumber>
<TransNumber>105</TransNumber>
<Store>1326</Store>
<variant>Z6</variant>
<TransType>NEW</TransType>
<Adjustm_Type />
</Header>
</RECORDSET>
</ns0:PaymentFull_Target>
Output File is coming only with lineitem values , remaining fields are not coming.
*1,2,3*
FCC Used...
RecordSet Structure -- Header
Header.fieldNames -
LineItem,SaleNumber,TransNumber,Store,variant,TransType,Adjustm_Type
Header.fieldSeparator----- ,
Header.endSeparator----- 'nl'
Did I miss anything.. any idea whats going wrong?
Thanks
DeepthiHi Deepthi,
Mention the occurrence of header in Recordset
You specify like this:
Recordset: Header, *
Header.fieldSeparator : u2018Field Separatoru2019
-->For FCC on Receiver side you donu2019t have to mention the field names.
-->The u2018endSeparatoru2019 parameter needs to given for substructure only
Check this links:
http://help.sap.com/saphelp_nw04/helpdata/en/d2/bab440c97f3716e10000000a155106/content.htm
/people/shabarish.vijayakumar/blog/2007/08/03/file-adapter-receiver--are-we-really-sure-about-the-concepts
/people/arpit.seth/blog/2005/06/02/file-receiver-with-content-conversion
Rgds,
Akhila -
File adapter input file format
Here the communication scenario is as follows: read a file and send a message via XI to an inbound interface.
A file adapter service has been defined. Message protocol 'file content conversion' has been chosen for the file adapter service. Next the file format has to be defined in communiction channel settings.
Is it possible to define the input record structure in the file to be red itself?
The first line will list all column names. The data records will follow in line two up till end of file.
Regards
KlausNow I can add some more information to the facts.
In XI 2.0 the adapter engine was used to connect the integration engine to external systems. The adapter engine converted input file contents to a XML message. The structure of the records in the input file has to be defined. There was one option to read this structure from the first line of the file itself. This option was called 'fromFile'.
Now the current situation in XI 3.0 is that the integration engine reads the input file. Conversion of file contents is still available but the option to read the record structure from the input file doesn't exist anymore.
Does anybody know whether I am right and this functionality isn't available anymore or how to achieve the desired system function in XI 3.0.
Regards
Klaus -
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 -
File Adapter: Dynamic file name
Hello,
I would like to use a filename like this:
Name.<DOCNUM>.Direction.<Timestamp>
For DOCNUM I use variable substitution. Works fine.
For <Timestamp> I need a different format as the timestamp function
in file adapter create. So I try to set up my timestamp in mapping like
dynamic file name:
DynamicConfigurationKey key1 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "Timestamp");
conf.put(key1, a);
Input a is date function which creates my desired timestamp format. In file adapter I try this:
Name.%DOCNUM%.Direction.%Timestamp%
or
Name.%DOCNUM%.Direction.Timestamp
or
Timestamp
all doesn't work for Timestamp.
So is there a possibility to configure a dynamic filename like this???
Is there a possibility to access dynamic configuration variables in dynamic filename except
the known for filename and directory??
thanks
chris
Edited by: Christian Riekenberg on Mar 10, 2009 4:02 PM
Edited by: Christian Riekenberg on Mar 10, 2009 4:05 PMyour file name needs to be
Name.<DOCNUM>.Direction.<Timestamp>
dont use variable substitution. use only dynamic configuration and set the file name
introduce a logic that will create the string
Name.<DOCNUM>.Direction.<Timestamp>
eg. String filename = "Name" + var_docnum + "Direction" + var_timestamp;
then use the dynamic conf code to set the file name and use adapter specific properties in you adapter to retrieve it.
Ref:
/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
http://help.sap.com/saphelp_nw04/helpdata/en/43/03612cdecc6e76e10000000a422035/frameset.htm -
XI Receiver file adapter : Dyanmic File PATH
Hi,
Appreciate if someone could help me on the issue below:
I have a receiver File adapter with a dynamic target directory as per below:
Target directory: /test/YYYY/MM/DD
the value for YYYY (Year) , MM (Month) and DD (Date) will be the date when the file being transfered from the sender.
Appreciate if someone could help me to achieve this. I know we can use the variable substitution however it doesn't allow us to set a systems field such as sy-datum.
Cheers,
ZABHi,
Populate this value in your payload , and then use Dynamic File Name concept of File Adapter.
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 -
Receiver File Adapter - Create File on another SAP System
I am working on a project that includes this requirement: PDF files to be copied from a third party company via SFTP to a directory on our ECC system.
We have worked out the sender side config, and the transfer of the files into PI works fine via SFTP.
However, the PDF files are ending up in a directory on the PI system and not on our ECC system as expected.
The receiver communication channel is set up as follows:
Party = blank
Communication Component = communication component of the ECC business system
Adapter type = File
('Receiver' is ticked)
Transport Protocol = File System (NFS) (etc)
Target directory = /tmp (using this temporarily for testing)
I would have thought using the ECC business system would mean the files would end up on that system, but instead they end up on the /tmp directory on the PI system.
We are not permitted to use FTP between our SAP systems, so I can't go with that option.
I've searched for help on this and only see conflicting and vague statements about whether the NFS protocol can or can't be used for transfer to another SAP system in the landscape.
Any suggestions and help on the above, and the best method of transferring the files to the end SAP system would be very appreciated.
Regards,
Christineremember that NFS means that it is referring to a file system on PI server.
What you could do is mount a space on SAP PI onto SAP ECC so that ECC will be able to access the files on SAP PI.
Guess that should solve the problem.
Maybe you are looking for
-
Can you control the alpha of an input text box?
Using Action Script, I mean? If I put a ball on the stage and make it a movie, I can make it vanish by putting ball._alpha -= 100; If I put an input text field on the stage and reference it by name that doesn't work. If I turn the text field into a M
-
How do you copy and paste on Android?
When I'm browsing various sites there is often a need to either copy text from a web page or paste text from elsewhere on the phone (such as a password manager app) into a form on a web page. When using the stock Android browser this is generally acc
-
How do you test an Alert?
How do you test an Alert?
-
Issue with transferring from Adobe Illustrator Draw to Illustrator on the desktop
I am having trouble getting my Adobe Illustrator Draw files to Illustrator on the desktop. Here is the error: "The file "Project-Drawing 1.draw" is in an unknown format and cannot be opened." I have updated my Illustrator CC 2014 and signed in to my
-
Is there a paches to upgread from 8.1.5 to 8.1.7
i have 8.1.5 database and i want to upgread it to 8.1.7 with a patch .. can any one tel me if there is a patch for that ? thanks