Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Upload files from local machine and show it in a list

Hi experts,

I want to upload files from a local machine to a web dynpro component. Then the uploaded files should be shown in a list or a table in the same view as a link. Then I want to click on the filename-link to open it. How is this possible?

I created the UI Element FileUpload. So I can click on a button and the name and the size of the file are shown (As in the example in WDR_TEST_EVENTS). Bit I don't know how to go on...

Can someone help with the necessary process or the needed code?

Thx a lot for your help!

Best Regards

Ingmar

Former Member replied

Bind the data Attribute of FILEUPLOAD element , to a COntext attribute of type XSTRING.

Create a Button on the View 'Upload' and create a Action UPLOAD.

Click on Browse, and select the filw to upload. Then click on 'Upload' button.

The file will be available in XSTRING format in the attribute bound to the 'data' property.

In the Action handler ONACTIONUPLOAD Call function ECATT_CONV_XSTRING_TO_STRING to convert from XSTRING to STRING format.

Thus u can put this string in a internal table. Any white space means new Field in the Table. Any where u have a '#' in the string, means its a New Record.

U can check for '#' in the String by seeing if any character = CL_ABAP_CHAR_UTILITIES=>new_line

Done!!!!!! Bind the Internal Table to a Table UI Element.

Thanks

Anand

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question