Skip to Content

How to invoke the MII URL(calling MII transaction) in background on click Post button from UI in javascript

Hi All,

I need to invoke the MII URL in background i.e. asynchronously on click of post post button from UI. I am having the URL in below format which call a MII transaction and send the data to ECC and put the acknowledgement in Queue through QueuePut action block.

URL - http://<server>:<port>/XMII/Runner?Transaction=<MY-FOLDER>/LongRunningTransaction&IsAsync=true

So my target is that when user click on Post button from UI screen it call the above URL in background, so that JavaScript code never get hold.

Please send me some code patch or examples.

Thanks,

Ritim

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Aug 05, 2013 at 08:48 PM

    Hi Ritim,

      There are more than one way to call a transaction asynchronously from UI.

    1. JQuery Ajax call. for example,

    $.ajax({
      type: "POST",
      url: "/XMII/Runner?transaction=transactionPath",
      data: "{name1:value1, name2:value2}",
      dataType: "xml",
      success: function(result) {
      //code
       }
    );

    By default, its asynchronous. Here data is your name value pairs of input parameters to the transaction. note, you need to import jQuery library in your html page for this to work. jQuery Install

    Refer:: jQuery.ajax() | jQuery API Documentation

    2. Using JavaScript's XMLHTTPRequest Object:: XML DOM - HttpRequest object . Just pass the parameter true in the open(method, url, isAsync) method.

    3. The last I could think of is by posting a message to MII. MII internally invokes the transaction asynchronously. All you have to do is post a message to MI with data in the form of an XML.

    Then you would create a processing rule that would define which transaction to execute on receipt of that message.

    The URL to post a message is

    http://<server>:<port>/XMII/Illuminator?service=WSMessageListener&mode=WSMessageListenerServer&NAME=<UniqueMessageName>&InputParamName=InputXML


    Refer:Message Listeners - SAP Documentation

    All the above methods will not stop your JavaScript from executing. All are asynchronously called. It ultimately boils down to how you want to achieve. The last method though a little complex, gives better visibility in terms of monitoring. The second one is the simple and is supported by almost all browsers with no additional resource. The first one is what I mostly use. Its easy, works as expected but you would have to import the library.

    Regards

    Tufale Ashai.

    Add comment
    10|10000 characters needed characters exceeded