on 12-05-2012 7:48 AM
Greetings!
I have created a web page to work with MII transactions via browser. One of web page components is iCommand applet which invokes transaction. Applet is using Xacute-query. "OnClick" event, generated by special button, starts the query.
There I have faced a problem: while the query is running any other actions on web page can not be executed. In most cases this sutuation is good, but sometimes the query must be stopped manually, for example if input data is incorrect.
Question: what event or function should I use to stop Xacute-query from a web page?
Thank you!
Best Regards,
Vitaliy
Hello Vitaly, there is already quite a fair bit on asynchronous call to transaction:
http://scn.sap.com/message/8097641
though you can not stop it if you are using the aynchronous message service, the user will not be impacted.
Another method is also to call the transaction through an XMLHttpRequest.
You can do this call and call the transaction to be executed asynchronously by MII, after returning an ID which will enable you to track the transaction and also to stop it.
In order to do so you will have to do the following:
1. Run the transaction by calling the following URL, This returns a transaction ID that you can reuse in the URL after:
/XMII/Runner?Transaction=<MY-FOLDER>/LongRunningTransaction&IsAsync=true&LogType=Info
2. You can use the following URL which will give you details on the current Status of the Transaction
/XMII/Illuminator?Service=BLSManager&Mode=Details&ID=<ID Returned by the previous call>
3. Then you call this URL in order to Terminate the transaction:
/XMII/Illuminator?Service=BLSManager&Mode=Terminate&ID
=<ID Returned by the previous call>
For information on how to call url directly in Javascript look at the following website:
http://www.w3schools.com/xml/xml_dom.asp
Cheers,
Arnaud
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Arnaud!
Thank you a lot for your reply, it is very helpful! With the help of your approach I have successfuly run transaction via browser.
But can you please clerify the following: what is transaction ID and how can I get it to execute points 2 and 3 from your post?
Thank you for your time!
Regards,
Vitaliy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Arnaud,
Thank you a lot for your help! I've gathered a lot of new knowledge while trying to implement the suggested method!
I've made some progress, so now I am able to do the following:
1. Run the TRX asynchronously with some input parameters;
2. Get the ID of currently running TRX.
But unfortunately, some points are still unclear for me.
The First. While I'm trying to get responseXML I can not receive anything. For example, executing alert(returnedXML.xml) returns empty window, so I am not able to use any output parameter. I am using the code you listed. Maybe there is something wrong in TRX outputs configuration?
The Second. While trying to catch TRX ID I'm constantly receiving the next error:
'getElementsByTagName(...).0' - is null or not an object
In case I add the string alert("XML Doc: " + returnedXML.xml) before
currTrxId= returnedXML.getElementsByTagName('Rowsets')[0].getAttribute('TransactionID');
everything works fine, but there is an unwanted alert window.
Can you please help me to resolve listed issues?
Thank you for your time!
Best Regards,
Vitaliy
Hello Vitaliy, nice to hear that you are moving forward.
I'm thinking that this can be related to the fact that you are still trying to read the output parameter when you run the transaction asynchronously.
Try to call this function in your async scenario:
// Fuction to Call the Trx defined in the Javascript Variable at the end
function startTrxAsync(){
var url = "/XMII/Runner?Transaction=" + currTrxFullPath + "&Content-Type=text/XML&IsAsync=true&LogType=Info";
var returnedXML = getXML(url);
alert("XML Doc: " + returnedXML.xml); // Display the Full XML Element
currTrxId= returnedXML.getElementsByTagName('Rowsets')[0].getAttribute('TransactionID');
alert("Transaction ID: " + currTrxId); // Display the Transaction Id
}
This function also defines the content type to the MII Server,
though this was working fine for me, it could be browser dependent.
Cheers,
Arnaud
Vitaliy, normally this is not an issue, but can require some tweeking, specially compatibilty mode.
But, If you are using IE8 and IE9 you can press F12 when executing the code. Go in the script tab and click on start debugging. You can then set a break point or break at the next command and execute step by step. This will enable you to see the returned elements.
You can also check the network tab which will show you things like content-type and full message returned by the server.
Cheers,
Arnaud
User | Count |
---|---|
12 | |
7 | |
3 | |
2 | |
1 | |
1 | |
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.