cancel
Showing results for 
Search instead for 
Did you mean: 

UPLOADS

Former Member
0 Kudos

hi

How to upload excel file in webdynpro.

What are the steps needed to be done?

regards

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

Hi Kamlesh,

you can use the upload UI Element to upload any kind of files from the client system to the server.You need to create a value node with 2 attributes of type binary and string respectively and map it accordingly to the "data" and "filename" properties of the UI Element.make the instance of the value node and create a simple type of that attribute.

Iprivateview.IUpload upload = wdContext.createUploadElement();

wdContext.nodeUpload().invalidate();

wdContext.nodeUpload().bind(upload);

IWDAttributeInfo info = wdContext.nodeUpload().getNodeInfo().getAttribute("data");

IWDModifiableBinaryType binary = (IWDModifiableBinaryType)info.getModifiableSimpleType();

binary.setFileName(upload.getName());

hope this will help.

Regards,

Shyam

Former Member
0 Kudos

hi shyam,

you have mentioned the code for uploading the file to server.but could you tell me how i can upload one file(excel,pdf,text to sapr/3 application server ar any text object.

kindly give me some sample code also.

thanx in advance.

regards,

PP

Former Member
0 Kudos

hello Kamlesh,

u can upload files to the server using upload UIE. for that u need to create a value node with 2 attributes - one of type binary and other of type string (one to store data and other for the file name).

write this sample code in init()

Iprivateview.IUpload upload = wdContext.createUploadElement();

wdContext.nodeUpload().invalidate();

wdContext.nodeUpload().bind(upload);

IWDAttributeInfo info = wdContext.nodeUpload().getNodeInfo().getAttribute("data");

IWDModifiableBinaryType binary = (IWDModifiableBinaryType)info.getModifiableSimpleType();

binary.setFileName(upload.getName());

write this in onAction of the button which uploads the file.

File file = new File(upload.getName());

FileOutputStream out = new FileOutputStream(file);

out.write(upload.getData());

hope this might help u.

regards,

Piyush.