cancel
Showing results for 
Search instead for 
Did you mean: 

Generate Event when a file is selected using FileUpload UI element

Former Member
0 Kudos

Hello All,

I have two requirements with respect to FileUpload UI element in webdynpro abap.

1. when click on browser button of FileUpload UI element and select the file, display a message if the selected file is other than word, pdf, ppt & excel. Is there any way that we can have an event or some other way to see if the selected file is not expected one and display message. This should happen only after a file is selected.

2. Since requirement is to Upload multiple file, i have created a link using LinkToAction UI element which will create FileUpload UI element dynamically and bind it to context node. I have done this way:

a. first create context node "File_Upload" with 4 attributes file_name, file_type, file_size & file_content. (Cardinality 1:1)

b. second created FileUpload UI element and bind its property

    file name with file_name attribute

    data source with file_content

    mime type with file_type.

Above steps are working fine in case of single file uploading. So to have multiple file upload i have chosen the dynamic creation of FileUplaod UI element. To do so:

c. created link using LinkToAction UI element which when click will dynamically create FileUpload UI element.

d. when above link is created the dynamically created UI element is bind to above context.

But when i read file details from File_Upload context, only one file is shown which was selected for the First FileUpload UI element.

so how can i solve selection of multiple file Upload issue.

Thanks

Regards

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member184578
Active Contributor
0 Kudos

Hi,

1. You have to create a button (say Upload) and in onAction of upload you have to read the mime type and display an error message if it is not the allowed file type. There is no such provision to read file name when browse of FU. You must create an action.

2.

But when i read file details from File_Upload context, only one file is shown which was selected for the First FileUpload UI element.

This is because you have create the Node File_Upload with cardinality (1:1) change it to (0:n or 1:n).

You could better use Row repeater UI element instead of link to action and create FU UI dynamically.

Hope this helps u,

Regards,

Kiran

Former Member
0 Kudos

Hello Kiran,

Thanks for your response, I have gone through your suggestion but don't seem to meet requirement.

1. i have done with upload button, but client don't want to have upload button separately and creat action for that. As you said "There is no such provision to read file name when browse of FU" i dont think its correct because one of our clients application is performing the way my requirement want. I can not ask client that applications documents.

2. I first mentained 1:n for single file upload then changed it to 0:n for which i was getting error that nodes can not be bind. So changed it to 1:n.

Thanks

Faiz Khan

former_member184578
Active Contributor
0 Kudos

Hi,

 i dont think its correct because one of our clients application is performing the way my requirement want.

Is that application which you are referring is a Web Dynpro ABAP application? I don't think so, becoz, not even WDDOMODIFYVIEW method triggers when you select browse button of File Upload.

Here are the possible work around's which i don't prefer:

1. Create an input field with the required width and create a button next to that input with text 'browse..' and in onAction of browse, open the dialog to select file and read the file name. ( this is bit tricky )

2. With the existing File Upload UI, create a timed trigger UI and set delay 1 sec, in onaction of Timed trigger, read the file name if it is not initial. and then disable the timed trigger UI. ( not advisable, poor performance ) 

Regards,

Kiran

ramakrishnappa
Active Contributor
0 Kudos

Hi,

I agree with Kiran's statement. The file upload ui element is not having any event associated with it.

Hence, your requirement can be met by using some work around solution.

Regards,

Rama

Former Member
0 Kudos

Hello Kiran,

OK, let me have work around for 1st requirement, but can you help in solving 2nd one because that is more important. I have chnage the value from 1:n tho 0:n but was getting error, so again change it to 1:n. now ia m not getting any error but only one file is read not more then one.

In last reply  you said to use Row repeater, can you please give some idea how i can use it for my requirement.

Thanks

Faiz Khan

ramakrishnappa
Active Contributor
0 Kudos

Hi,

Please refer the below links regarding row repeater ui element

Usage of Row repeater

Tutorial on Row repeater

steps to create row repeater ui element - Web Dynpro ABAP - SCN Wiki

RowRepeater - Web Dynpro for ABAP - SAP Library

You can also try using table ui element as below

  • Create a table with 1 column
  • hide the column headers
  • Use column editor as FILE UPLOAD ui element
  • you can add a button for adding new line ( Add an attachment ) / delete the attachment
  • Bind it to the node (0...n / 1...n )

Hope this helps you.

Regards,

Rama