cancel
Showing results for 
Search instead for 
Did you mean: 

Change CSV to Excel in the Receiver Comm Channel

Former Member
0 Kudos

Is there a way to insert custom code to change the FCC comma delimited (.csv) into an Excel file in the receiver communication channel file adapter? If so, how do I do this in XI? Thanks.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Kristine,

Please help me with below thread

Former Member
0 Kudos

Hi,

Hope this helps you

Former Member
0 Kudos

I created my mapping using the SAP XI GUI mapping and used the File adapter's FCC comma delimited in the Receiver comm channel.

Is there a way to plug in custom code in XI to convert the comma delimited file to Excel before the File adapter FTPs the file to the target? Would I use the module to do this?

Former Member
0 Kudos

hello ,

just try like this

use MessageTransformBean in the receiver module and specify the parameters

ContentType text/vnd-excel (check the mime type of excel) and check it out

Rajesh

Shabarish_Nair
Active Contributor
0 Kudos

changing the content type would wouldnt work

ref: /people/michal.krawczyk2/blog/2005/12/10/xi-generating-excel-files-without-the-java-nor-the-conversion-agent-not-possible

Edited by: Shabarish Vijayakumar on Mar 26, 2009 11:01 PM

Former Member
0 Kudos

Where do I find the MessageTransformBean and what parameters should I put?

Is this for the receiver File adapter communication channel?

Former Member
0 Kudos

If changing the content type wouldn't work, what do you suggest? Is XSLT mapping the only way to create an Excel file from XML?

I already did my mapping using the SAP XI GUI so I would prefer to reuse this mapping rather than the XSLT mapping. How can I create an Excel file using the SAP XI GUI mapping?

Shabarish_Nair
Active Contributor
0 Kudos

> I already did my mapping using the SAP XI GUI so I would prefer to reuse this mapping rather than the XSLT mapping. How can I create an Excel file using the SAP XI GUI mapping?

unfortunately not possible with the GUI mapping

Former Member
0 Kudos

So there is no way to insert custom code to convert the comma delimited file to Excel in the receiver file adapter comm channel?

Shabarish_Nair
Active Contributor
0 Kudos

you will have to the write an adapter module to handle that

Former Member
0 Kudos

Kristine,

I agree completely with Shabz on this.

But what exactly is your requirement? Do you need exactly the .xls(x) file as your output? If you dont care about this, then try saving the file with extension .csv By default the comma separated value file can be rendered in MS-Excel in separate columns.

Regards

Jai

Former Member
0 Kudos

The target can only handle Excel 2003. It cannot accept the .csv file.

How would I go about creating the adapter module? Do I assume its going to be from the csv file then transform that message to Excel? Or will it be from the XML file generated by my SAP XI GUI mapping?

Shabarish_Nair
Active Contributor
0 Kudos

well there are many java apis available that can help you create an excel file. So in that case you will ahve to use these apis in a module and manipulate your payload to get the desired output.

one such api is this - http://www.java-tips.org/other-api-tips/jexcel/how-to-create-an-excel-file.html

Shabarish_Nair
Active Contributor
0 Kudos

>

> The target can only handle Excel 2003. It cannot accept the .csv file.

> How would I go about creating the adapter module? Do I assume its going to be from the csv file then transform that message to Excel? Or will it be from the XML file generated by my SAP XI GUI mapping?

it would be the XMl created by the GUI mapping that will be input to the module

to create a module - https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3bdc14e1-0901-0010-b5a9-a01e29d7...

Former Member
0 Kudos

>>Do I assume its going to be from the csv file then transform that message to Excel? Or will it be from the XML file generated by my SAP XI GUI mapping?

It is really your choice here. If you want to convert the xml file to excel, then all you need is an adapter module that makes use of one of the Java APIs to do the trick. But if you want to convert the xml file to csv and then finally to a excel file, you can achieve this using standard sap adapter module (forgot the exact name, I guess it is XMLtoplain bean) I believe this option would be easier.

Former Member
0 Kudos

>

