cancel
Showing results for 
Search instead for 
Did you mean: 

Silent File upload

Former Member
0 Kudos

Hi

Is it possible to upload a file, using SAPUI5,

from a known file location without the user

having to pick it himself (no file menu),

and sending it then  to R3?

Thank you

Yuval

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Yes.

But why would you want that..?

What you could do is use a file uploader control, and not "paint/render" it on the screen.

Set the uploadURL, then upload the file.

Documentation:

JsDoc Report - SAP UI development Toolkit for HTML5 - API Reference - sap.ui.unified.FileUploader

Sample code:

FileUpload - SAPUI5 Demo Kit

Though I really question allot of things..

Would you want to do this with SAPUI5?

Why would you want to do a silent upload to your R3 system?

Greetz,

Caspár

Former Member
0 Kudos

HI Caspar

Thank you for your reply.

I thought about this solution, but what I would like to know

is if I can get the xstring (aka stream of bytes) from this file and then upload

it to the DMS on R3

Thanks

Yuval

Private_Member_15166
Active Contributor
0 Kudos

Yes you can read the text file as well from a file.

You may also read from a html file.

See below code.

<!DOCTYPE HTML>

<html>

       <head>

              <meta http-equiv="X-UA-Compatible" content="IE=edge">

              <meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/>

            

              <script src="resources/sap-ui-core.js"

                           id="sap-ui-bootstrap"

                           data-sap-ui-libs="sap.ui.commons"

                           data-sap-ui-theme="sap_bluecrystal">

              </script>

              <!-- add sap.ui.table,sap.ui.ux3 and/or other libraries to 'data-sap-ui-libs' if required -->

              <script>

              $.get('test.txt', function(data) {

                        console.log(data);

                     }, 'text');

                      // ^------last argument

              </script>

       </head>

       <body class="sapUiBody" role="application">

              <div id="content"></div>

       </body>

</html>


This is the output.




The file test.txt is in webcontent folder.


See these links for references.

https://api.jquery.com/jquery.get/

javascript - Reading a text file with jQuery - Stack Overflow

javascript - jQuery to load text file data - Stack Overflow

javascript - Reading a file into a string in jQuery/JS - Stack Overflow



Regards

Dhananjay

EkanshCapgemini
Active Contributor
0 Kudos

Hi Yuval,

Why do you need to get XSTRING at the front-end? You just upload the file and you will get XSTRING at the gateway CREATE_STREAM method that you can use to upload to DMS.

Even I have the same curosity, what is the scenario that requires silent upload?

Regards,
Ekansh