on 12-08-2014 8:56 AM
Greetings,
I am trying to find my way through MII. I suceeded in creating transactions and now I am about to make my first steps towards User interaction. I googled around and found some pages (like ) that i used to create the following code inside a HTML.
I inserted a button and a container. The transaction I created is returning some integer value as output. I just want to dispaly that figuer in the container. As I understood, runner is returning an XML that can be parsed.
To do so, I used the following code to print runner XML but somehow I cannot manage to get the result....How can I call that runner?!
When I paste URL created by fnCrtRunner into my browser, I get below result - so Runner is working.
Can somebody assist me? That would be awesome!
Call XML
<button type="button" onclick="fnCallRunner();">Run Transaction</button>
<div id="result">empty</div>
<script type="text/javascript">
function fnCrtRunner()
{
var URL = "http://XXXX/XMII/Runner?Transaction=TEST/Browser GUI/getTargetQuantity&OutputParameter=DailyQuantity";
URL +="&Content-Type=text/xml&IsBinary=true";
return URL;
}
function fnCallRunner()
{
var runner = fnCrtRunner();
var x = new XMLHttpRequest();
x.open("GET", runner, true);
document.getElementById("result").innerHTML = x.responseXML;
}
Runner Result:
<?xml version="1.0" encoding="UTF-8"?>
<Rowsets DateCreated="2014-12-08T01:51:26" EndDate="2014-12-08T01:51:26" StartDate="2014-12-08T01:51:26" Version="14.0 SP5 Patch 3 (May 19, 2014)" TransactionID="-1">
<Rowset TrxID="-1">
<Columns>
<Column Description="" MaxRange="0.0" MinRange="0.0" Name="DailyQuantity" SQLDataType="-5" SourceColumn="DailyQuantity" />
</Columns>
<Row>
<DailyQuantity>15</DailyQuantity>
</Row>
</Rowset>
</Rowsets>
Hi Marco,
Why do you want to call the runner service? You can use a simpler approach of getting applets on your page using scripting assistant.
Still, if you insist to use runner service, then below code might help you:
$.ajax({
url: "/XMII/Runner?Transaction=<TramsactionPATH>&Content-Type=text/xml",
success: function(result) {
}
});
"result" contains the xml returned by the trasaction, that you can modify/manipulate in success clock.
Hope this helps.
Thanks,
Swaroop
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Swaroop, thanks for your answer!! The reason why I want to use the runner service is because I don't know better, yet .
I have to dig into the MII subject on my own and am currently trying to find my way through it...
So I already managed to crate transactions and now want to dig into user interaction - that is run a transaction with paremters given in a IE-Weppage-GUI. I found some information on that runner service and wanted to try it as first attempt.
I do not know about scripting assistant yet...
If you could draft me a simpler way, I really would be happy to dig deeper into that one!
Anyway, I tried your approach (it is jQuery I think?...I don't much about it), but I did not manage to get things done. Wanted to use an alert to show result. I implemented as follows.
<BODY>
<button type="button" onclick="bla()">Run Transaction</button>
<div id="r">empty</div>
<script type="text/javascript">
function bla(){
$.ajax({
url: "/XMII/Runner?Transaction=http://SERVER/XMII/Runner?Transaction=TEST/Browser GUI/getTargetQuantity&Content-Type=text/xml",
success: function(result) {
alert(result);
}
});
}
</script>
</BODY>
But it is not working. Then I tried to move result to some local variable called z and tried to display thet one as alert and got an "undefined" pop up. I thought by myself it might be due to XML format. So I googled and found a post dealing with that topic:
javascript - jQuery getJSON save result into variable - Stack Overflow
So i ended up here - bu still not working:
<button type="button" onclick="bla()">Run Transaction</button>
<div id="r">empty</div>
<script type="text/javascript">
function bla(){
var z;
$.ajax({
url: "/XMII/Runner?Transaction=http://SERVER/XMII/Runner?Transaction=TEST/Browser GUI/getTargetQuantity&Content-Type=text/xml",
success: function(result) {
z = result;
}
});
var xmlText = new XMLSerializer().serializeToString(z);
var xmlTextNode = document.createTextNode(xmlText);
var parentDiv = document.getElementById("r");
parentDiv.appendChild(xmlTextNode);
}
</script>
Maybe one more hint?
Swaroop, getElementsByTagName was the clue I needed, thank you very much. Now that I knew what to look for, I figured out it needs to be "result.getElementsByTagName("Id")[0].childNodes[0].nodeValue"
So that one is working...now I'll have a look at the script assistant you proposed. I already had a look at it but it seems to be a different story 😉
In case you have some example to share with me or if you know some good website about that topic, I will grateful accept whatever is out there 😉
Hi Marco,
That's great....but i think you marked the other one as correct!
About script assistant, you can refer below doc:
SAP Manufacturing Integration and Intelligence 14.0 – SAP Help Portal Page
Warm Regards,
Swaroop
User | Count |
---|---|
9 | |
7 | |
3 | |
2 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.