> It is really your choice here. If you want to convert the xml file to excel, then all you need is an adapter module that makes use of one of the Java APIs to do the trick. But if you want to convert the xml file to csv and then finally to a excel file, you can achieve this using standard sap adapter module (forgot the exact name, I guess it is XMLtoplain bean) I believe this option would be easier.

Ideally, I just want to convert the XML to Excel. Which way would be the better route to do this without having to use XSLT mapping because I want to reuse the SAP XI GUI mapping I already created.

Former Member
0 Kudos

Kristine,

I did not mean you to use XSLT mapping. You can write your adapter module that will either process the XML file (direct from your GUI Mapping) or CSV file (using GUI mapping again but passed through another standard adapter module that converts your xml file to csv) This method is preferable coz in your adapter module it will be easier for you to parse and get the fields.

Regards

Jai

Former Member
0 Kudos

>

> Kristine,

>

> I did not mean you to use XSLT mapping. You can write your adapter module that will either process the XML file (direct from your GUI Mapping) or CSV file (using GUI mapping again but passed through another standard adapter module that converts your xml file to csv) This method is preferable coz in your adapter module it will be easier for you to parse and get the fields.

>

> Regards

> Jai

Thanks Jai. I will try your recommendation from GUI mapping to CSV to Excel.

Can you please confirm if I understand the process correctly...

GUI Mapping -> Adapter Module 1 that converts XML to CSV -> Adapter Module 2 that converts CSV to Excel -> File Adapter (FTP)

Questions:

1. Is there a standard SAP XI adapter module that can do Module 1?

2. Is there a standard SAP XI adapter module that can do Module 2?

Please give me more information about the modules because I haven't used them before. Thank you for all your help!

Kristine

Shabarish_Nair
Active Contributor
0 Kudos

> GUI Mapping -> Adapter Module 1 that converts XML to CSV -> Adapter Module 2 that converts CSV to Excel -> File Adapter (FTP)

>

> Questions:

> 1. Is there a standard SAP XI adapter module that can do Module 1?

> 2. Is there a standard SAP XI adapter module that can do Module 2?

>

> Please give me more information about the modules because I haven't used them before. Thank you for all your help!

>

> Kristine

You flow should ideally be

GUI Mapping (XML) -> Adapter Module -> File adapter

Note modules are extensions to file adapter.

Ref:

How to create modules -

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3bdc14e1-0901-0010-b5a9-a01e29d7...

XI JAVA User Module Development using NWDI -

/people/community.user/blog/2007/12/21/xi-java-user-module-development-using-nwdi

Former Member
0 Kudos

>>Can you please confirm if I understand the process correctly...

GUI Mapping -> Adapter Module 1 that converts XML to CSV -> Adapter Module 2 that converts CSV to Excel -> File Adapter (FTP)

Your understanding is perfectly correct.

>>1. Is there a standard SAP XI adapter module that can do Module 1?

Yes. Take a look at the strictXMLtoplain bean. Ref:

http://help.sap.com/saphelp_nw70/helpdata/EN/44/748d595dab6fb5e10000000a155369/content.htm

>>2. Is there a standard SAP XI adapter module that can do Module 2?

No. This has to be your own custom developed adapter module.

Regards

Jai

Former Member
0 Kudos

Thank you very much for all your help. I decided to go the XSLT route.

Here are the steps I took to create an XSLT transformation in XI 3.0:

1. I created my source and target XSDs using XMLSpy.

2. I created the XSLT mapping from source to target in XMLSpy (referencing the souce XSD schema).

3. I created another XSLT mapping to format the target into Excel XML.

4. Import the source and target XSDs in the IR's External Definitions

5. Zip each XSLT mapping (.xls) and import it into the IR's Imported Archives

6. Reference the XSL mappings in the Interface Mapping

Shabarish_Nair
Active Contributor
0 Kudos

FYI ~~~

/people/shabarish.vijayakumar/blog/2009/04/05/excel-files--how-to-handle-them-in-sap-xipi-the-alternatives

this might make a good read in your case in case you find time