cancel
Showing results for 
Search instead for 
Did you mean: 

Excel upload from Portal using BSP's

Former Member
0 Kudos

Hi there,

I've developed a few Java iViews for our SAP Portal that allow suppliers to download an Excel file, modify it and then upload the file back into SAP via the Portal. It's very easy to do in Java and all I had to do was make use of an open source "Excel API"....

The Excel download and upload functionality seems to be becoming fairly popular on the Portal and now I have to try work out how to do it using BSP's and ABAP.

My question is that seeming the Excel functionality is INEVITABLE for the Portal and many companies are going to strategically use BSP's rather than Java for Portal development, what is the recommended (and standard) way that it should be done using BSP's.

It is assumed that we can't use "Desktop Office Automation" for the Excel functionality because there is no "presentation server"....

Logically what I want to happen is if the user uploads (for example) the Excel file via the Portal I'll get the BINARY data for the file and write that file to an ".xls" file on the server....then I'd like to instantiate some sort of Excel object and access the contents of the file...build up internal tables and update SAP......

Any help in this regard will be greatly appreciated

Regards

Lynton

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

I have achieved this functionality with ABAP and the fileupload HTMLB tag. You can find some good threads on this forum if you do a search. here is a snipet of what I did. I got most of this right out of a thread on this forum.

data ?= cl_htmlb_manager=>get_data(

request = runtime->server->request

name = c_fileupload

id =

c_body_subc_myfileupload1 ).

IF data IS NOT INITIAL.

name = data->file_name.

xcontent = data->file_content.

len = data->file_length.

ENDIF.

conv = cl_abap_conv_in_ce=>create( input = xcontent ).

conv->read( IMPORTING data = content len = len ).

SPLIT content AT cl_abap_char_utilities=>cr_lf

INTO TABLE lt_tsi

The data comes in as xstring and needs to be converted to string. Addtionaly I had the users only upload .CSV file

Hope this helps.

Rich

Former Member
0 Kudos

I have the same problem right now. I need to be able to upload and modify an Excel fiel to the server, and, once modified, return it to the sender. Searching the forums i have realized that it seems impossible to do that in the server side.

The solution that I have achieved is using the ActiveX object with JavaScript. I create the JavaScript code in the server using a BSP Application, and then, the JavaScript modify the Excel.

The code is something like this:

function bringToExcel() {

this.document.execCommand("SelectAll", false);

this.document.execCommand("Copy", true);

this.document.execCommand("UnSelect", false);

// Start Excel and get Application object.

var oXL = new ActiveXObject("Excel.Application");

oXL.Visible = true;

// Get a new workbook.

var oWB = oXL.Workbooks.Open("PlIncidencias_com.xls");

var oSheet = oWB.ActiveSheet;

Daniel Morá

Former Member
0 Kudos

Lynton:

I would save the Excel file in tab-delimited format instead of binary prior to uploading. At that point, you can easily parse the tab-delimited input string into target internal table.

Regards,

D.