cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Stop Xacute-query on Web Page

Former Member
0 Likes
541

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

View Entire Topic
Former Member
0 Likes
Hello Vitaly, if you look at your other post : http://scn.sap.com/thread/3263860
you can add the following code at the end. This will enable you to retrieve the status of your transaction and to stop it.
Note that you will need to change 2 things in the initial code of the other post:
1. Make the call to the transaction asynchronous with IsAsync flag to true
2. Remove the part in the javascript which reads the resutl, not possible anyore and will actually have the javascript failing.
Cheers Arnaud
// Display info
function info(){
var serviceUrl = "/XMII/Illuminator?Service=BLSManager&Mode=Details&ID=" + currTrxId + "&Content-Type=text/XML";
var returnedXML = getXML(serviceUrl);
status = returnedXML.getElementsByTagName('STATUS')[0].text;
alert("Info : " + status);
}
// Function to Stop the Trx defined in the javascript Variable Transaction Id: currTrxId
function stopTrx(){
if(currTrxId != -1){
  var serviceUrl = "/XMII/Illuminator?Service=BLSManager&Mode=Terminate&ID=" + currTrxId + "&Content-Type=text/XML";
  var returnedXML = getXML(serviceUrl);
  alert("Request to terminate the transaction sent : " + returnedXML.xml);
}else{
  alert('no Running Transaction');
}
}
Former Member
0 Likes

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

Former Member
0 Likes

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

Former Member
0 Likes

Hi Arnaud,

According to our corporate policies, we are using IE 8, IE 9. Can it cause some issues?

Best Regards,

Vitaliy

Former Member
0 Likes

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