Skip to Content
0
Former Member
Apr 01, 2015 at 12:48 PM

File Upload into SAP MII

469 Views

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).