cancel
Showing results for 
Search instead for 
Did you mean: 

Download a Table

Former Member
0 Kudos

Hello, I have to download a table to an txt file, something easy, but what I really want, if there is any posibility to choose the destination of the file, I mean... Is there any button or element which open a little windows or a popup and then i choose it??

Like when we download a file from internet.

I want a element that just gives me the "unc (
server\folder)" or "C:\foldere1\folder2" after choose de election like a string, then I know how to download the table to a file.

If it doesn't excist something like that, can anybody tell me a solution ??

Any answer would be helpful, Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

sorry, i forgot, the name of the function is GUI_DOWNLOAD.

method ONACTIONDOWN.

DATA:

cadena TYPE string,

FILENAME TYPE REF TO if_wd_context_node,

NODE_TABLE TYPE REF TO if_wd_context_node,

test TYPE string,

it_test TYPE if_componentcontroller=>Elements_Node_TABLE.

FILENAME = wd_context->get_child_node( name = `NODE_DOWNLOAD` ).

FILENAME->get_attribute(

exporting

name = `DOWNLOAD`

importing

value = cadena ).

NODE_TABLE = wd_context->get_child_node( name = `NODE_TABLE` ).

NODE_TABLE->get_static_attributes_table( IMPORTING table = it_test ).

CONCATENATE 'C:\' cadena INTO file.

call function 'GUI_DOWNLOAD'

exporting

filename = file

tables

data_tab = it_test.

endmethod.

Former Member
0 Kudos

Hi Andres!

That's not correct. Avoid to use any function module starting with the name 'GUI ...' because almost all of them expect there is a fat client SAPGUI session active, what in a browser environment definitely is not the case.

InsteaD Especially have a close look to UIElement's fileDownload property allowSave!!!!!!!! In my case this works fine if porperty is set correctly.

Hope this helps!

Regards,

Volker

Former Member
0 Kudos

Hello Andres,

You can try your scenario with three UI Elements - FileUpload, Button, FileDownload - and two context nodes - ctx_upload, ctx_download.

Using the FileUpload UI Element, you get the data in your context node ctx_upload (in x-string format). Now in the action handler of your button, write in the code which copies the Xstring from ctx_upload to ctx_download (bound to FileDownload UI Element). Next, when you click on the FileDownload UI Element, you will get your file.

You can of course use the same context node for both, but it just becomes more logical doing it this way and also opens up thoughts for real scenarios where Upload and Download happen on different views/components altogether.

Hope this helps.

Regards,

Neha

Answers (2)

Answers (2)

Former Member
0 Kudos

I tried to do it by this way but yhe element FileDownload doesnt open a windows to navigate into folders, the FileUpload does it.

Any way, Im trying with a imputfield so simple, but I dont really know whats happening, because when arrive to the function the name 'C:\test.txt' and the table it_test area correct when I debug, but when enter the function in the browser show me an error

Note

The following error text was processed in the system NSP : Could not ascertain code page

The error occurred on the application server server3_NSP_00 and in the work process 0 .

The termination type was: ERROR_MESSAGE_STATE

The ABAP call stack was:

Form: GUI_CHAR_DOWNLOAD of program SAPLSFES

Function: GUI_DOWNLOAD of program SAPLSFES

Method: ONACTIONBAJAR of program /1BCWDY/1NK2FD6YN8XJC46DRM8K==CP

Method: IF_WDR_VIEW_DELEGATE~WD_INVOKE_EVENT_HANDLER of program /1BCWDY/1NK2FD6YN8XJC46DRM8K==CP

Method: INVOKE_EVENTHANDLER of program CL_WDR_DELEGATING_VIEW========CP

Method: IF_WDR_ACTION~FIRE of program CL_WDR_ACTION=================CP

Method: DO_HANDLE_ACTION_EVENT of program CL_WDR_WINDOW_PHASE_MODEL=====CP

Method: PROCESS_REQUEST of program CL_WDR_WINDOW_PHASE_MODEL=====CP

Method: PROCESS_REQUEST of program CL_WDR_WINDOW=================CP

Method: EXECUTE of program CL_WDR_MAIN_TASK==============CP

Any help please.

Former Member
0 Kudos

Hi,

check out the element file_download

You can find examples of this interface element in the system in the Web Dynpro application

WDR_TEST_UI_ELEMENTS, and in the component WDR_TEST_EVENTS in the View

FileDownload.

grtz,

Koen