cancel
Showing results for 
Search instead for 
Did you mean: 

CSV File Content Conversion

Former Member
0 Kudos

Hello, I have a litte problem with the File-Adapter and the File Content Conversion.

We get csv-files in which are 2 structures

the first row contents headerinformations like invoicenumber and sumfields.

The following rows contents item-informations.

I want to convert the file in a xml-format like this:

<invoice>

<invoiceheader>

.... (information from the first row)

</invoiceheader>

<itemlist>

<item>

... (information from 2. row )

</item>

<item>

... (information from 3. row )

</item>

....

<item>

... (information from last row )

</item>

</itemlist>

</invoice>

The csv-file looks like this:

In the csv-file i have no keys which determine the kind of row. I only know that the first row contains the headerinformation and the following rows (2. until last) contains the item informations.

Any idea ?

Kindly regards

Detlef Breitwieser

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hello anybody !

I want the conversion is done by the file-adapter -

and i have no keyvalues - that's the problem.

I only know - the 1. row contains the headerstructure and the following rows contains the itemstructure.

I configured the Fileadapter with this paramters (for an example)

xml.recordsetStructure=HeaderSum,1,Item,60000

xml.recordsetName=AvisRechnung

xml.recordsetsPerMessage=*

xml.documentName=Avis

xml.HeaderSum.fieldSeparator=;

xml.HeaderSum.structureTitle=head

xml.HeaderSum.fieldNames=head1,head2,head3,head4,head5,head6,head7,head8

xml.Item.fieldSeparator=;

xml.Item.structureTitle=item

xml.Item.fieldNames=item1,item2,item3,item4,item5,item6,item7,item8,item9

The Csv-File is this:

79;1616243;0;20050706;200401;RWE_DEBIT_AVIS_200401.txt;200401;978;

;R0921018;KM;IT;PROAUTO S.A.S.;DI S PRODAN & C;VIA AQUILEIA C/O APT GIULIANO;RONCHI DEI LEGIONARI (GO);IT00503570319

8,72325E+11;R0921013;KM;DE;AVIS AUTOVERMIETUNG GMBH&CO.KG;ZIMMERSMUEHLENWEG 21;61437 OBERURSEL, GERMANY;ST.NR.003/225/14000;DE-1650-38-067

8,72325E+11;R0921041;KM;DE;AVIS AUTOVERMIETUNG GMBH&CO.KG;ZIMMERSMUEHLENWEG 21;61437 OBERURSEL, GERMANY;ST.NR.003/225/14000;DE-1650-38-067

And the converted xml-file is :

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

<Avis>

<AvisRechnung>

<head>

<head1>79</head1>

<head2>1616243</head2>

<head3>0</head3>

<head4>20050706</head4>

<head5>200401</head5>

<head6>RWE_DEBIT_AVIS_200401.txt</head6>

<head7>200401</head7>

<head8>978</head8>

</head>

<item>

<item1></item1>

<item2>R0921018</item2>

<item3>KM</item3>

<item4>IT</item4>

<item5>PROAUTO S.A.S.</item5>

<item6>DI S PRODAN &amp; C</item6>

<item7>VIA AQUILEIA C/O APT GIULIANO</item7>

<item8>RONCHI DEI LEGIONARI (GO)</item8>

<item9>IT00503570319</item9>

</item>

<item>

<item1>8,72325E+11</item1>

<item2>R0921013</item2>

<item3>KM</item3>

<item4>DE</item4>

<item5>AVIS AUTOVERMIETUNG GMBH&amp;CO.KG</item5>

<item6>ZIMMERSMUEHLENWEG 21</item6>

<item7>61437 OBERURSEL, GERMANY</item7>

<item8>ST.NR.003/225/14000</item8>

<item9>DE-1650-38-067</item9>

</item>

<item>

<item1>8,72325E+11</item1>

<item2>R0921041</item2>

<item3>KM</item3>

<item4>DE</item4>

<item5>AVIS AUTOVERMIETUNG GMBH&amp;CO.KG</item5>

<item6>ZIMMERSMUEHLENWEG 21</item6>

<item7>61437 OBERURSEL, GERMANY</item7>

