cancel
Showing results for 
Search instead for 
Did you mean: 

File Content Conversion

former_member192181
Participant
0 Kudos

I have a file where each field is seperated by newline and each record is seperated by '~' as below

~

02344

xyz

234.00

~

9807

asdd

3456.00

My target had to come as below

<header>

<id>02344</id>

<name>xyz</name>

<amount>234.00</amount>

</header>

<header>

<id>9807</id>

<name>asdd</name>

<amount>3456.00</amount>

</header>

Please provide me the parameters and parameter values to be used in FCC in sender File adapter

Thanks,

Lalitha

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Lalitha

There is no standard way to do this FCC because the filed separator is new line. If you use new line 'nl' as field separtor, then you will not get the desired structure.

The easiest solution will be writting a java mapping for the same. The java map will read the file and populate the output strcuture.

If you need any help on java mapping , then provide me the test file and output structure. I will provide you the code.

Former Member
0 Kudos

Indrajit,

I have similar requirement.

One record/file and each field separated by new line. In this scenario also do i need to create java mapping?

Source file:

1

0.0

Original

12345

US

Appreciate your response on this.

Answers (4)

Answers (4)

former_member192181
Participant
0 Kudos

Thanks for the Solution. I have Asked our JAva developer to create the staructure which I was telling.

ambrish_mishra
Active Contributor
0 Kudos

Hi Lalitha,

IMO, there is no standard way to read such a file unless other forum members have a standard solution.

However, I can suggest a workaround.

Read the file with records having just one field.

The data in PI will look something like below:

<Record>

     <field>~<\field>

      <field>02344<\field>

     <field>xyz<\field>

     <field>234.00<\field>

     ...............

          ..................

<\Record>

Have a 2 step mapping in ESR.

In the first mapping, use a UDF and look for tilda ~ in the field queue. after tilda, first value of field will be id, second value name and third value amount... and so on. Use a while loop....

Generate a intermediate structure like below.

In first mapping,

<header>

<id></id>

<name></name>

<amount></amount>

</header>

in the second mapping, do whatever is the mapping requirement.

Hope it helps!

Ambrish

Bhargavakrishna
Active Contributor
0 Kudos

Hi Lalitha,

Please refer the below link for the possible options

https://scn.sap.com/thread/2128819

Regards

Bhargava krishna

santosh_k3
Active Participant
0 Kudos

Hi Lalitha,

Use this link to configure the FCC parametes http://help.sap.com/saphelp_nw04/helpdata/en/2c/181077dd7d6b4ea6a8029b20bf7e55/content.htm

Try with these parameters in FCC:

NameA.fieldSeparator: 'nl'

NameA.endSeparator =  ~

Regards

Sai