Entering content frame

Background documentation FileDownload Locate the document in its SAP Library structure

FileDownload is used to load filed 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 elements 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 date 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

If the properties text and label have not been set, the property tooltip is checked during the design time to ensure Accessibility.

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

behaviour

WDUI_FILE_DOWNLOAD_BHVR

auto

Yes

data

XSTRING

 

mandatory

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

_blank

Yes

text

Text

 

Yes

textDirection

WDUI_TEXT_DIRECTION

inherit

Yes

tooltip

Text

 

Yes

type

WDUI_LINK_TYPE

navigation

Yes

visible

WDUI_VISIBILITY

visible

Yes

wrapping

WDY_BOOLEAN

false

Yes

Note

Further properties that can be inherited are defined in the associated higher-level class.  The associated interface elements are:

      Link

      AbstractCaption

      UIElement

      ViewElement

Dynamic Programming

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

Dynamic Programming of Properties

View Designer Name

Runtime Name

Type

data

DATA

XSTRING

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

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 type file 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.

 

 

Leaving content frame