Skip to Content
avatar image
Former Member

XML to FixedLength String?

Hi everybody,

I have to convert a XML Record to a String with fix field length.

The XML has multiple child elements and I have to Loop over this elements, pick up every single field, fill up the field with a given fieldlength (taken from a commaseperated fieldlength-list and append it to the targetstring.

Has anyone an idea how to realize this?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    Jan 30, 2007 at 10:11 AM

    Hi,

    the source is the following:

    <?xml version="1.0" encoding="UTF-8" ?>

    <MT_RecType>

    <RecType>

    <RecIdent1>01111</RecIdent1>

    <RecIdent2>02222</RecIdent2>

    <Name1>Miller</Name1>

    <Name2>Schulz</Name2>

    </RecType>

    <RecType>

    <RecIdent1>999</RecIdent1>

    <RecIdent2>999</RecIdent2>

    <Name1>Mik</Name1>

    <Name2>Debbie</Name2>

    </RecType>

    <RecType>

    <RecIdent1>888</RecIdent1>

    <RecIdent2>22</RecIdent2>

    <Name1>Joe</Name1>

    <Name2>Doe</Name2>

    </RecType>

    </MT_RecType>

    I want to loop over the RecType and create a string like:

    01111 02222 Miller Schulz /nl999 999 Mik Debbie /nl888 22 Joe Doe /nl

    with the following fieldlegth:

    RecIdent1 = 10

    RecIdent2 = 10

    Name1 = 15

    Name2 = 15

    What I forgot.....

    I have to send this string as an eMail attachment with the mail package. My problem is to fill this in the content field..... sorry!

    Message was edited by:

    Heiko Stach

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Michal Krawczyk

      Michal,

      I dint see that he expects the result in a mial. Apologies for the confusion ands thanks for pointing that.

      Regards,

      Jai Shankar

  • Jan 30, 2007 at 09:48 AM

    Hi,

    Can you give an example?

    Regards

    Bhavesh

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 30, 2007 at 09:55 AM

    Hi,

    if you need to create file with FixedLengths all you need

    to use is content conversion

    BTW

    you can also use content conversion with many other adapters

    (JMS, SOAP etc.)

    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>

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 30, 2007 at 11:25 AM

    Hi,

    I hope this can be possible with MAIL adapter with configurations,but no need to use file adapter ,

    see below link

    http://help.sap.com/saphelp_nw2004s/helpdata/en/23/c093409c663228e10000000a1550b0/content.htm

    Regards

    Chilla..

    Add comment
    10|10000 characters needed characters exceeded