FileDownload
FileDownload is used to load files from the server onto the client. The data property determines the data source in the view context. The target property determines the ID of the target window in the browser.
Files from a FileDownload UI element are accessed when the user initiates a request for a specific file, that is, when the user clicks on a link. This way of accessing files enables large data sets to be processed.
For this access procedure, the FileDownload.data property must be linked to a context node that meets the following criteria:
- It has a supply function
- It has only one attribute with data of type XSTRING
This ensures that the supply function is not called until the user requests the data. To use the supply function in a table you need such a node within your Table.dataSource node.
To avoid having unnecessary data in the context, the FileDownload node is invalidated after the download. This however only happens if the node was not made available before the download. Consequently no data can get lost.
ITo find out how to download a file without using the UI element see File Export.
| Runtime Class |
CL_WD_FILE_DOWNLOAD |
Properties in View Designer
| Name | Type | Initial Value | Bindable |
|---|---|---|---|
|
STRING |
(automatic) |
No |
|
|
WDY_BOOLEAN |
false |
No |
|
|
WDUI_FILE_DOWNLOAD_BHVR |
auto |
Yes |
|
|
WDUI_CONTEXT_MENU_BEHAVIOUR |
inherit |
No |
|
|
WDY_MD_UI_ELEMENT_REFERENCE |
No |
||
|
XSTRING |
Yes |
||
|
WDUI_LINK_DESIGN |
standard |
Yes |
|
|
WDY_BOOLEAN |
true |
Yes |
|
|
STRING |
Yes |
||
|
WDY_BOOLEAN |
true |
Yes |
|
|
STRING |
Yes |
||
|
STRING |
Yes |
||
|
STRING |
Yes |
||
|
STRING |
Yes |
||
| styleClassName | STRING | Yes | |
|
STRING |
Yes |
||
|
Translatable text |
Yes |
||
|
WDUI_TEXT_DIRECTION |
inherit |
Yes |
|
|
Translatable text |
Yes |
||
|
WDUI_LINK_TYPE |
Navigation |
Yes |
|
|
WDUI_VISIBILITY |
visible |
Yes |
|
|
WDY_BOOLEAN |
false |
Yes |
For dynamic programming, the same properties, events, and aggregations as in the View Designer are available. But note that the spelling format and use of upper/lower case is different.
Dynamic Programming of Properties
| View Designer Name | Runtime Name | Type |
|---|---|---|
|
ACTIVATE_ACCESS_KEY |
WDY_BOOLEAN |
|
|
BEHAVIOUR |
WDUI_FILE_DOWNLOAD_BHVR |
|
|
behaviour: allowSave |
CL_WD_FILE_DOWNLOAD=>E_BEHAVIOUR-ALLOW_SAVE |
|
|
behaviour: auto |
CL_WD_FILE_DOWNLOAD=>E_BEHAVIOUR-AUTO |
|
|
behaviour: openInplace |
CL_WD_FILE_DOWNLOAD=>E_BEHAVIOUR-OPEN_INPLACE |
|
|
CONTEXT_MENU_BEHAVIOUR |
WDUI_CONTEXT_MENU_BEHAVIOUR |
|
|
contextMenuBehaviour: inherit |
CL_WD_FILE_DOWNLOAD=>E_CONTEXT_MENU_BEHAVIOUR-INHERIT |
|
|
contextMenuBehaviour: provide |
CL_WD_FILE_DOWNLOAD=>E_CONTEXT_MENU_BEHAVIOUR-PROVIDE |
|
|
contextMenuBehaviour: suppress |
CL_WD_FILE_DOWNLOAD=>E_CONTEXT_MENU_BEHAVIOUR-SUPPRESS |
|
|
CONTEXT_MENU_ID |
WDY_MD_UI_ELEMENT_REFERENCE |
|
|
DATA |
XSTRING |
|
|
DESIGN |
WDUI_LINK_DESIGN |
|
|
design: emphasized |
CL_WD_FILE_DOWNLOAD=>E_DESIGN-EMPHASIZED |
|
|
design: standard |
CL_WD_FILE_DOWNLOAD=>E_DESIGN-STANDARD |
|
|
ENABLED |
WDY_BOOLEAN |
|
|
FILE_NAME |
STRING |
|
|
IMAGE_FIRST |
WDY_BOOLEAN |
|
|
IMAGE_HEIGHT |
STRING |
|
|
IMAGE_SOURCE |
STRING |
|
|
IMAGE_WIDTH |
STRING |
|
|
MIME_TYPE |
STRING |
|
| styleClassName | STYLE_CLASS_NAME | STRING |
|
TARGET |
STRING |
|
|
TEXT |
WDY_MD_TRANSLATABLE_TEXT |
|
|
TEXT_DIRECTION |
WDUI_TEXT_DIRECTION |
|
|
textDirection inherit |
CL_WD_FILE_DOWNLOAD=>E_TEXT_DIRECTION-INHERIT |
|
|
textDirection ltr |
CL_WD_FILE_DOWNLOAD=>E_TEXT_DIRECTION-LTR |
|
|
textDirection rtl |
CL_WD_FILE_DOWNLOAD=>E_TEXT_DIRECTION-RTL |
|
|
TOOLTIP |
WDY_MD_TRANSLATABLE_TEXT |
|
|
TYPE |
WDUI_LINK_TYPE |
|
|
type: function |
CL_WD_FILE_DOWNLOAD=>E_TYPE-FUNCTION |
|
|
type: navigation |
CL_WD_FILE_DOWNLOAD=>E_TYPE-NAVIGATION |
|
|
type: reporting |
CL_WD_FILE_DOWNLOAD=>E_TYPE-REPORTING |
|
|
type: result |
CL_WD_FILE_DOWNLOAD=>E_TYPE-RESULT |
|
|
VISIBLE |
WDUI_VISIBILITY |
|
|
visible: none |
CL_WD_FILE_DOWNLOAD=>E_VISIBLE-NONE |
|
|
visible: visible |
CL_WD_FILE_DOWNLOAD=>E_VISIBLE-VISIBLE |
|
|
WRAPPING |
WDY_BOOLEAN |
Example of Source Code to Determine a MIME Type from a File Name Extension
|
data file type string. data dot_offset type i. data extension type mimetypes-extension. data mimetype type mimetypes-type. file = 'Image.jpg'. " Find out file name extension find first occurrence of regex '\.[^\.]+$' in file match offset dot_offset. add 1 to dot_offset. extension = file+dot_offset. " Get mime type call function 'SDOK_MIMETYPE_GET' exporting extension = extension importing mimetype = mimetype. |
Example
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.