Skip to Content
avatar image
Former Member

File Upload into SAP MII

Hi All,

We have a requirement where users need to upload excel data with around 10,000 rows into SAP MII which needs to be passed to a transaction.

Since we are using SAPUI5 controls the only way to send data to a transaction is through a AJAX POST but because of the size of data, the AJAX POST is failing stating too long.

So we are trying to find a way to upload the file directly into workbench so that transaction can read from it and delete the file once completed.

We created a HTML code to upload the file but unable to post using XMLHttpRequest and path:"./" (same folder as the html file):

<!DOCTYPE HTML>

<HTML>

<HEAD>

<TITLE>File Upload</TITLE>

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

<META http-equiv='cache-control' content='no-cache'>

<META http-equiv='expires' content='0'>

<META http-equiv='pragma' content='no-cache'>

<SCRIPT type="text/javascript" src="/XMII/JavaScript/bootstrap.js"

  data-libs="i5Chart,i5Grid,jQuery"></SCRIPT>

<script type="text/javascript">

  var client = new XMLHttpRequest();

  function upload() {

  var file = document.getElementById("uploadfile");

  //create new FormData instance to transfer as Form Type

  var formData = new FormData();

  // add the file intended to be upload to the created FormData instance

  formData.append("upload", file.files[0]);

  client.open("post", "./", false);

  client.setRequestHeader("Content-Type", "multipart/form-data");

  client.send(formData); // send formData to the server using XHR

  }

  // register handler to check XHR instance's status when receiving the response

  client.onreadystatechange = function() {

  alert(client.response);

  }

</script>

</HEAD>

<body>

  <input type="file" id="uploadfile" />

  <input type="button" value="upload" onclick="upload()" />

</body>

</HTML>

We are getting response:

Request URL:http://<Server>:50000/XMII/CM/Default/

Request Method:POST

Status Code:403 Forbidden


SAP MII version: 14.0 SP5

can anyone help us with this.

Have anyone of you tried uploading files into SAP MII server. Is there a better way?

We are able to do this with applet, we could set hung string as param and applet internally used to handle the posts so never had any issue but we now want to do this with SAPUI5 controls and completely avoid applets(JRE dependency).

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Best Answer
    avatar image
    Former Member
    Apr 06, 2015 at 08:44 AM

    You may use a JSP file to upload the excelsheet to MII server. You can use java.io package to read the data from local machine and write to server. I have used this once successfully.

    Thanks

    Shaji

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 01, 2015 at 03:46 PM

    If you go to the link below and search for something like "sap xmii file upload" you should find a lot of good information about how to do something like this.

    Google Custom Search

    Regards,
    Christian

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 06, 2015 at 06:39 AM

    Hi Ravitej,

    In the links from Christian's suggestion, Sam has mentioned dependecies required for such case. Please chakec below link.

    Best Regards,

    Swaroop

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 03, 2015 at 09:36 AM

    Hi Ravitej,

    If this is one time activity or not a regular activity, then convert excel file to xml and place xml file in one shared location. from there MII transaction can pick , process and upload to respective tables.

    hope this helps!!

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 06, 2015 at 06:45 AM

    Hi Ravitej,

    How about creating an OLEDB connection in dataservers and reading through it instead of doing it using ajax?

    Best Regards,

    Swaroop

    Add comment
    10|10000 characters needed characters exceeded