cancel
Showing results for 
Search instead for 
Did you mean: 

FCC : XML to CSV

Former Member
0 Kudos

Hi Experts,

My scenario is convertion of XML to CSV format.

Source XML structure is similar like,

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

<ns0:ZTEST_TIPS_DOI_NEW1 xmlns:ns0="urn:sap-com:document:sap:rfc:functions">

   <ZMAT_TAB>

      <item>

         <MANDT/>

         <MATNR/>

         <MAKTX/>

         <ERSDA/>

         <BRGEW/>

         <GEWEI/>

      </item>

   </ZMAT_TAB>

</ns0:ZTEST_TIPS_DOI_NEW1>

Already gone through some thread in SNC.Like,

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

Is it possible to convert through FCC standard adapter module?

Thanks,

Arthita

Accepted Solutions (1)

Accepted Solutions (1)

azharshaikh
Active Contributor
0 Kudos

Hi Arthita,

Yes, XML to CSV conversion can be achieved using standard FCC configuration option in Receiver channel.

Please check following for reference:

Regards,

Azhar

Answers (5)

Answers (5)

engswee
Active Contributor
0 Kudos

Hi Arthita

Your XML structure is having more levels than FCC can handle.

Your structure:

ns0:ZTEST_TIPS_DOI_NEW1 - Root

ZMAT_TAB - Level 1

item - Level 2

Based on the description in the online help, you can only have two levels - Root and Level 1

Converting XML in the Receiver File/FTP Adapter to Text Format - Configuring the File/FTP Adapter in...


●  The expected XML structure contains the structure as nodes filled with any number of elements without additional subnodes.

●  The expected document structure usually looks like this:

<root>...

  <nameA>

    <value1>value</value1>

  <value2>value</value2>

  <value3>value</value3>

  </nameA>

  <nameB>

  <value4>value</value4>

  </nameB>

...

</root>...

I would suggest you map the RFC structure to another structure which has only root and level 1. It would look something like below:-

<ns0:Z_INTERMEDIATE_STRUCTURE xmlns:ns0="anynamespace">   <-- Root

  <item>     <-- Level 1

    <MANDT/>

    <MATNR/>

    <MAKTX/>

.....

  </item>

</ns0:Z_INTERMEDIATE_STRUCTURE>

Rgds

Eng Swee

Former Member
0 Kudos

Hi Eng,

1.Actually, When importing the RFC from ECC to PI its showing that structure automatically, because extracting data from one ZTable.

Is there any other way to write?but have to extract data from one Z-table.

2.Another point is,but when use "node.endSepatator" as | its taking properly, but why not new line?(referring  another reply to Srikanth )

3.And If all are same, if there any other way to achieve the same?

Thanks,

Arthita

engswee
Active Contributor
0 Kudos

Hi Arthitha

For 1, yes, that is the default structure based on ECC RFC. What I was suggesting is to add an Operation mapping to map it to a 2-level structure. No changes on the RFC side.

However, if you already have most of it working based on Srikanth's reply, you might want to try and see if you can resolve that first.

If you can view it correctly in AL11, then maybe it might be due to Carriage Return/Line Feed differences. These are different in different OSes. I suggest you set your FileZilla transfer to Binary mode and download the file again. Then view it in Notepad++ (Notepad alone does now display the CRLF)

Rgds

Eng Swee

Former Member
0 Kudos

Hi Eng,

As per your suggestion put one intermediate MM in OP,

and the MM's are,

but same problem occurs..need to mentioned anything else?

Thanks,

Arthita

engswee
Active Contributor
0 Kudos

Hi Arthita

Can you show screenshots of your FCC configuration, and also the target payload (after mapping)?

Did you also check on the Binary mode file transfer I mentioned above?

Rgds

Eng Swee

Former Member
0 Kudos

Sure..here it is..

engswee
Active Contributor
0 Kudos

Hi Arthita

In your Recordset Structure, just maintain Item (remove MT_CSV_R)

For the parameters part, remove those lines with MT_CSV_R and ZMAT_TAB, and maintain only the following 3 parameters for Item

NameValue
Item.fieldNamesMANDT,MATNR,MAKTX,ERSDA,BRGEW,GEWEI
Item.fieldSeparator|
Item.endSeparator'nl'

Rgds

Eng Swee

Former Member
0 Kudos

Hi,

Yes, already mentioned Binary Mode in filezilla. And also change the Recordset Structure and parameters part as you mentioned,but output is same..

Thanks

Arthita

engswee
Active Contributor
0 Kudos

Hi

Can you also set Binary mode in your receiver adapter?

What does the file look like in AL11?

Can you provide screenshot of XML output (before FCC) and also file output in FTP?

Rgds

Eng Swee

Former Member
0 Kudos

Yes,already set Binary mode in receiver adapter.

AL11 look is,

XML output,

But when put | as endSeparator its working..

Thanks,

Arthita

engswee
Active Contributor
0 Kudos

What is the transfer mode in your receiver adapter? Can you try to set that as Text?

Also, after the output created, change the Filezilla transfer mode as Text when you try to download it to view.

srikanthe_sapxi
Explorer
0 Kudos

Hi Arthita,

for .CSV file in-order to generate the new line, pls use endSeparator - '0x0D"0x0A'

Regards,

Srikanth

Former Member
0 Kudos

Hi Srikanth,

When opening the al11 its showing proper data

but after downloading into Desktop by FileZilla

but when use node.endsepatator as | its taking properly...

then what should do?

Thanks,

Arthita

Bhargavakrishna
Active Contributor
0 Kudos

Hi Arthita,

Refer below link

XI/PI: File Content Conversion for Simple Structure

Regards

Bhargava Krishna

markangelo_dihiansan
Active Contributor
0 Kudos

Hi,

Can you show us a sample CSV that you intend to convert this XML to?

Regards,

Mark

iaki_vila
Active Contributor
0 Kudos

Hi Arhita,

Of course it is possible. Have you tried the Riyaz example?, with the parameter FieldSeparator you  won't have any problems.

Regards.

Former Member
0 Kudos

Hi Inaki,

XML to CSV conversion is done and Content conversion parameters are

But after downloading the .csv file from PI server through FileZilla into my desktop it not populating record in separate line,

Expected data format is like this ,

Please suggest how to achieve this?

Thanks,

Arthita

Former Member
0 Kudos

Hi ,

Please suggest some wayout ...

Thanks,

Arthita