cancel
Showing results for 
Search instead for 
Did you mean: 

File validation while uploading in a table

former_member198064
Participant
0 Kudos

Hi Experts,

For an Excel file uploading using File uploading UI element i need to validate what type of file is uploading?

Except Excel other file should not upload any say error message?

And i need to validate each filed validation in excel while uploading in a table if not we need to pass error messages into one internal table?

And records should be saved after uploading using excel in a table as well as in database?

Can any one help me on this.

Thanks,

Venkatesh

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member184578
Active Contributor
0 Kudos

Hi,

For validating file type, Create an attribute mime_type in context and bind the mime_type property of the file upload UI to that attribute. After browsing and selecting the file path and on click of Upload button, in onAction of Upload button, Read the mime type using get_attribute method and display an error message if it is not the required type.

If the validation is success, then read the excel data to internal table and then display in Table ui using bind_table method. Then save the data to Data base table.

Check this wiki for more details: http://wiki.sdn.sap.com/wiki/display/WDABAP/Excel+File+Upload+And+Display+Data+Using+Web+DynPro+ABAP

Hope this helps u.,

Regards,

Kiran

Former Member
0 Kudos

Hi Durga,

For checking what file you have uploaded you need to check the mimetype of the file....

For that you must have bind your three properties of upload file UI element data filename mimitype...

So when you upload the file call get_static_attribute of the file upload node and check the value of mimetype in that.

For excel the mimetype is

for xls it is -- application/octet-stream

for xlsx it is -- application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

Thanks,

Vishu Agarwal