Show TOC

Background documentationFileUpload Locate this document in the navigation structure

 

You can use the FileUpload UI element to upload files from the client to the server. The UI element appears with an InputField, in which the directory path and the file name appear, and a Buttonfor searching for the file.

Caution Caution

Note that you must always specify the FileUpload fully qualified path with a FileUpload UI element. Therefore, you cannot specify any URLs.

More information: http://support.microsoft.com/kb/892442/en-us

End of the caution.
Example of the Visual Display

Example of FileUpload with Label (Example of FileUpload with Label)

Technical Browser Details Beyond the Control of WDA

Due to browser restrictions that are unrelated to Web Dynpro ABAP, the previously entered data path might disappear when a FileUpload UI element is clicked. In newer versions of the browser, it is therefore impossible to enter the file name in the entry field. The field always remains empty. Neither are any possible restrictions displayed, for example, file names or file name extensions. The selection of the file name is therefore only possible in new browser versions using the Browse... button. You cannot enter the file name manually (using the keyboard or copy and paste functions) or by setting the file name from the back end (directly or using context binding).

For more details, read the security-related information in Internet Explorer 6 about handling <input type=file>.

For security reasons, the browser only accepts absolute paths or a path selection using the Browse…. switch. If the path name is incorrect, the browser will not even forward the request.

Procedure

There is no action available to identify a FileUpload. Generally we recommend you use a dedicated screen or popup for the upload, since an upload is triggered by every user interaction requiring a roundtrip, for example scrolling through a table. This makes a roundtrip necessary, which may irritate the user.

Check with every action whether data has been downloaded by reading the data from the context.

The delete the data immediately from the context. Otherwise the file would be kept in the memory until the context is created or a new upload is triggered.

Note Note

Note also the Security Notes for FileUpload UI Elements.

End of the note.

When copying from XSTRING to XSTRING no copy of the data is made due to ABAP string sharing. A copy is not created until the data is modified in one of the XSTRINGs.

Implementation Details

Runtime Class

CL_WD_FILE_UPLOAD

Properties in View Designer

Name

Type

Initial Value

Bindable

ID

STRING

(automatic)

No

activateAccessKey

WDY_BOOLEAN

false

No

contextMenuBehaviour

WDUI_CONTEXT_MENU_BEHAVIOUR

inherit

No

contextMenuId

WDY_MD_UI_ELEMENT_REFERENCE

No

data

XSTRING

Yes

enabled

WDY_BOOLEAN

true

Yes

explanation

Translatable text

No

fileName

STRING

Yes

mimeType

STRING

Yes

state

WDUI_STATE

normal

Yes

textDirection

WDUI_TEXT_DIRECTION

inherit

Yes

tooltip

Translatable text

Yes

visible

WDUI_VISIBILITY

visible

Yes

width

STRING

Yes

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

Accessibility

To enable the development of accessible applications the property label is checked during the syntax check.

If no label has been set, and no descriptive text has been specified for the appropriate bound context element in the ABAP Dictionary, the property tooltip is checked.

Dynamic Programming

For dynamic programming, the same properties, events and aggregations are available as in the View Designer. But note that the spelling format and use of upper/lower case is different.

Dynamic Programming of Properties

View Designer Name

Runtime Name

Type

activateAccessKey

ACTIVATE_ACCESS_KEY

WDY_BOOLEAN

contextMenuBehaviour

CONTEXT_MENU_BEHAVIOUR

WDUI_CONTEXT_MENU_BEHAVIOUR

contextMenuBehaviour: inherit

CL_WD_FILE_UPLOAD=>E_CONTEXT_MENU_BEHAVIOUR-INHERIT

contextMenuBehaviour: provide

CL_WD_FILE_UPLOAD=>E_CONTEXT_MENU_BEHAVIOUR-PROVIDE

contextMenuBehaviour: suppress

CL_WD_FILE_UPLOAD=>E_CONTEXT_MENU_BEHAVIOUR-SUPPRESS

contextMenuId

CONTEXT_MENU_ID

WDY_MD_UI_ELEMENT_REFERENCE

data

DATA

XSTRING

enabled

ENABLED

WDY_BOOLEAN

explanation

EXPLANATION

WDY_MD_TRANSLATABLE_TEXT

fileName

FILE_NAME

STRING

mimeType

MIME_TYPE

STRING

state

STATE

WDUI_STATE

state: normal

CL_WD_FILE_UPLOAD=>E_STATE-NORMAL

state: required

CL_WD_FILE_UPLOAD=>E_STATE-REQUIRED

textDirection

TEXT_DIRECTION

WDUI_TEXT_DIRECTION

textDirection: inherit

CL_WD_FILE_UPLOAD=>E_TEXT_DIRECTION-INHERIT

textDirection: ltr

CL_WD_FILE_UPLOAD=>E_TEXT_DIRECTION-LTR

textDirection: rtl

CL_WD_FILE_UPLOAD=>E_TEXT_DIRECTION-RTL

tooltip

TOOLTIP

WDY_MD_TRANSLATABLE_TEXT

visible

VISIBLE

WDUI_VISIBILITY

visible: none

CL_WD_FILE_UPLOAD=>E_VISIBLE-NONE

visible: visible

CL_WD_FILE_UPLOAD=>E_VISIBLE-VISIBLE

width

WIDTH

STRING

Example

For test purposes 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 FileUpload view.