Skip to Content
avatar image
Former Member

File Content Conversion question

Hello Guru's,

Ive the following flat file:

ZWL;Ordertype

00Z0;Organisation

And I want to get the following XML structure:

<Ordertype>ZWL</Ordertype>

<Organisation>00Z0</Organisation>

So just the words before (😉

How can I define this in FCC, what parameters do I have to set?

Kind Regards,

Kamran

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

5 Answers

  • avatar image
    Former Member
    Oct 24, 2007 at 06:15 PM

    Hey

    i don't think u can filter the content in FCC,what you could do is that get all the values in ur data type(you need to change the DT for this) but map only the ones u need.

    Thanx

    Aamir

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 24, 2007 at 07:23 PM

    Hi,

    you can use the parameters explained in the help.sap page:

    http://help.sap.com/saphelp_nw04/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/frameset.htm

    mainly you have to specify the parameter that divide the content of the file ( ';' in your case)

    Then you can map the fields in the message mapping using a defined function that checks the two fields and map it to the correct target field. I mean, in your XML you'll have somithing like:

    <data>

    <element1>Ordertype</element1>

    <element2>ZWL</element2>

    </data>

    you check what the data is in the element1, if ordertype then you map it to order type, if not, organization..

    hope this helps.

    Eduardo.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 24, 2007 at 08:06 PM

    Hi Kamran !

    Your source flat file does always have the same structure? I mean, you always have Ordertype and Organisation?

    I don't think that a dynamic message structure is possible. Your source/target xml message type should be fixed, maybe with optional fields...

    One thing you can do, is have an advanced UDF in graphical mapping that receives (using your example) 3 parameters, one for the first field , one for the second field and one for a constant that states which field you need to output. Then map the output of this function to the target field. If the target field is "Organisation", then the third parameter of that function should have a constant "Organisation" in that place.

    Regards,

    Matias.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 25, 2007 at 06:28 AM

    Hi Kamran,

    <b><Ive the following flat file:

    ZWL;Ordertype

    00Z0;Organisation

    And I want to get the following XML structure:

    <Ordertype>ZWL</Ordertype>

    <Organisation>00Z0</Organisation>

    So just the words before (;)></b>

    As per your above example i can give you some idea how to do that.

    1. Create your data type like this

    OrderType

    Filler1

    Organisation

    Filler2

    .

    .

    .

    2. While doing your message mapping map only OrderType & Organisation to target fields (do not map any fillers)

    Now, in your FCC pick all the fileds separated by semi colon (;). By doing so you will get all the data in seprate fields and thus after mapping you will your desired result.

    FCC parameters to be used.

    Recordset Structure ITEM,*

    ITEM.fieldNames ordertpe,filler1,organisation,filler2..............etc

    ITEM.fieldSeparator ';'

    Regards,

    Sarvesh

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 25, 2007 at 06:45 AM

    Hi Kamran,

    U need to pick up both the fields seperated by ; to diff between the Ordertype and Organization i.e the second field is going to be the key field.

    Declare the Source DT as

    DT

    ---OrdTyp

    -


    Ordertype

    -


    Desc

    ---Org

    -


    Organisation

    -


    Desc

    Use the FCC.

    Document Name : MT_Name

    Document Namespace : Namespace

    Recordset structure = Ordertype,,Org,

    OrdTyp.fieldnames = Ordertype,Desc

    OrdTyp.fieldSeparator = ,

    OrdTyp.keyField = Desc

    OrdType.KeyFieldValue = Ordertype

    OrdTyp.endSeparator = 'nl'

    Org.fieldnames = Organisation,Desc

    Org.fieldSeparator = ,

    Org.keyField = Desc

    Org.KeyFieldValue = Organisation

    Org.endSeparator = 'nl'

    Regards

    San

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Kamran !

      You can first map this xml structure to a flat one, that is, without hierarchies, removing the general, partner, position and text tags and making all nodes depending on the root (order)..based on the idea that you always have exactly one general, one partnet, one position, etc.

      You could do this with a second message mapping program, chained to the one that outputs the xml structure you posted, in the interface mapping object.

      Then the File Content Conversion of this flat structure (without hierarchies) will be straight forward.

      Regards,

      Matias.