1

I want to run a script snippet on the SAP BO "Query Builder", it's a simple tool to retrieve data using SQL. (I can't upload the image due to the reputation, the product's interface can be found here: http://scn.sap.com/docs/DOC-42952)

Since I have a bunch of queries to run, I want to use snippet to run them automatically. Using the following code:

    //select the textarea to insert retrieved queries
    document.querySelector("textarea").textContent = "SELECT * FROM CI_INFOOBJECTS";
    //click the submit button
    document.getElementsByTagName('input')[0].click();

    //code to export the query result

    //after click(), the page reloaded and it won't executed the following code.
    document.addEventListener("DOMContentLoaded", function() {
    //back to the previous page, run the previous code again
        window.history.back(1);
        }, false);

Does anyone have good ideas how to implement it? Thanks for your help.

1 Answer 1

2

You can use Tampermonkey for chrome and you can learn how to use it from sites like hibbard tampermonkey tutorial . Overall your sript would look like this:

// ==UserScript==
// @name         Enter any name you like here
// @namespace    URL of website you own 
// @version      0.1
// @description  retrive data using sql
// @author       Your name here
// @match        relevant url
// ==/UserScript==
/* jshint -W097 */


// Your code here...
//select the textarea to insert retrieved queries
    document.querySelector("textarea").textContent = "SELECT * FROM CI_INFOOBJECTS";
    //click the submit button
    document.getElementsByTagName('input')[0].click();

    //code to export the query result

    //after click(), the page reloaded and it won't executed the following code.
    document.addEventListener("DOMContentLoaded", function() {
    //back to the previous page, run the previous code again
        window.history.back(1);
        }, false);
Make neccesay changes like in @match. Please Comment if you have any doubts . hope it helps

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.