cancel
Showing results for 
Search instead for 
Did you mean: 

File Content Conversion

Former Member
0 Kudos

basically I like to treat entire record as one field with structure as follows:

Rec1

Rec2

Rec3

I need convert this into XML as follows

<File>

<Record>Rec1</Record>

<Record>Rec2</Record>

<Record>Rec3</Record>

</File>

To do this I would like to what values I need to give for fieldseparator( 'nl' ???) and endseparator( this is end of file )

Please note I have only One field which is <Record> with 0 to unbounded

I did some testing with following values

RecordStructure = Source,1

Source.fieldSerparator = 'nl'

Source.fieldNames = Record

Its producing like this Which is not I wanted.

<File>

<Record>Rec1</Record>

</File>

<File>

<Record>Rec2</Record>

</File>

<File>

<Record>Rec3</Record>

</File>

I would like to produce

<File>

<Record>Rec1</Record>

<Record>Rec2</Record>

<Record>Rec3</Record>

</File>

Inorder to do this I should be able to distinguish between newline and endoffile conditions.

newline is 'nl'

and what is end of file ?

Also what ever parameters I gave , are they correct?

Would someone please explain. Thanks

Accepted Solutions (0)

Answers (2)

Answers (2)

moorthy
Active Contributor
0 Kudos

Hi,

You can try with ignoreRecordset and check this ..Probably it works.

Otherwise, you can think with normal content conversion i.e with key values.

Have a look into this content conversion -

http://help.sap.com/saphelp_nw2004s/helpdata/en/2c/181077dd7d6b4ea6a8029b20bf7e55/content.htm

Regards,

Moorthy

Former Member
0 Kudos

Moorthy, infact i was using ignoreRecordsetName = true since my first try.

What do u mean by normal content conversion ( with key values) ?

for my scenario whole record is treated as a field.

and Message_Tpe XSD will simiral to

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

<ns0:Source xmlns:ns0="http://test.com">

<Source>

<Record>record1</Record>

<Record>record2</Record>

</Source>

</ns0:Source>

Do I ran out choices here ?

moorthy
Active Contributor
0 Kudos

If you want to get as you told, I think you need to tell that, Under Source Segment, you have multiple Records .then you will get required output.

For this, you need to define key value i.e multiple occurences of Record segment with differentiating the key values.

the given link in my previous post explains the same, Just compare with your case.

Also refer this blog-

/people/sravya.talanki2/blog/2005/08/16/configuring-generic-sender-file-cc-adapter

Regards,

Moorthy

Former Member
0 Kudos

Moorthy, in my case its a freeform record and donot have specific values to identify keys.

Former Member
0 Kudos

Hi Ram

I think you dont need to use fieldseparator when your record has only one field, can you try using this -->

RecordStructure = Source,1

Source.fieldNames = Record

Source.endSeparator = 'nl'

Pls. dont use

Source.fieldSerparator = 'nl'

Let me know.

- Lalit -

Former Member
0 Kudos

Sorry to say adapter is giving error

here is error.

2006-09-27 20:40:33 EDT: Error: Conversion initialization failed: Exception: java.lang.Exception: java.lang.Exception: Error(s) in XML conversion parameters found:

Parameter 'Source.fieldFixedLengths' or 'Source.fieldSeparator' is missing

Consistency check: no. of arguments in 'Source.fieldFixedLength' does not match 'Source.fieldNames' (0 <> 1)

Former Member
0 Kudos

Ram

Can you try using all 4 of them -->

RecordStructure = Source,1

Source.fieldNames = Record

Source.endSeparator = 'nl'

Source.fieldSerparator = 'nl'

- Lalit -

Former Member
0 Kudos

yes I did. no Use.. it still produces same .

<ns:Source xmlns:ns="http://test.com">

- <Source>

<Record>first line</Record>

</Source>

- <Source>

<Record>this 2nd line</Record>

</Source>

- <Source>

<Record>Last Line</Record>

</Source>

</ns:Source>

Message was edited by: Ram Krish