XI/PI: File Content Conversion for Complex Structures

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.

This entry was posted in SAP, SAP XI / PI and tagged , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.
Around the Web »»

49 Comments

  1. Karthik
    Posted March 5, 2008 at 11:41 pm | Permalink

    Awesome is the word for this article. Hats off to you. New to XI. Very informative. Going to try it.

  2. Posted March 6, 2008 at 12:00 am | Permalink

    Hi Karthik,

    Thanks a ton for your encouraging compliments :)

    Regards,
    Riyaz

  3. William
    Posted March 14, 2008 at 8:07 pm | Permalink

    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.

  4. Posted March 15, 2008 at 1:45 pm | Permalink

    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

  5. William
    Posted March 17, 2008 at 1:54 pm | Permalink

    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

  6. Posted March 17, 2008 at 3:44 pm | Permalink

    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

  7. Vincent
    Posted March 25, 2008 at 5:30 pm | Permalink

    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

  8. Vincent
    Posted March 25, 2008 at 5:32 pm | Permalink

    I meant to say I have used only with the name of the node fieldFixedLengths and it still works.

  9. Posted March 26, 2008 at 9:35 am | Permalink

    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

  10. Mike Nelson
    Posted April 4, 2008 at 12:22 am | Permalink

    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

  11. Mike
    Posted April 4, 2008 at 1:59 am | Permalink

    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

  12. David Mason
    Posted May 1, 2008 at 2:20 am | Permalink

    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

  13. Posted May 1, 2008 at 1:02 pm | Permalink

    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

  14. Krishna
    Posted May 4, 2008 at 1:54 am | Permalink

    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

  15. Krishna
    Posted May 4, 2008 at 5:02 am | Permalink

    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

  16. Posted May 4, 2008 at 8:38 pm | Permalink

    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

  17. William
    Posted May 5, 2008 at 11:17 pm | Permalink

    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

  18. Posted May 6, 2008 at 2:55 pm | Permalink

    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

  19. Krishna
    Posted May 7, 2008 at 10:38 pm | Permalink

    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

  20. Posted May 8, 2008 at 10:43 am | Permalink

    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

  21. Krishna
    Posted May 12, 2008 at 2:35 pm | Permalink

    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

  22. Posted May 12, 2008 at 3:01 pm | Permalink

    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

  23. Venkatanarayana
    Posted July 7, 2008 at 3:52 pm | Permalink

    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

  24. Posted July 8, 2008 at 11:04 am | Permalink

    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

  25. Sampath
    Posted August 13, 2008 at 6:09 pm | Permalink

    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

  26. Anoop
    Posted October 31, 2008 at 3:22 pm | Permalink

    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?

  27. Posted October 31, 2008 at 5:34 pm | Permalink

    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.

  28. Ravinder Masuta
    Posted November 25, 2008 at 8:38 am | Permalink

    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.

  29. Posted November 25, 2008 at 4:23 pm | Permalink

    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.

  30. helmut klinger
    Posted January 4, 2009 at 2:40 am | Permalink

    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

  31. Subhendu Sahu
    Posted January 20, 2009 at 10:47 pm | Permalink

    Hi Riaz,
    Can you please explain me the significance of Recordset Sequence in FCC?

    Regards,
    Subhendu

  32. Joel
    Posted February 8, 2009 at 7:10 pm | Permalink

    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.

  33. Kavita
    Posted April 29, 2009 at 1:34 pm | Permalink

    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

  34. Posted April 29, 2009 at 2:44 pm | Permalink

    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.

  35. divya
    Posted May 14, 2009 at 12:45 pm | Permalink

    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

  36. Connie Ressing
    Posted May 21, 2009 at 3:36 am | Permalink

    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

  37. Kavita
    Posted May 26, 2009 at 1:55 pm | Permalink

    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

  38. Deepika
    Posted August 20, 2009 at 5:52 pm | Permalink

    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

  39. Posted August 20, 2009 at 6:17 pm | Permalink

    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.

  40. Mark
    Posted October 20, 2009 at 9:27 am | Permalink

    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

  41. Posted October 20, 2009 at 10:43 am | Permalink

    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).

  42. Mark
    Posted October 20, 2009 at 11:37 am | Permalink

    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

  43. Posted October 21, 2009 at 11:11 am | Permalink

    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.

  44. Mark
    Posted October 21, 2009 at 12:08 pm | Permalink

    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

  45. Posted October 21, 2009 at 3:29 pm | Permalink

    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.

  46. Giridhar Reddy
    Posted October 22, 2009 at 4:48 pm | Permalink

    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

  47. Ank
    Posted January 7, 2010 at 11:55 am | Permalink

    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.

  48. Ramesh
    Posted July 30, 2010 at 12:34 pm | Permalink

    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

    • Posted July 30, 2010 at 2:39 pm | Permalink

      You can easily do this in your mapping program. Map only the fields you need at the target.

Post a Comment

Login with your Facebook or Twitter Account to comment. Alternatively, please fill in the fields marked *.

.

Connect with Facebook

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

CommentLuv Enabled

Subscribe without commenting

GetSocial