cancel
Showing results for 
Search instead for 
Did you mean: 

Upload File with parameters?

Former Member
0 Kudos

Hi,

I need to upload a file with NetWeaver Gateway. The file should not be stored as such, but processed by an ABAP class. Besides the file the class also needs some parameters. How do I implement something like this?

One approach I found is to have a PUT request to /path/to/service/EntitySet('SerializedParameters')/$value. But since my client side technology is SAPUI5 (HTML5), PUT request do not seem to be possible (Browsers only support GET and POST).

Ideally I would do a POST to /path/to/service/EntitySet that contains the file as well as the parameters. How would the request have to look like? (And how could I generate it with SAPUI5?)

Thank you for your help in advance!

Regards,

Daniel

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Daniel,

Did you find answer to your question of passing other property values along with file ? I read in a blog that one can pass values using Header 'Slug'. But i was not convinced as its just one field and what if you have 5 other properties in your entity.

Please help, if you found solution.

Regards,

Rohit

Former Member
0 Kudos

Hi Rohit,

no, we did not really find a solution that was feasable in our context.

Yes, you can use the Slug header. But unformtuantely you cannot set this header in a standard HTTP POST coming from an HTLM form. (You can do it using AJAX in conjunction with the file API, but this only works for Internet Explorer 10+.)

We solved it by creating another simple BSP application where we were more flexible (though this does not follow any standard and by-passes the Gateway...)

Regards,

Daniel

former_member182048
Active Contributor
0 Kudos

Hi Daniel

DJ Adams recently gave an example of how to use the SAPUI5 FileUploader control,

http://scn.sap.com/message/14165831#14165831

In his example you will see it is a POST call and has additional parameters.

I haven't used this control with a Gateway service, i am not sure how you would set the additional HTTP headers which are needed, I am thinking you may need to extend the FileUploader Upload method so it does an Ajax call instead of the uploadForm.submit .

The following thread maybe of help

http://scn.sap.com/thread/3262540

I would start by getting the service call working in the Gateway Client, it will look something like

This is a working example you should be able to find in your system.

Cheers

John P