cancel
Showing results for 
Search instead for 
Did you mean: 

Isssue while converting a flat file to XML

Former Member
0 Kudos

Hi,

My source flat file structure is in the format as below:
ABD,EFG,LMN

I want to convert it into an XML structure as below in the sender communication channel:
<Record>

       <VIN>ABD</VIN>

       <VIN>EFG</VIN>

       <VIN>LMN</VIN>

</Record>

Request you to help me in giving the MTB parameters to use one field mulitple times in the same node.

Thank you.

Regards,

Subbalakshmi Musunuri

Accepted Solutions (0)

Answers (6)

Answers (6)

ambrish_mishra
Active Contributor
0 Kudos

Hi Subbalaxmi,

You can read the data like below:

MT_Source

Record --- 0.... unbounded

     field1

     field2

     field3

FCC with fieldSeperator ','

this will give you something like below

MT_source

     Record

          <field1>ABD</field1>

          <field2>EFG</field2>

          <field3>LMN</field3>

So in the graphical mapping, you do a straight map:

MT_target

     <Record>   --- 0 --- unbounded

       <VIN>

do duplicate subtree twice on record and then map field1, field2 and field3 to record node like below:

field1 -> exists-> createIf -> Record (0)

field2 -> exists-> createIf -> Record (1)

field3 -> exists-> createIf -> Record (2)

map field1, field2 and field3 directly to VIN.

this should work.

Hope you have understood the logic!

Ambrish

former_member191435
Contributor
0 Kudos

Hi Subbalaxmi,

Can you please send us the sample file, that what you are getting.

Thanks,

Sreenivas

former_member303666
Active Participant
0 Kudos

Hi

source structure:-

My source flat file structure is in the format as below:
ABD,EFG,LMN

Gothrough the below links same as your requirement.

http://www.riyaz.net/sap/xipi-file-content-conversion-for-simple-structure/75/

http://www.riyaz.net/sap/xipi-file-content-conversion-for-complex-structures/79/

http://wiki.sdn.sap.com/wiki/display/XI/Basic+File+Adapter+Content+Conversion

http://www.saptechnical.com/Tutorials/XI/Contentconversion/page1.htm

like so many document document are available please check it do u r work in great way.

Thanks and regards,

Kesava.

Former Member
0 Kudos

Hi All,

Even I am facing the similar problem as Subbalaxmi, but I am getting an error PARSE_PAYLOAD_ERROR.

I am creating the FCC parameters exactly as mentioned in the above help links.

But still getting the error. Can anyone help me into this?

Input and output structures as below:

Input Text file:

H 0298  ABC Tech Test    

BEF0458     A00 017302959ERNEST              HARVEY        S   15 FAIRLAWN CT                                                        HILTON HEAD ISLAN   SC          29926104019400911MM

The XML output File should be:

<Record>

<Detail>

<REC_CTRL>BEF0458</REC_CTRL>

<FILLER></FILLER>

<MEMBER_CODE>A</MEMBER_CODE>

<MEMBER_SEQ_NO>00</MEMBER_SEQ_NO>

<MEMBER_SSN>017302959</MEMBER_SSN>

</Detail>

</Record>

I am using Content Conversion at Sender Adapter, with the following parameters:

Header.fieldFixedLengths        1,4,25,5

Item.fieldFixedLengths             1,2,2,3,8

Header.fieldNames                    Key,Rec_Control,ID,CompName,Text

Item.fieldNames                        Key,REC_TYPE,CLIENT_NO,NAME

Header.endSeparator               'nl'

Item.endSeparator                    'nl'

Header.fieldSeparator              'nl'

Item.fieldSeparator                   'nl'

Header.keyFieldValue    1

item.keyFieldValue       2

Header.keyFieldInStructure   ignore

Item.keyFieldInStructure       ignore

I am getting error PARSE_PAYLOAD_ERROR.

Can anyone please help me into this?

Former Member
0 Kudos

Hi,

  You can achieve this using FCC. In the adapter parameters just mention the field name and the separator.

The other option is use message options:

http://help.sap.com/saphelp_nw04/helpdata/en/24/4cad3baabd4737bab64d0201bc0c6c/content.htm

Regards,

Sainath Chutke

zameerf
Contributor
0 Kudos

Hi,

Is there any specific reason to have same field names multiple times inside same segment?

Because, definitely you cannot create a  DataType with same field name inside same Record.

You can elaborate your requirement, like the scenario and what is expected at receiver side. so that we can think of some solutions.

zameerf
Contributor
0 Kudos

Hi,

I guess i went wrong above, at least you can define one DataType field VIN with occurrence as 1..unbounded under Record. So your source structure would be like

Record                       1..unbounded

     VIN      String        1..unbounded

So you can configure Sender File Content Conversion as below,

DocumentName              : your Message Type name

DocumentNamespace     : your Message Type namespace

Recordset Structure        : Record,*

Recordsets per Message : *

in the table specify below parameter and value,

Record.fieldSeparator: ,

Record.fieldNames: VIN,VIN,VIN

in Record.fieldNames specify VIN max number of times you may expect in a single line.

I hope this should work and solve your problem

-Zameer

aashish_sinha
Active Contributor
0 Kudos

Hi,

To convert a flat file structure into XML in sap xi/pi, you have to use FCC parameters in sender adapter in this case.

Please Follow below links to configure it.

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

http://wiki.sdn.sap.com/wiki/display/XI/File+Content+Conversion

Regards

Aashish Sinha