cancel
Showing results for 
Search instead for 
Did you mean: 

Internal Table Export

Former Member
0 Kudos

Hey folks,

I have to export internal table in to Excel.It is to be noted here i am not using ALV in WD4ABAP so i have to build functionality in method itself.When i Click button "Export" , in WD4A table wold be exported to excel.For this i used these statements

From ONACTIONONSUBMIT i exported internal table (method generates table)

export itab_sflight to MEMORY ID 'ZCA'.

In ONACTIONONEXPORT method i wrote this


import  itab_sflight  FROM MEMORY ID 'ZCA'.

ALL FUNCTION 'WS_EXCEL'
 EXPORTING
   FILENAME            = 'C:Documents and SettingspachcnrDesktopSales release.xls'
*   SYNCHRON            = ' '
  TABLES
    DATA                = itab_sflight
* EXCEPTIONS
*   UNKNOWN_ERROR       = 1
*   OTHERS              = 2
          .
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

But this is not working .Can anyone suggest wat is to be done here.Keep in mind i am not using ALV.Points will re awarded.

Nirad

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

I have solved the problem at my own.

Former Member
0 Kudos

Hi Nirad,

I have a similar problem where I want to export data from table to excel. I am not using ALV. Can you please tell as how you have solved the problem.

Regards,

Reena

Former Member
0 Kudos

You should be using FileDownload UI Element really.

Even better, use ALV. It has lots of built in functionalities out of the box.

Former Member
0 Kudos

Hi Nirad,

Could you please give us the code. I've similar requirement.

thanks,

David.

Former Member
0 Kudos

There is a class 'cl_wd_runtime_services' with the method 'attach_file_to_response' which can be used to prompt for data export. Just make sure that the contents of the internal table are converted to xstring. Just try it.

Former Member
0 Kudos

Hi Nirad,

This is a strange scenario,

Here I am not sure hence i cannot check because i dont have access, but i beleive the file is stored in Application server hence the browser cannot work as sap GUI, as it made for different purpose.

but as per Application server restrictions (the existance of folder, or creation of folder if it does not exists). So you have to create a file in a specific network path with a unique name and you have to send the file to the browser as a word object or give a link to the file in the HTTP response (giving link you should be sure that the user who uses your page should have access to the folder you are refering to).

The solution i suggest is Create the file in the network path where everyone have access and give a link to the users so they can download from there by clicking it.

Please reward if it works. if questions on my answer please do mail me on senthilvel.murugesan@tcs.com

Thanks & Regards

Senthilvel Murugesan

I

abhimanyu_lagishetti7
Active Contributor
0 Kudos

Hi Nirad

One basic understnding here is

Webdynpro Abap Applicaitons is a Web Technology, the Browser Understands

Only HTTP Response and sends HTTP Request .

Import/Export statements are for SAPGUI Applications not for WDA

Don't use such statements inside Webdynpro ABAP, it will not work

Instead use ALV Tables in Webdynpro ABAP which has inbuilt Export functionality

and use file upload control to read from client system

Regards

Abhimanyu L

Message was edited by:

Abhimanyu Lagishetti

Message was edited by:

Abhimanyu Lagishetti