cancel
Showing results for 
Search instead for 
Did you mean: 

Download to Excel using xsjs

Former Member
0 Kudos

Hello Experts,

I have created a UI5 Table based on Calculation View. Now I want to download this table to Excel.

I know that it can be done using XSJS

I have also checked Thomas Blog for downloading excel:

But my problem is how to pass input parameters to my XSJS file and in case any of the Input parameter is empty, how to handle that situation

Regards,

Rohit

Accepted Solutions (1)

Accepted Solutions (1)

thomas_jung
Developer Advocate
Developer Advocate

You pass input parameters via URL parameters in XSJS generally.  There are many examples of this in the online help and other various learning materials.

For input parameters that aren't passed as URL parameters I usually do something like the following check

  tblName = $.request.parameters.get('tblName');

  tblName = typeof tblName !== 'undefined' ? tblName : 'USERS';

That way if the parameter isn't passed then I default to a value USERS.  If the parameter is passed but the value is blank it doesn't get caught by this logic.

In other cases I check to see if the value is null.  I use this in cases where I also want to check for a blank value being passed:

  var procedure_oid = $.request.parameters.get("procedure_oid");

  if (procedure_oid == null) {

  outputError('Invalid source procedure');

  return;

  }

Former Member
0 Kudos

Hi Thomas,

Thanks for you reply.

I was just trying EPM demo code to download Excel from UI.

The XSJS file is working fine.

But I am getting error on pressing Export button:

Uncaught TypeError: undefined is not a function

It is not accepting jQuery.download function

Do I have to install any additional jQuery plugin for this?

Regards,

Rohit

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Yes this is an extra function defined in the code. Look in global.js of that project for the implementation of the download function. It is an open source example from: jQuery Plugin for Requesting Ajax-like File Downloads | Filament Group, Inc., Boston, MA

Former Member
0 Kudos

Hi Thomas,

I have a requirement to call server side servelet to excel download from UI5. But not able to find a way to call servelet from UI5

Regards,

Jacob

Answers (1)

Answers (1)

former_member189009
Active Participant
0 Kudos

Hi Rohit,

     I also come across the problem : Uncaught TypeError: undefined is not a function  

    So how do you fix this problem ?