cancel
Showing results for 
Search instead for 
Did you mean: 

PI unable to generate XLSX file

arijit_mukherjee2
Participant
0 Kudos

Hello Experts,

I have one scenario where I have to generate ".XLSX" file and I have followed the below post by Aashish Sinha.

The output file is generated with ".xlsx" however while we are trying open the file,it is saying that the file is corrupt.If we change the extension manually to ".xls" then it opens,though it gives a warning. We need to generate a proper ".XLSX" file which could be opened without any warning.

Can any one advise if there is any way to have that? Appreciate your help!!

Note:I tried the JAVA mapping and got same problem.

Regards,

Arijit

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Arijit

Have you tried the JExcel API?

If not then you can have a look on the below

CODE - Create an Excel File via the JExcel API - Process Integration - SCN Wiki

arijit_mukherjee2
Participant
0 Kudos

Hi Indrajit,

Are there any way instead of writing an adapter module?

Thanks,

Arijit

Former Member
0 Kudos

Hi Arijit

Use java mapping rather than adapter module. Adapter module is difficult to maintain.

arijit_mukherjee2
Participant
0 Kudos

Thanks Indrajit,Do you have any sample code for JAVA mapping or any example?

Thanks,

Arijit

Former Member
0 Kudos

Hi Arijit

The link I have provided has the code . Only you need to use them inside a java mapping.

You can find thousands of blog on Java mapping in SAP PI.

This is simple format of java mapping

import com.sap.aii.mapping.api.AbstractTransformation;

import com.sap.aii.mapping.api.StreamTransformationException;

import com.sap.aii.mapping.api.TransformationInput;

import com.sap.aii.mapping.api.TransformationOutput;

public class JavaMapForHemant extends AbstractTransformation {

  public void transform(TransformationInput arg0, TransformationOutput arg1)

  throws StreamTransformationException {

  try {

 

  } catch (Exception e) {

  e.printStackTrace();

  }

  } // end of transform

}

You need to write your code inside the transform method.

arijit_mukherjee2
Participant
0 Kudos

Thanks Indrajit,But here I have the input in XML which looks like below.

<MT_TEST>

<Records>

<Name1>

<Name2>

</Records>

<Records>

....

...

</Records>

</MT_TEST>

Now I need to write the EXCEL(.xlsx) file with two header Name1 and Name2. Can you please help me with the code? Appreciate your kind help!!

Thanks,
Arijit