Show TOC

 FileDownloadLocate this document in the navigation structure

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.

Caution

Note that this does not concern a singleton, as this could lead to short dumps in your application.

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.

To find out how to download a file without using the UI element, see File Export .

Note

To enable the development of accessible applications, the tooltip property is checked during the syntax check if the text and label properties are not set.

A tooltip does not necessarily have to be set for this UI element, but it could make sense to set it if it contains detailed semantic information.

Runtime Class

CL_WD_FILE_DOWNLOAD

Properties in the View Designer

Name Type Initial Value Bindable

id

STRING

(automatic)

No

activateAccessKey

WDY_BOOLEAN

false

No

behaviour

WDUI_FILE_DOWNLOAD_BHVR

auto

Yes

contextMenuBehaviour

WDUI_CONTEXT_MENU_BEHAVIOUR

inherit

No

contextMenuId

WDY_MD_UI_ELEMENT_REFERENCE

No

data

XSTRING

Yes

design

WDUI_LINK_DESIGN

standard

Yes

enabled

WDY_BOOLEAN

true

Yes

fileName

STRING

Yes

imageFirst

WDY_BOOLEAN

true

Yes

imageHeight

STRING

Yes

imageSource

STRING

Yes

imageWidth

STRING

Yes

mimeType

STRING

Yes

target

STRING

Yes

text

Translatable text

Yes

textDirection

WDUI_TEXT_DIRECTION

inherit

Yes

tooltip

Translatable text

Yes

type

WDUI_LINK_TYPE

navigation

Yes

visible

WDUI_VISIBILITY

visible

Yes

wrapping

WDY_BOOLEAN

false

Yes

Note

Other properties that can be inherited are defined in the associated higher-level classes. The associated UI elements are:

Dynamic Programming of Properties

For dynamic programming, the same properties, events, and aggregations as in the View Designer are available. Bear in mind the different spellings.

View Designer Name Runtime Name Type

activateAccessKey

ACTIVATE_ACCESS_KEY

WDY_BOOLEAN

behaviour

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

contextMenuBehaviour

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

contextMenuId

CONTEXT_MENU_ID

WDY_MD_UI_ELEMENT_REFERENCE

data

DATA

XSTRING

design

DESIGN

WDUI_LINK_DESIGN

design: emphasized

CL_WD_FILE_DOWNLOAD=>E_DESIGN-EMPHASIZED

design: standard

CL_WD_FILE_DOWNLOAD=>E_DESIGN-STANDARD

enabled

ENABLED

WDY_BOOLEAN

fileName

FILE_NAME

STRING

imageFirst

IMAGE_FIRST

WDY_BOOLEAN

imageHeight

IMAGE_HEIGHT

STRING

imageSource

IMAGE_SOURCE

STRING

imageWidth

IMAGE_WIDTH

STRING

mimeType

MIME_TYPE

STRING

target

TARGET

STRING

text

TEXT

WDY_MD_TRANSLATABLE_TEXT

textDirection

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

TOOLTIP

WDY_MD_TRANSLATABLE_TEXT

type

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

VISIBLE

WDUI_VISIBILITY

visible: none

CL_WD_FILE_DOWNLOAD=>E_VISIBLE-NONE

visible: visible

CL_WD_FILE_DOWNLOAD=>E_VISIBLE-VISIBLE

wrapping

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.