<item8>ST.NR.003/225/14000</item8>

<item9>DE-1650-38-067</item9>

</item>

</AvisRechnung>

</Avis>

But i want to group the items in an item with name <itemlist>. In this case the items appears under the node <AvisRechnung>

Former Member
0 Kudos

Hi

First of all in Sender Adapter set the message protocol as <b>File COntent Conversion</b>.

According to me the parameters should look like this

<b>Content Conversion Parameters</b>

documentName= Avis

documentnamespace= ur scenario namespace

recordsetName= AvisRechnung

recordsetStructure= head,1,item,60000

head.fieldSeparator= ;

head.fieldNames= head1,head2,head3,head4,head5,head6,head7,head8

head.processFieldNames=fromConfiguration

head.endSeparator='nl'

item.fieldSeparator= ;

item.fieldName=item1,item2,item3,item4,item5,item6,item7,item8,item9

item.processFieldNames=fromConfiguration

item.endSeparator='nl'

Set the parameters as follows and then chk it.

>><i><b>i have no keyvalues - that's the problem</b></i>

Keyvalues parameter is used only when u don't know how many item's are going to come i.e. if it is <b>*</b>, but i think the max number are 60000 so there is no need of Keyvalues parameter.

Hope it helps.

Regards

Arpit Seth

stefan_grube
Active Contributor
0 Kudos

This is not possible. You cannot have more hierarchy levels in file content conversions.

You have to define a mapping to have the structure, you want finally.

Regards

Stefan

Former Member
0 Kudos

Hi Stefan,

I have an input text file structure as follows:


1: Header
2: Item
3: Item Text
2: Item
3: Item Text

Per you previous post, are you saying it is not possible to make this file structure from a text file:


<?xml version="1.0"?>

<ns:Orders xmlns:ns...>
  <Order>
    <Header>
      <Some header fields/>
    </Header>
    <Item>
      <posn>0010</posn>
      ...
      <Text>
        <lang>EN</lang>
        <text>Order Header Text</text>
      </Text>
    </Item>
    <Item>
      ...
    </Item>
  </Order>
</Orders>

If we have to flatten the structure, it would be very difficult to identify the parent-child relationship between segments.

Many thanks,

Derek

stefan_grube
Active Contributor
0 Kudos

Hi Derek,

in this case it is possible, as <i>item</i> and <i>item text</i> is a 1:1 relationship and you have only one header.

Just use the graphical mapping tool.

It is not possible to create that structure with the file content conversion.

Regards

Stefan

Former Member
0 Kudos

Hi Derek,

Only 2 level of Hierarchy conversion is possible through field content conversion. In your case Item text is 3rd level hierarchy so it is not possible.

You can convert a flat file into deep nested structure (more than 2 levels) in mapping program or in sender file adapter by writing a module.

Cheers,

Satish

Former Member
0 Kudos

hi Detlef,

To generate the required XMl file, u need to make some configuration settings in Sender File Adapter.

I'll suggest you to please go through some links first.

Please go through this weblog:

How to process CSV data with XI file adapter by Michal Galczynski

/people/sap.user72/blog/2005/01/06/how-to-process-csv-data-with-xi-file-adapter

also go through this link:

Configuring the sender file adapter

http://help.sap.com/saphelp_nw04/helpdata/en/e3/94007075cae04f930cc4c034e411e1/frameset.htm

I hope it helps,

Thanks & Regards,

Varun Joshi

Former Member
0 Kudos

Hi,

Please have a look at the blogs mentioned below:

/people/venkat.donela/blog/2005/06/08/how-to-send-a-flat-file-with-various-field-lengths-and-variable-substructures-to-xi-30

/people/arpit.seth/blog/2005/06/02/file-receiver-with-content-conversion

/people/anish.abraham2/blog/2005/06/08/content-conversion-patternrandom-content-in-input-file

/people/michal.krawczyk2/blog/2004/12/15/how-to-send-a-flat-file-with-fixed-lengths-to-xi-30-using-a-central-file-adapter

your data type should look like :

Invoice

Invoiceheader

invoicenum

field1...

Itemlist

item (0 to unbounded)

Please revert back for further clarifications.

Good Luck.

Priyanka