We have discussed Simple File Adapter Configuration as well as File Content Conversion for a simple structure CSV file. In this article we will understand how to deal with File Adapter when file structure is a bit complex. For example if it has different number of columns of information on different rows.
Let us take an example of a simple sales order. Assume that sales order is received in form of a text file. The first row has header information like customer details and order details; whereas the remaining rows have order items details. Every field has different lengths and there are no field separators. The adjoining figure shows such a file with minimal fields.
Sender File Adapter Configuration with Content Conversion
The figure below shows a typical configuration of the sender file adapter. Specify File Content Conversion as message protocol. Document Name and Namespace correspond to the message type from the Integration Repository. Recordset Name defines the root node under which rest of the XML will be created. If left blank, it defaults to ‘Recordset’. If you do not want this extra node to be inserted, you can set the parameter ignoreRecordsetName to true (Thanks Mike for this input). See this link for exhaustive list of available parameters.
Specify the name and occurrence of each sub-node in Recordset Structure. In this case, OrderHeader node occurs once while OrderItem node can occur any number of times. Key Field Name and Key Field Type help in differentiating different substructures. In this case Key =1 implies OrderHeader node while Key = 2 implies OrderItem node.
Different parameters are given below –
- <node>.fieldFixedLengths – comma-separated ordered list of field lengths in the particular node
- <node>.endSeparator – identifies end of record
- <node>.fieldNames – comma-separated ordered list of field names in the particular node
- <node>.keyFieldValue – Value of the key field
- <node>.keyFieldInStructure – ‘ignore’ (without quotes) indicates that the Key field should not be generated in the resulting XML whereas ‘add’ (without quotes) indicates that it should be added.
For a detailed list of parameters visit this page.
Receiver File Adapter Configuration with Content Conversion
Assume that we want to construct a text file in the similar format from the XML. The generated file should be something like the one shown in the figure on right.
The figure below shows the typical configuration for the receiver file adapter using file content conversion. Specify the comma-separated list of root node and substructures under the Recordset Structure as shown. Then define the parameters as per the requirement.
Most common parameters are <node>.fieldSeparator or <node>.fieldFixedLengths, <node>.endSeparator, <node>.fieldNames. For a detailed list of available parameters please refer this page.
Thus we have learned how to configure the SAP XI file adapter on sender and receiver side. We have also covered the File Content Conversion when dealing with simple structures as well as with advanced or complex structures.
Awesome is the word for this article. Hats off to you. New to XI. Very informative. Going to try it.
Hi Karthik,
Thanks a ton for your encouraging compliments :)
Regards,
Riyaz
Hi,
Great article!! This helps me out a lot. I am facing a lot of problems exactly on this issue. But I still have some questions though..
1) I don’t understand how MT_SALESORDER should look like in the integration repository. It seems that you describe the structure of the inputfile in the Orderheader.fieldnames-section and Orderitem.fieldnames-section. Isn’t that redundant then?
2) Can you please put a screenshot of the MessageType MT_SALESORDER?
3) Interface-determination still has to be done on the “source”-tab right?
4) What is the purpose of the Recordset Name? I don’t see “Orderdetails” coming back anywhere in the configuration
5) Please explain again how to use the keyfield name and keyfield type, as I don’t understand.
6) Where do I have to specify if my input-file is comma separated?
Thanks in advance and kind regards
William.
Hi William,
Thanks for the compliments!
1) Note that the structure you provide under .fieldNames is the structure used while generating XML from the source file. i.e. in the above example, the structure would look like something below –
MT_SalesOrder
–OrderDetails
—-OrderHeader (occurs only once)
—–CustomerNyumber
—–CustomerName
—–OrderNumber
—–OrderDate
—-OrderItem(occurs unbounded)
—–ItemNumber
—–MaterialNumber
—–NetPrice
—–Quantity
You should create this structure in accordance with the input file structure.
2) Let me know if above doesn’t help, I shall post the screenshot of the IR structure.
3) I did not exactly understand your question. However, all ID config steps remain the same and interface determination is also required.
4) Recordset Name is the name of the root node that should be created in the generated XML (see the above structure). If you dont provide this, a default name called Recordset is used.
5) Since the source file has different structures on every row, key field values are used to identify and groups the similar structures. Note the .fieldNames parameters in the above figure. Each one has an element called ‘Key’ and there is a corresponding .keyFieldValue parameter. Hence, Key Field Name is used to specify the name of the field whose value should be used to identify the structure. e.g. Key with value ‘1’ implies OrderHeader, Key with value ‘2’ implies OrderItem. Key Field type is the type of value the field contains. You could use either Integer or String in this case.
6) Since, structure for different rows is different, you have to specify the field separator for every structure involved. You can use the .fieldSeparator parameter for the same. In our case, we have used .fieldFixedLengths instead, since we are not using a CSV file. If your file structure on each row is same, you can refer this article.
Let me know if this helps. Also, revert if you need more help. I will be more than happy to help you through.
Thanks.
Regards,
Riyaz
Hi Riyaz,
this indeed helps me out a lot. As I am new to XI I am struggling a bit currently so every help is welcome :-)
One more question…my target-file should not be XML but .TXT. Is there an easy way to tell XI this?
Thanks again,
William
Hi William,
While providing the filename specify the .txt extension. You can use wildcards if your filename is not fixed, for example, you could provide *.txt, or *order*.txt etc.
Since, your target file is TXT and not XML, you will need to use content conversion in the receiver file adapter.
Regards,
Riyaz
Hello Riyaz,
Your atricles are excellent and informative too. Howevere I just observed this FCC and I also did configure the FCC to create a text file. In my configurations I have used only and given the sizes of each field in that record and it still works.
I need not use a field separator. In this case, the field sizes would be used to separate the fields. So the output would look something like this:
ABC DEF GHIJKL
Is there something mandatory that is missing here that I need to use?
Thanks in advance,
Vincent
I meant to say I have used only with the name of the node fieldFixedLengths and it still works.
Hi Vincent,
Thanks for your compliments.
Note that either of the two paramaters – fieldSeparator or fieldFixedLengths is mandatory. It depends on the structure you are using. Use fieldSeparator if you need to separate values by some character like a comma (See this article), and use fieldFixedLengths if you want to specify lengths of each of the fields.
In the current article, I have used fieldFixedLengths. Note that fieldSeparator is used only for the root node i.e. OrderDetails node. Since this node contains only child nodes and does not contain any elements, may not really be necessary to provide an entry for fieldFixedLengths or fieldSeparator.
Regards,
Riyaz
This article really helped me build my inbound CSV file. Thanks.
I have done all of this set up and my file gets converted to xml in what looks like the correct matching Message type structure. But I can not get it to map. I took the xml out of the pipeline in Moni and tried to test with it directly on the message map. Two things I noticed.
1. It has a namespace that was generated. If I bring this namespace with when I try to test it creates 2 TOP NODES. I assume XI is smart enough to remove the namespace when it actually uses the xml? If not how do I get rid of the namespace?
2. If I manually remove the namespace and test with the pipeline XML my inbound structure turns all RED (supressed). The data lines up perfectly in the structure but when I test and look at the QUEUE it says supressed for all my input values? Has anyone seen this, and what is the best way to test this type of scenario?
thanks,
Mike
Please disregard my prior post. I had to use the ‘ignoreRecordSetName’ = true option to remove the extra top node tag. Once I did that it worked perfect.
thanks,
Mike
Hello Riyaz
Your articles on Content Conversions for both Simple and Complex structures was very helpful. However, I am stuck at the moment.
My problem is that I am passing IDOC PAYEXT.PEXR2002 directly to XI via R3, and my scneario is picking up the Payment, but I need to flatten the file into a text file before I can FTP the file to the Bank.
Here is my scenario:
Adapter Type: File (Receiver)
Transfer Protocol: FTP
Message Protocol: File Content Conversion
Adapter Engin: Integration Server
What I need is some direction how to create the Recordset Structure for the IDOC PAYEXT.PEXR2002 and what parameters would be needed.
Any help would be greatly appreciated.
Thanks,
Dave
Hi Dave,
Its good to know that you found the content useful. Thanks for the compliments :)
As I understand, you want to create a flat file from the IDoc XML and that the flat file structure is predefined by the bank you are communicating with.
To use File Content Conversion, study the structure of the target format given by the bank. Note the common structures. Note the order in which the fields and rows should appear in the target. Now based on this information, create a target XML format (Target data type, message type). Then do the mapping to get the required data in the target format. Thus you will get a XML file that needs to converted in a flat file using content conversion.
Now you can follow the steps in the above article to do the content conversion as per your requirement. I would suggest to create the target XML (message type/data type) in such a way that your content conversion would be least painful.
Let me know if this helps. Do revert if you need more help.
Note: If your bank is using any EDI formats like EDIFACT etc., it is advisable to go for third party adapters like Seeburger.
Regards,
Riyaz
Hi Riyaz,
If somehow I get the power to award anyone in SAP world, then you will be the one for sure without any doubt.
You are brilliant, your patience in writing articles, way of explaining is just brilliant.
Please one request to you. You are performing but still I want to request please don’t stop writing.
You are the star giving light for us to walk towards SAP XI technology.
Can I get your email address? I want to meet you sometime if possible, or else please send me a test mail to krishplace@googlemail.com
Thanks once again for all your hard work in writing articles.
Kind Regards
Chris
Hi Riyaz,
I am practicing file content conversion parameters. I am stuck at the following at one point. If you see the below source and target structures.
First row contains the data about the BookingCode Node. I am failing to convert the BookingCode node. Rest of the nodes were getting fine.
I have used keyField of type integer for each row.
Some of the configuration parameters which i Set in the example were:
Recordset name: Order
Recordset Structure: BookingCode,1,Passenger,1,Flight,*
Key Field Name : key
Key Filed Type : Integer
Now I am confused how to use BookingCode which doesnt have any children but just a value in the target xml.
Can you please let me know how to get BookingCode Node in the target xml with just a value?
my source csv file is
——————————————–
12KY34R
2Smith 123 Main St.
304042004SX21 ZRHFRA
304042004LH4025FRALAS
304042004UA128 LASSFO
——————————————–
and I would like to convert to
——————————————–
2KY34R
Smith
123 Main St.
04042004
SX
21
ZRH
FRA
04042004
LH
4025
FRA
LAS
04042004
UA
128
LAS
SFO
——————————————–
Thanks and Regards
Chrish
Dear Chrish,
Thank you very much for your overwhelming compliments. I will surely be adding more articles on this website.
As for the file content conversion in your case, the structure is similar to the one I explained in the above article.
If I am not wrong, both source and target files are non-xml. So you will need to use file content conversion in both sender and receiver file adapter. Hence, the solution is quite simple.
when you generate source xml from source file, use a dummy node (say BookingHeader) to hold the BookingCode node. e.g.
...
...
<BookingHeader>
<BookingCode>2KY34R</BookingCode>
</BookingHeader>
<Passenger>
...
...
</Passenger>
<Flight>
...
...
</Flight>
...
...
and when you do the message mapping, create a structure of the target XML, such that you only have the BookingCode node in target.
Now you have the target XML as per your requirement, so you can easily use content conversion on the receiver side to create your target file.
Since you want each field on a newline, you can assign ‘nl’ value to .fieldSeparator and .endSeparator parameters.
Do revert if you need more info. Also let me know if this helps.
Regards,
Riyaz
Hi Riyaz,
Thanks a lot for your previous answers, they already helped me out a great deal, but I just keep struggling with the following:
I have a flat file as input, with 1 recordtype “headerdata” (1..1) and 1 recordtype “positiondata” (1..n). Within this recordtype “positiondata” there is a third repeating recordtype “positionpartner”s”(1..n). And recordtype 4 always occurs once within recordtype 2. So within recordtype 2 there is an optional repeating recordtype 3 and a mandatory recordtype 4.
I defined the logical structure in IR as follows:
recordtype 1 (1..1)
recordtype 2 (1..n)
<<<recordtype 3 (0..n) so repeating within recordtype 2
<<<recordtype 4 (1..1) always once within recordtype 2
Now, how do I define this structure in the file conversion section of the sender file adapter? The last field of recordtype 2 should be a keyfield again I guess but how do I tell the adapter this?
Hope you can help :-)
Thanks,
William
Hi William,
Content conversion works with only flat XML structures.
A possible solution/workaround could be like this. (I have not tried this, but will try out) –
Create two source data types. First one (say dt_source1) with a flat XML structure i.e.
recordtype 1 (1..1)
recordtype 2 (1..n)
recordtype 3 (0..n)
recordtype 4 (1..1)
and the second one (dt_source2) with a nested structure as per your requirement –
recordtype 1 (1..1)
recordtype 2 (1..n)
»»recordtype 3 (0..n)
»»recordtype 4 (1..1)
Now, do the file content conversion and generate XML as per the first XML structure (dt_source1). This is simple as I explained in the above article.
Now create two mappings – one between first source structure (dt_source1) and the second structure (dt_source2). And other mapping between second structure (dt_source2) and your target structure.
In your interface mapping, specify both the mapping programs in the correct order (one below the other). You can use the ‘+’ button to add one more row. These mappings will be executed in the same order.
To map dt_source1 to dt_source2, you can use java or XSLT mapping. You can as well use graphical mapping, just make sure you do the context handling correctly.
Please let me know if this helps. I will as well try this at my end.
Regards,
Riyaz
Hi Riyaz,
Sorry for getting back bit late. Thank you very much for your response.
But what if I dont want to create BookingHeader. Is it possible to assign the value directly to BookingCode rather than creating dummy node BookingHeader?
Thanks
chrish
Hi Chrish,
I dont think its possible without a dummy node. At least I cant think of any other workaround. This is because either of fieldSeparator or fieldFixedLengths parameters is mandatory. Also somewhere you have to specify the KeyFieldValue and its position in the node. So you can only specify nodes, not individual fields on the left side of the parameters table.
And as far as dummy node is concerned, it certainly does not put any business impact as the conversion is at the source side and you can take care of it during the mapping transformation.
Regards,
Riyaz
Hi Riyaz,
Thanks for your response. You are right may be it’s not possible because of mandatory pararmeter fieldFixedLengths and fieldSepeartor.
Also do you have any plans for the article on Monitoring – like CCMS, PMI, Alert, Message Monitoring, Performance monitoring, cache Monitoring,etc…
Regards
Krishna
Yes Krishna,
I will be adding up more articles to the website including these topics. You can keep track of new content by email subscription or RSS subscription. The link is available in the sidebar on the right.
Thanks.
Regards,
Riyaz
Hi Riaz,
If suppose my FCC like, the xml file contains full of attribute in the input file then how to create the Record set structure.
example xml>
0.114
0.11
0.105
0.097
0.092
0.085
0.081
0.079
0.075
0.073
0.07
0.067
0.062
0.06
0.059
0.056
Hi,
Assuming you have a non-XML source file, you can use a workaround like this –
Use File Content Conversion to create both elements and attributes as elements i.e. your FCC converted structure would look something like –
<Parent_node>
<subnode1>value1</subnode1>
<attribute11>attribute_value</attribute11>
<attribute12>attribute_value</attribute12>
<subnode2>value2</subnode2>
<attribute21>attribute_value</attribute21>
<attribute22>attribute_value</attribute22>
<subnode3>value3</subnode3>
<attribute31>attribute_value</attribute31>
….
….
</Parent_node>
Now, in the message mapping, use a two step mapping. In the first mapping, convert the attribute elements to actual attributes using graphical mapping and appropriate data types/message types. Thus you will have the desired structure with your elements and attributes. Then in the second mapping do the actual mapping to convert the source to target structure.
To see how to use two-step mapping within interface mapping see this link.
Hope this helps.
Regards,
Riyaz
Hi Riyaz,
Your website is very informative.
I have a condition where i need to convert a hierarchical file into XML using File content conversion.
Source:
Seg 100
seg110
seg200
seg210
seg300
seg315
Note that all the segments are mandatory.
Can i some how get this input file converted??
Waiting for your response!
Thanks in Advance!
Regards,
Sampath
Hi Riyaz,
great Blog.But I have one doubt.
suppose I have a text file as follows
——————————————–
Rajan 00000053412 finance
xxxxx45637 tyfrt 44406
Gandhi Road
What should i do to read the entire data into a single field in source?
parentnode:
subnode:value:/subnode
/parentnode
Is it possible?
Hi Anoop,
Have a look at this approach given by Ravi. All/partial File contents can be first transferred to a row/record of the XML structures. Then you can manipulate it using a second mapping program.
Riyaz,
You input to the PI blogs has been great. Thanks for taking the time to write the blogs and provide feedback.
Currently, I am have a strange situation which has always worked for me in other versions SPacks of XI / PI.
My scenario relates to a Sender File Adapter and a Receiver IDoc Adapter. My Outbound Message Type / Data Type has multiple Complex elements which I later
replicated to only three(3) Complex elements to check the issue. The elements defined in IR are as follows:
1.EDI_DC: Element occuring once with multiple fields
2.E2IDKU1: Element occuring 1..unbounded with multiple fields
3.E2EDKO3: Element occuring 1..unbounded with multiple fields
IDirectory has a Sender File Adapter has a Communication channel with the following specifed in FCC:
Document Name: MT_RecManager_Test_O
Document Namespace: http://mrgnetwork.com/WF/RecManager
Document Offset:
RecordSet Name: RecordSet
RecordSet Namespace:
RecordSet Structure: EDI_DC40, 1,E2IDKU1,*,E2EDK03,*
RecordSet Sequence: Ascending
RecordSets per Message: *
KeyFieldName: SEGNAM
KeyFieldType: String(Case Sensitive)
EDI_DC40.fieldNames: SEGNAM,MANDT,DOCNUM,DOCREL,STATUS,DIRECT, EDI_DC40_FILLER1
EDI_DC40.fieldFixedLengths: 10,3,16,4,2,1,6
EDI_DC40.keyFieldValue: EDI_DC40
EDI_DC40.missingLastFields: add
EDI_DC40.additionalLastFields:ignore
EDI_DC40.endSeparator: ‘nl’
E2IDKU1.fieldFixedLengths: 30,3,16,6,6,2,3,35,35,3,3
E2IDKU1.keyFieldValue: E2IDKU1
E2IDKU1.fieldNames: SEGNAM,MANDT,DOCNUM,SEGNUM,PSGNUM,HLEVEL,BGMTYP,BGMNAME,BGMREF, BGMLEV,BGMACC
E2IDKU1.missingLastFields: add
E2IDKU1.additionalLastFields: ignore
E2IDKU1.endSeparator: ‘nl’
E2IDKU1.keepIncompleteFields: yes
E2EDK03.fieldFixedLengths: 30,3,16,6,6,2,3,8,6
E2EDK03.keyFieldValue: yes
E2EDK03.fieldNames: SEGNAM,MANDT,DOCNUM,SEGNUM,PSGNUM,HLEVEL,IDDAT,DATUM,UZEIT
E2EDK03.missingLastFields: add
E2EDK03.additionalLastFields: ignore
E2EDK03.endSeparator: ‘nl’
E2EDK03.keepIncompleteFields: yes
ignoreRecordSetName: true
The test file contents are as follows: (please note that I have pasted the file contents in this limited “Long Text” field, the lines are wrapping around):
EDI_DC40 4000000000000000000700 302112233445566
E2IDKU1 100000000000000000000000100000001LBXLOCKBX 1
E2IDKU1 200000000000000000000000100000001LBXLOCKBX 1
E2EDK03 10000000000000000000000020000000201120081114092712
When I run the above file contents with the FCC RecordSet as follows, the Payload is empty and I receive a message that the File Size is 0 bytes.
RecordSet Structure: EDI_DC40, 1,E2IDKU1,*,E2EDK03,*
When I run the above file contents with the FCC RecordSet as follows, the Payload is correctly formed and I receive my message in the Integration Engine and
can see it in SXMB_MONI:
RecordSet Structure: EDI_DC40, 1,E2IDKU1,2,E2EDK03,1
I want to be able to specify an asterisk “*” in RecordSet Structure as the file contents can vary for KeyFields E2IDKU1 and E2EDK03.
I have seen various messages in SDN referring to checking the File contents and FCC and I have already done so without any results. This feature has been
widely used in PI. Is there a change in PI 7.0. We are currently running PI 7.0 / SP12. Please advise.
Channel CC_Test_O: Empty document found. Proceed without sending
message.
Please note that as stated before that if I change the RecordSet
Structure and DO NOT specify an asterisk “*”, I do not get the “Empty
document found message” and the message actually appears in Integration
Engine with a payload.
Hi Ravinder,
Have you solve this issue? I’m now getting the same problem as you mentioned above.
As per my knowledge, there is no change in PI 7.0, or PI 7.1 as regards the use of ‘*’ in file content conversion. Use of asterisk is a standard way as per the PI 7.0 Documentation as well as PI 7.1 Documentation. I would suggest you to reach the SAP OSS support team with this issue.
Hi Riyaz,
– Happy New Year ! –
…
in one of the files to be converted the printing character | (0x7C) is used as a NAME.endSeparator
Right now I do not understand that:
– with NAME.endSeparator defined as ‘0x7C’ the conversion fails,
but
– if I replace this character by ‘nl’ in the file and adjust the NAME.endSeparator
to ‘nl’ the conversion succeeds.
Any idea ?
Best regards
HelmutK
Hi Riaz,
Can you please explain me the significance of Recordset Sequence in FCC?
Regards,
Subhendu
Thanks Riyaz for your marvellous articles here. It’s very helpful for the problem I’m facing at converting the flat file into XML in XI.
Anyway, I’m still very new in XI. I wish to get some advice from you on the following scenario:-
I have a csv complex structure flat file with 1 header line and 2 details lines and need to be converted to ACC_DOCUMENT03 IDOC.
I already have the mapping between my flat file strcuture and ACC_DOCUMENT03 IDOC structure.
Now, I’m stuck at how should I configure the XI to convert my flat file strcuture to ACC_DOCUMENT03 IDOC structure and post it to SAP R/3.
Could you briefly explain how I can achieve that using SAP XI? Thanks for your help.
Hi Riyaz,
Read your blogs. doing great job.
Im working on a file to file scenario using Seeburger SFTP adapter. Sender SFTP adapter does not have the option of archiving the file but i have an requirement of archiving the CSV file to some other folder.
My doubt is how to achieve the archiving option in Seeburger SFTP Adapter. does any module supports ARCHIVE in SFTP adapter or is there any other option for this?
Thanks in advance for your valuable suggestion.
Kavita
Thanks Kavita for your comments. I havent had a chance to work on a Seeburger’s SFTP adapter. So may not be able to comment on this. You might want to check the documentation that came along with the installation. Or you might want to see if its possible to write a custom module. Another option might be to use a BPM process to archive the file may be using a File receiver adapter.
Hi riyaz.the blog is informative.
can you please let me know how to configure the parameters if the elements in the data type are in different level
i mean if the there is header and detail records under which we have different sub nodes.
Waiting for your reply,
Thanks in advance
Hi Kavita,
my customer Swisscom is using the SFTP Adapter from http://www.advantco.com, e.g. according to SAP they are the only certified adapter for SFTP with the PI system.
It supports archiving and the conversion from XML to CSV and CSV to XML for the sender and receiver adapter. My client is using this since version XI 3.0.
You may want to check this out.
Cheers
Connie
Hi Connie,
I heard of Advantco’s SFTP adapter but my requirement is to work on Seeburger’s SFTP adapter. Anyways i would like to check Advantco’s SFTP adapter if it really fulfills all the business requirements.
Please let me know if i could get an Evaluvation version of Advantco’s SFTP adapter.
Thanks
Kavita
Hi Riyaz,
i have a scenario for configuring FCC as sender. my source structure is something like this
–
–
field1
field2
here my item segment is inside the header segment. i have created sender FCC as per your blog. but i am getting a mapping error telling that the “item segment cannot be produced. Check xml instance is valid for source xsd and target-field mapping fulfills requirements of target xsd ” . if we have a substructure, are we suppose to configure in a different way. kindly reply
Regards
Deepika
Use SXMB_MONI and check the stucture and tags generated by the file adapter and ensure that it matches the structure of the source message type used in your message mapping. Also check if the XML namespace and occurences are correct. Also, test your message mapping locally in IR and ensure that it is working as desired.
Hi Riyaz,
I would like to ask, this is a great blog. I am new to PI. But I am encountering issues from my configuration saying nested level structure of HDR is too deep. My target structure looks like this.
MT_File
— TAG (1.1)
——-HEADER1(1.1)
——-HEADER2(1.1)
——-HEADER3(1.1)
——-HEADER4(1.1)
— HDR (1…unbounded)
——DATA (1.1)
————VALUE1(1.1)
————VALUE2(1.1)
————VALUE3(1.1)
————VALUE4(1.1)
——DATA (1.1)
————VALUE1(1.1)
————VALUE2(1.1)
————VALUE3(1.1)
————VALUE4(1.1)
——DATA (1.1)
————VALUE1(1.1)
————VALUE2(1.1)
————VALUE3(1.1)
————VALUE4(1.1)
——DATA (1.1)
————VALUE1(1.1)
————VALUE2(1.1)
————VALUE3(1.1)
————VALUE4(1.1)
Then my current module config is like this:
…
…
…
TAG.fieldSeparator ,
TAG.endSeparator \r\n
HDR.fieldSeparator ,
HDR.endSeparator \r\n
DATA.fieldSeparator ,
DATA.endSeparator \r\n
DATA.fieldNames HEADER1,HEADER2,HEADER3,HEADER4
HDR becomes a nested node since this can iterate many times. I am not sure if I am configuring it the right parameter. Could you help?
Thanks,
Mark
Hi Mark,
Can you please let me know where are you using content conversion, at the sender side or at the receiver side? i.e. are you converting a flat file to XML or vice-versa?
Also, the field DATA (1.1) seems to occur multiple times under HDR. Either the occurence should (0..unbounded) or the name of four fields should be different (say DATA1, DATA2 etc)
DATA.fieldNames should contain the names of tags under DATA (i.e. VALUE1, VALUE2 etc). You have put the names of tags under TAG (i.e. HEADER1, HEADER2 etc).
Hi Riyaz,
Sorry for the confusion, I modified the module configuration, I gave you the wrong information for the DATA.fieldNames parameter.. here’s the updated module config. Yes you are right, DATA is 0…unbounded.
…
…
…
TAG.fieldSeparator ,
TAG.endSeparator rn
HDR.fieldSeparator ,
HDR.endSeparator rn
DATA.fieldSeparator ,
DATA.endSeparator rn
DATA.fieldNames VALUE1,VALUE2,VALUE3,VALUE4
This is from an XML file to CSV.
thanks,
Mark
Hi Mark,
For endSeparator you can provide newline character i.e. ‘nl’ instead of rn.
In the option Recordset Structure you should provide correct order of source XML tags i.e. MT_File, TAG, HDR
The elment names may also be provided. You havent provided element names for TAG node.
MT_File.fieldSeparator -> ‘nl’
TAG.fieldSeparator -> ,
TAG.endSeparator -> ‘nl’
TAG.fieldNames -> HEADER1,HEADER2,HEADER3,HEADER4
HDR.fieldSeparator -> ,
HDR.endSeparator -> ‘nl’
HDR.fieldNames -> DATA
DATA.fieldSeparator -> ,
DATA.endSeparator -> ‘nl’
DATA.fieldNames -> VALUE1,VALUE2,VALUE3,VALUE4
File Content Conversion works for single level nested structures only. The HDR structure seems to be nested more than one level. If the above does not work, have a look at this article: Working with Deeply Nested XML Structures Using Only Graphical Mapping. Article describes flat file to XML conversion. You can take a reverse approach to what is explained in this article to convert XML to flat file. This thread could be useful as well.
Hi Riyaz,
I can still endcounter this error.
The element nesting level for the structure HRD is too deep (reference: 3 levels, found: 4 levels) at XML element MT_File,HDR,DATA,Value1.
I don’t know what does this error means.
Thanks you very much for the help.
Regards,
Mark
Try appending ,DATA at the end of Recordset Structure. You might have to try some permutations.
Alternatively I would suggest you to go for Java Mapping to generate a CSV file at the output and use a dummy interface at the target. This would be equally easy.
Hi Riyaz,
Wonderful Site for XI Beginners. You are helping many XI Beginners with this blog. Thanks a Lot for your great help.
Thanks & Regards,
Giridhar.C
Hi Riyaz,
Is it possible to have multiple line Headers in a Receiver txt file.
Is it possible to have headers for some structures and not for others in a message type?
Let me know if I have been too brief :)
Thanks in advance.
Hi Riyaz,
blog is excellent, i have one question.
My FCC structure is like
Header
Item1
Item2
..
..
Trailer
At the target side i need only Items means i don’t want the header and trailer fields, so how its possible?
Thanks
Ramesh
You can easily do this in your mapping program. Map only the fields you need at the target.
Hi Riyaz,
How do I receive flat files in SAP PI using adapters other than File Adapters?
Pls help me if you have any ideas..
Krishnan
Hi riyaz,
My sender file has the following structure
header1
detail
detail
header2
detail
….
….
headerN
detail
Can u please guide me to proceed with FCC..
Thanks in advance
Hi, how do i convert an excel file into a tab-delimited text file? is it true that i must create an adaptor module? many thanks.
What you need is a Conversion Agent software – It converts Excel data to XML which can then be parsed by SAP PI. Have a look at https://www.riyaz.net/sap/xipi-sap-conversion-agent-installation-and-deployment-in-pi/626/
hi Riyaz,
Can you please let me know if we can use Document Offset in content conversion using modules.. i need to use them in a JMS channel. I tried xml.documentOffset, but it doesn’t seem to work.
Regards,
Ninu
Hi Riyaz ,
Firstly greetings to the knowledge you share . Below is the requirement i have in the FCC for sender file adapter later to map to idoc with custom message developed .The flat file is completely as one record as below
Header – (once )………………………………………. Flat file example :
Field 1 ——————————————->order line no 1 plant material 1 code 1 quantity 1
…………………………………………………………….. order line no 2 plant material 2 code 2 quantity 2
Field 2 (plant vlaue shuld come………………………………………………|
Line – repeats (0-unbounded) | | |
field 1 (line no 1)————————————————-| | |
field 2(material1)—————————————————————————–| |
field 3 (quant 1)—————————————————————————————————–|
field 1 (line no 2)————————————————-| | |
field 2(material2)—————————————————————————–| |
field 3 (quant 2)—————————————————————————————————–|
So i need to read the data intermittently and map them in the line items ignoring the order and plant data in every line apart from the first line. The order and plant remains the same in the flat file only line items keep changing .
Hope my question is clear & Thanks in advance .
Regards
Nagesh
have a single line payload , ie all header , details and trailer records comes in one line ,w/o any end separation.
Please help me in FCC for such kind , i tried Feild.endSeparotor as ‘0’ (null), but it did not work.
The Payload is
HUREC1.001036BGI10360006768100000000020120313I19287400010010000T000004
The current FCC am using is able to read only the Headerpart ie HUREC1.001036
the actual case is the incoming file will not have any end separator , but for the purpose of making it work i introduced few endseparotors .
Still its unable to identify any endseparator , ie i tried using # as end separaor , buts its unable to identify it.
Wanted to know , is there any possiblity to read the single line payload with the end separators.
Now the possibility from the client side is they can giv the file as
HUREC1.001036|BGI10360006768100000000020120313|I19287400010010000|T000004
ie they can giv the file with ‘ | ‘pipe symbol as end separation, like above
i use endseparator as ” 0x7C” – hex part for pipe symbol , still its not able to recognise , as it all comes in one line . Appreciate any help on this
Hi Riyaz,
I’ve a scenario in which the structure is like below:
Header
Item (Unique Value)
Detail (occurs 0 to n)
Cost (occurs 0 to n)
Trailer
In this way I’ve multiple entries for Item, Detail & Cost which are supposed to update a single customized IDoc with all the 3 segments. In File Content Conversion I’ve given the sequence as Item (1), Detail (2), Cost (3), however the rows of Detail and Cost are occurring randomly due to which we are getting wrong data posted in the IDoc.
Kindly let me know how do I rectify this.
Hi Riyaz,
I am from SAP support and is onsite at one of SAP customer. The customer has the following question about file sender adapter conversion. I do not have consultanting background for SAP PI and need your kindly advice.
The customer has file contains many orders, which needs to be converted and split into multiple messages, that is one order one PI message. The source file structue is as below:
Field 1 Field2
Hi Riyaz,
I am from SAP support and is onsite at one of SAP customer. The customer has the following question about file sender adapter conversion. I do not have consultanting background for SAP PI implementation and need your kindly advice.
The customer has a big file contains many orders, which needs to be converted and split into multiple messages, that is one order one PI message. The source file structue is as below:
Field 1 Field2
OrderA Item1
OrderA Item2
OrderA Item3
OrderA Item4
OrderB Item1
OrderB Item2
OrderC Item1
OrderC Item2
OrderC Item3
OrderD Item1
….
The structure is simple, but the number of lines for one order is dynamic, from one item to hunders of items. The big challenge is how to make a cut for one message by grouping items belongs to one order via the standard conversion function of the file sender adapter? Is it possible?
pls send updates