Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Reg:Downloading data by using Webdynpro

Hi,

Can anyone please tell me how to solve this requirement.My requirement is i had to download data from a D.B table to a file on desktop.In normal R\3 we can do this by using "GUI_DOWNLOAD"

But here in Webdynpro i created a Button with action to download data into a text file on desktop using normal "GUI_DOWNLOAD" function.

But here i am getting an error as "CODE PAGE ACCESS CANNOT BE RETRIEVED" can anyone please help me in solving this issue............

replied

HI Kishore,

You cannot use the GUI_DOWNLOAD FM in webdynpro. You have to use the FileUpload & FileDownload UI elements in webdynpro. If you want to download the contents of your internal table as a local file on to your PC you will have to proceed as follows.

1) Convert the internal table contents to STRING format.

2) Convert STRING to XSTRING format.

3) Use the method ATTACH_FILE_TO_RESPONSE( ) to download the file either in WORD/NOTEPAD/EXCEL formats

Below is a code extract of the same. Hope that it helps you out. You can also go through this [example|http://saptechnical.com/Tutorials/WebDynproABAP/Export/toexcel.htm] which explains the same.

Regards,

Uday

loop at LT_SFLIGHT into LS_SFLIGHT.

    concatenate TEXT LS_SFLIGHT-CARRID
                LS_SFLIGHT-CONNID
                LS_SFLIGHT-FLDATE
                LS_SFLIGHT-CURRENCY
                LS_SFLIGHT-PLANETYPE
                CL_ABAP_CHAR_UTILITIES=>NEWLINE into TEXT separated by
                CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.

  endloop.

  call function 'SCMS_STRING_TO_XSTRING'
    exporting
      TEXT   = TEXT
    importing
      BUFFER = XTEXT.

  WDR_TASK=>CLIENT_WINDOW->CLIENT->ATTACH_FILE_TO_RESPONSE(
**path to the word file
    I_FILENAME = 'WDP.xls'
* String Variable
    I_CONTENT =  XTEXT
* File Type
    I_MIME_TYPE = 'EXCEL' ).    

endmethod.

To Export the Internal Table to Word Document, replace the code

WDR_TASK=>CLIENT_WINDOW->CLIENT->ATTACH_FILE_TO_RESPONSE(

I_FILENAME = 'WDP.xls'

I_CONTENT = XTEXT

I_MIME_TYPE = 'EXCEL' ).

With ,

WDR_TASK=>CLIENT_WINDOW->CLIENT->ATTACH_FILE_TO_RESPONSE(

I_FILENAME = 'WDP.doc'

I_CONTENT = XTEXT

I_MIME_TYPE = 'WORD' ).

To Export the Internal Table to Text File, replace the Excel code

with the Following

WDR_TASK=>CLIENT_WINDOW->CLIENT->ATTACH_FILE_TO_RESPONSE(

I_FILENAME = 'WDP.txt'

I_CONTENT = XTEXT

I_MIME_TYPE = 'NOTEPAD' ).

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question