Skip to Content
avatar image
Former Member

How to convert the flat file to XML without Record type identifiers /Key field value

Hi All,

We have a requirement to convert a flat file with Header, Detail and trailer record into XML. I got the record type identifier (Key field value) for only Header and trailer record but not for Detail record.

Is there any way to handle detail records without key field value in content conversion?

Thanksℜgards,

Akhila.A

Add comment
10|10000 characters needed characters exceeded

  • Former Member

    Thanks Akhila for closing the question, it always helpful for others whoever come across this question in future, they can quickly find the answer.

  • Get RSS Feed

5 Answers

  • Best Answer
    avatar image
    Former Member
    Oct 18, 2016 at 10:29 AM

    Hi Akhila,

    Read the file as simple structure and split header and footer in the message mapping, i have mentioned all the steps in below blog.

    Read File Using FCC Some with Key and Some without Key

    Regards,

    Praveen.

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 17, 2016 at 04:42 AM

    Hello Akhila,

    See if the below discussion helps

    https://archive.sap.com/discussions/thread/3746518

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 18, 2016 at 06:55 AM

    Hi Ragha,

    Thanks for the thread . The conclusion form the thread are:

    1.To use Eng'sAdapter module

    2.To take the entire file in one line and split it in mapping

    I would like to go with oprion 2 : But fields are not fixed length in my case .Fields are seperated by comma. Is there any way to split the fields based on comma and map it to the target structure.

    By the way how should I give points to your answer ?

    Thanksℜgards,

    Akhila.A

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 18, 2016 at 07:09 AM

    Hi Akhila!

    The easiest way to split the string in java is to use String.split() method:

    String srcStr = "aaa,bbb";
    
    String[] tokens = srcStr.split(",");
    
    String part1 = tokens[0];   //aaa
    
    String part2 = tokens[1];   //bbb

    You should consider not using commas inside your field values or provide the special logic for such cases.

    To give points to Raghu just click up arrow below his avatar.

    Regards, Evgeniy.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 18, 2016 at 08:15 AM

    Thank you Evgeniy will come back

    Add comment
    10|10000 characters needed characters exceeded