How to execute FM from Javascript function?

Hi All,
I have a requirement to execute ABAP FM from Javascript function in BSP Application.
How do I implement this?
Is there any document/link in SDN?
Thanks
Thruna Shanmuga

Hi,
When button is clicked capture the event in OnInPutProcessing and call the function module.
In layout mention the java code
Here is a sample code:
Layout Code:
< script >
document.on keydown=function( )
if (event.key Code==13)
htmlb SL(this,2,'get') Mention the button ID
< /script >
  <htmlb:button id      = "get"
                         text    = "Execute"
                        width   = "35%"
                        on Click = "On InputProcessing()" />
OnInPutProcessing Code:
data:
  w_event type ref to cl_htmlb_event,
call method cl_htmlb_manager=>get_event
  exporting
    request = runtime->server->request
  receiving
    event   = w_event.
case w_event->id.(To capture the event)
when 'get'.
<<Call the function module>>
endcase.
Hope this solves the issue, Let me know if any queries.
Regards,
Rajani

Similar Messages

  • How to pass value from Javascript function to a Java class method

    Hi All,
    I want to pass a value, which I catch in a Javascript function to a method in a Java class. I have tried many combinations but it gives me error.
    This is the way I am doing
    function assignBill() {
    proj = projPh.substring(0,indSlash);
    <% myproject.getProj(" project_cd = '" + proj + "'");%>
    proj is the variable which I want to pass to getProj methods.
    If any one has done this, please let me know. Thanks for your help.
    Ritesh Mehta

    The only way to receive something from clients page is to submit it somehow: through a form or link, but the info has to make it back to the server obviously. I dont know how your app works, but you can use the the javascript -location.href- function(i think) to submit the var to the server and process it there.

  • How to pass value from Javascript function to JSP ?

    hi,
    hello i have 2 jsp page and one external javascript page.
    from page 1.jsp
    i am calling a fuction named fun(1).and i am passing that value to external
    javascript page
    from external javascript.js
    i am getting this value in the fun(w) and sending this Page2.jsp like this
    var url = "page2.jsp?id ="+w;
    http.open("get","page2.jsp?id ="+w );
    and in page2.jsp
    i am getting that value like
    String k = request.getParameter("w");
    but this is showing error. how cloud i get that value on this page2.jsp ?
    plz any one help me to study this
    regards
    Vishnu Sankar S

    hello sir
    thank u very much..i got the output
    Message was edited by:
    vishnu_shankar

  • Calling jsp file from javascript function

    How can i call a jsp file itself from javascript function written in it?

    I do not think you can invoke the current jsp directly using javascript.
    If the effect you are trying to achieve is to reload the page, then you could execute the servlet / code which called the current jsp.

  • Passing value from javascript function to servlet

    Hello everybody,
    i need to pass parameter from javascript function to servlet.
    what i wrote is :
    function callPopulateServlet(t)
    var h =document.NewRequest.services;
    var y = t.selectedIndex;
    alert(h.options[y].value);
    var id=h.options[y].value;
    <%session.setAttribute("id",id);%> // am getting error at this point
    document.NewRequest.submit();
    with this id am quering values from database through servlet.
    any body knows plz help me.
    thanks,
    anil.

    this is the error am getting
    Stacktrace:
         org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:85)
         org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
         org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:435)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:298)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:299)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

  • How to execute a stored procedure/function in TOAD?

    Hi, All ,
    Can someone please tell me how to execute a stored procedure/function in TOAD?
    I have tired
    EXECUTE PROCEDURENAME(888), but it doesn’t work.
    TOAD give me the error: invalid SQL statement.
    Thanks a lot

    Write PL/SQl block.
    i.e Begin
    Procedure name..
    end;
    Then it will be excuted.
    Ashutosh

  • How can we assign a JavaScript function on an TextInput action .

    Hello All ,
    I have a requirement that on ON_BLUR event of a MessageStyledText , I have to call a JavaScript function .
    This however should not refresh the page ( No submit action to the controller) .
    So how can we tie the JavaScript function to the TextInput at design time .
    Please auggest the needfull.
    Thank you,
    Srikanth

    Hi Tapash ,
    Actually my requirement was not to submit the form to controller .
    I got the solution for that . I have registered a JavaScript function to the MessageText in PR as
    pageContext.putJavaScriptFunction("callMethod","function callMethod() { var first=document.getElementById('First').value; ");
    OAMessageTextInputBean GoalTextBean2=(OAMessageTextInputBean)webBean.findChildRecursive("Second");
    GoalTextBean2.setOnBlur("callMethod()");
    Regards ,
    Srikanth

  • Call .xhtml file from javascript function

    Hi,
    Is there a way to call .xhtml page from javascript function???

    BalusC wrote:
    Yes there are some ways. But this question has nothing to do with JSF and certainly not with Java at all. Javascript is an entirely different language, although it has a similar syntax as Java (and unforunately also a similar name, they should never have renamed it from ECMAScript).I think ECMAScript is a renaming from JavaScript. The originally JavaScript was called LiveScript by Netscape. I've heard that the ECMAScript name was deliberately chosen to be unsexy.

  • How to execute the InDesign Javascript from outside in MAC

    Hi All,
    I need to execute the InDesign Javascript from outside in MAC machine.
    Anyone can help me.
    Thanks in advance.
    Regards,
    Ramkumar

    If you just want to imitate double clicking a file, use execute() method, e.g.:
    var myJavaScriptFile = new File("~/Desktop/Test.jsx");
    myJavaScriptFile.execute();
    At the top of your .jsx file type #target indesign to make the script run in InDesign.
    And I want to add to what Harbs said in the previous post: when you use do script command, you can also send parameters and get back values. See DoScriptParameters and DoScriptReturnValues sample scripts from InDesign CS3 Guide Scripts for details.

  • How do you call a JavaScript function from a Java applet

    I have an Applet that needs to run on the following platforms: Internet Explorer (Windows-NT, Windows -2000), Netscape (Windows-NT, Windows-2000, Sun(Solaris), RedHat(Linux), HP(11.0), IBM(AIX)).
    The Applet needs to call a JavaScript function that is included on the HTML page that contains the applet. In JRE-1.3.1 I used the AppletContext.showDocument(url,"_self" ) where the url is "javascript:MyScript('param1')". This works just fine. I tried using showDocument without the second parameter and all the other choices for the second parameter and none of them worked (nothing happened).
    I tried the same code with JRE version 1.4-beta. It seems that version 1.4-beta no longer supports a URL that starts with "javascript" in the AppletContext.showDocument(url,"_self" ) method. The error is:
    netscape.javascript.JSException: call does not support self.open
    at sun.plugin.javascript.navig.Window.call(Unknown Source)
    at sun.plugin.ActivatorAppletContext.showDocument(Unknown Source)
    I tried to catch the JSException but I cannot seem to.
    I then tried a completely different approach. I then grabbed the JSObject for the page and tried to call my javascript function (MyScript) directly:
    JSObject theObj = JSObject.getWindow(this);
    Object paramArray[] = new Object[1];
    paramArray[0] = Param1;
    theObj.call("MyScript", paramArray);
    This worked fine on Netscape[Windows-NT, Windows-2000]. HP throws a JSException on getWindow() and Solaris just hangs. I did not even try IE.
    What is the recommended approach here?

    you can try this, it worked for me:
    JSObject win = JSObject.getWindow(this);
    win.eval(function_call);
    I have other ways also, so if this doesn't work, let me know.

  • How can I relate my Javascript function file?

    I'm adding my javascript functions in my PHP File:
    <script type="text/javascript" src="scripts/sqlfunctions.js"></script>
    But Dreamweaver does not show me the functions of the file.
    They are defined as xyz.myfunc = function(){ ...}
    So when I write xyz. it should show up a Dialog with all my methods in it.
    How can I do that?
    PS: It's really a pity that Dreamweaver does not include by itself the functions. Im really disappointed about Dreamweaver.

    This way.
    with data as
    select 'PLS' prod,      9999 bal,           6 rate from dual union all
    select 'PLS',      99999,           6 from dual union all
    select 'FP4',      5000,           5 from dual union all
    select 'FP4',      10000,           6 from dual union all
    select 'FP4',      50000,           6.7 from dual union all
    select 'FP5',      50000,           6.9 from dual
    select  rn, prod, bal,
            case when
                    rn = 1
                  then
                    0
                  else
                    lag(bal) over (partition by prod order by bal)
            end from_bal,
            bal to_bal,
            rate rate
      from  (
              select prod, bal, rate, row_number() over (partition by prod order by bal) rn
                from data
            ) a
    order by prod;
    RN  PROD      BAL      FROM_BAL TO_BAL   RATE                  
    1     FP4     5000     0     5000     5
    2     FP4     10000     5000     10000     6
    3     FP4     50000     10000     50000     6.7
    1     FP5     50000     0     50000     6.9
    1     PLS     9999     0     9999     6
    2     PLS     99999     9999     99999     6

  • How to get variable from javascript to jsp

    Hi,
    I put a JSP page but in one frame it has a JAVAScript running. The Javascript is a viewer that user can input bounding coordinate and see updated results. Once user input the bounding coordinate in the javascript, I would like to make
    that variable available to the entire JSP, so I can submit all query (include the parameter user input in the JSP form) from jsp at a time. How to do this?
    Thanks
    Kenny

    Hi,
    Okey here is the code. There are three frames.
    1. KennyFrame.htm
    2. MapFrame.htm
    3. kenny.jsp
    Once you run the "KennyFrame.htm" it will show a page
    with two top-bottom frames. The top is
    "MapFrame.htm".
    The bottom is "kenny.jsp"
    Once user input something on MapFrame.htm, it will do
    a process in Javascript then update the "new answer".
    I will need to put that "new answer" into the "What's
    mapFrame Input? " Text box. Therefore, when user click
    on submit on kenny.jsp frame. The "new answer" will be
    submitted.
    Code:
    MapFrame.htm (the main page)
    <body bgcolor="#FFFFFF" text="#000000">
    Newmapframe
    <center>
    <form name=form>
    <input type=text name=box value="type in here!">
    <input type=button value="Convert"
    onClick="javascript:changeCase(this.form.box)">
    </form>
    </center>
    </body>
    </html>
    MapFrame.htm (the code with javascript on top frame)
    <html>
    <head>
    <title>Map Frame Document</title>
    <meta http-equiv="Content-Type" content="text/html;
    charset=iso-8859-1">
    <SCRIPT LANGUAGE="JavaScript">
    <!-- Begin
    function changeCase(frmObj) {
    var tmpStr;
    tmpStr = "Some answer!";
    frmObj.value = tmpStr;
    // End -->
    </script>
    </head>
    <body bgcolor="#FFFFFF" text="#000000">
    Newmapframe
    <center>
    <form name=form>
    <input type=text name=box value="type in here!">
    <input type=button value="Convert"
    onClick="javascript:changeCase(this.form.box)">
    </form>
    </center>
    </body>
    </html>
    kenny.jsp (jsp on bottom frame for final submit)
    <html>
    <head><title>Number Test</title></head>
    <body bgcolor="white">
    <font size=4>
    <form method=get>
    What's mapFrame Input? <input type=text name=guess>
    <input type=submit value="Submit">
    </form>
    </font>
    </body>
    </html>
    let us the say the name of the frame in which kenny.jsp is placed be 'kennyframe' and u change the javascript function 'changeCase()' in MapFrame.htm to below:
    function changeCase(frmObj)
    var tmpStr;
    tmpStr = "Some answer!";
    frmObj.value = tmpStr;
    parent.frames["kennyframe"].document.form.guess.value = frmObj.value;

  • How to execute workflow through javascript in CRM 2013

    Hi,
    I have created a business process and I want to execute workflow on custom button through javascript. I tried this script but this script does not run after message box show. Please tell me how to execute my workflow through javascript
    function RunWorkflow() {
        var _return = window.confirm('Are you want to execute workflow.');
        if (_return) {
            var url = Xrm.Page.context.getServerUrl();
            var entityId = Xrm.Page.data.entity.getId();
            var workflowId = '541B45C9-3F88-4448-9690-2D4A365C3172';
            var OrgServicePath = "/XRMServices/2011/Organization.svc/web";
            url = url + OrgServicePath;
            var request;
            request = "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
                          "<s:Body>" +
                            "<Execute xmlns=\"http://schemas.microsoft.com/xrm/2011/Contracts/Services\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">"
    +
                              "<request i:type=\"b:ExecuteWorkflowRequest\" xmlns:a=\"http://schemas.microsoft.com/xrm/2011/Contracts\"
    xmlns:b=\"http://schemas.microsoft.com/crm/2011/Contracts\">" +
                                "<a:Parameters xmlns:c=\"http://schemas.datacontract.org/2004/07/System.Collections.Generic\">"
    +
                                  "<a:KeyValuePairOfstringanyType>" +
                                    "<c:key>EntityId</c:key>" +
                                    "<c:value i:type=\"d:guid\" xmlns:d=\"http://schemas.microsoft.com/2003/10/Serialization/\">"
    + entityId + "</c:value>" +
                                  "</a:KeyValuePairOfstringanyType>" +
                                  "<a:KeyValuePairOfstringanyType>" +
                                    "<c:key>WorkflowId</c:key>" +
                                    "<c:value i:type=\"d:guid\" xmlns:d=\"http://schemas.microsoft.com/2003/10/Serialization/\">"
    + workflowId + "</c:value>" +
                                  "</a:KeyValuePairOfstringanyType>" +
                                "</a:Parameters>" +
                                "<a:RequestId i:nil=\"true\" />" +
                                "<a:RequestName>ExecuteWorkflow</a:RequestName>" +
                              "</request>" +
                            "</Execute>" +
                          "</s:Body>" +
                        "</s:Envelope>";
            var req = new XMLHttpRequest();
            req.open("POST", url, true)
            // Responses will return XML. It isn't possible to return JSON.
            req.setRequestHeader("Accept", "application/xml, text/xml, */*");
            req.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
            req.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/xrm/2011/Contracts/Services/IOrganizationService/Execute");
            req.onreadystatechange = function () { assignResponse(req); };
            req.send(request);
    function assignResponse(req) {
        if (req.readyState == 4) {
            if (req.status == 200) {
                alert('successfully executed the workflow');

    Hi,
    I used this script for execute the workflow but its not working. When I used alert(req.status); then 500 show. Please tell me what did I mistake in my script.
    function RunWorkflow() {
        var _return = window.confirm('Are you want to execute workflow.');
        if (_return) {
            var url = Xrm.Page.context.getClientUrl();
            var entityId = Xrm.Page.data.entity.getId();
            var workflowId = '541B45C9-3F88-4448-9690-2D4A365C3172';
            var OrgServicePath = "/XRMServices/2011/Organization.svc/web";
            url = url + OrgServicePath;
            var request;
            request = "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
                          "<s:Body>" +
                            "<Execute xmlns=\"http://schemas.microsoft.com/xrm/2011/Contracts/Services\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">"
    +
                              "<request i:type=\"b:ExecuteWorkflowRequest\" xmlns:a=\"http://schemas.microsoft.com/xrm/2011/Contracts\"
    xmlns:b=\"http://schemas.microsoft.com/crm/2011/Contracts\">" +
                                "<a:Parameters xmlns:c=\"http://schemas.datacontract.org/2004/07/System.Collections.Generic\">"
    +
                                  "<a:KeyValuePairOfstringanyType>" +
                                    "<c:key>EntityId</c:key>" +
                                    "<c:value i:type=\"d:guid\" xmlns:d=\"http://schemas.microsoft.com/2003/10/Serialization/\">"
    + entityId + "</c:value>" +
                                  "</a:KeyValuePairOfstringanyType>" +
                                  "<a:KeyValuePairOfstringanyType>" +
                                    "<c:key>WorkflowId</c:key>" +
                                    "<c:value i:type=\"d:guid\" xmlns:d=\"http://schemas.microsoft.com/2003/10/Serialization/\">"
    + workflowId + "</c:value>" +
                                  "</a:KeyValuePairOfstringanyType>" +
                                "</a:Parameters>" +
                                "<a:RequestId i:nil=\"true\" />" +
                                "<a:RequestName>ExecuteWorkflow</a:RequestName>" +
                              "</request>" +
                            "</Execute>" +
                          "</s:Body>" +
                        "</s:Envelope>";
            var req = new XMLHttpRequest();
            req.open("POST", url, true)
            // Responses will return XML. It isn't possible to return JSON.
            req.setRequestHeader("Accept", "application/xml, text/xml, */*");
            req.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
            req.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/xrm/2011/Contracts/Services/IOrganizationService/Execute");
            req.onreadystatechange = function () { assignResponse(req); };
            req.send(request);
    function assignResponse(req) {
        if (req.readyState == 4) {
    alert(req.status);
            if (req.status == 200) {
                alert('successfully executed the workflow');

  • How connect to database from javascript

    Hello friends
    This is sudhakar, working as a developer in indian based company, present we are developing one web based application for this purpose i am creating one dynamic menu.
    my problem is:
    how can i connect to the database from javascript, for this purpose is there any configuration please reply and also send me sample code on for creating dynamic menus depending on the database values using javascript
    regards.
    sudhakar
    [email protected]

    Copy the code in to new HTML File then open the file with IE
    <html>
    <SCRIPT LANGUAGE=javascript>
    <!--
    function ConDB()
         var conn = new ActiveXObject("ADODB.Connection") ;
         var connectionstring="Provider=SQLOLEDB;Password=;User ID=;Initial Catalog=;Data Source=;"
         conn.Open(connectionstring);
         var rs = new ActiveXObject("ADODB.Recordset");
         rs.Open("SELECT * FROM YourTablename ", conn);
         rs.MoveFirst
         while(!rs.eof)
         document.write( yourtablefieldname);
         rs.movenext;
         rs.close;
         conn.close;
    }       //-->
    </SCRIPT>
    <body OnLoad="javascript:ConDB()"></body>
    </html>

  • How to return ResultSet from one function to another?

    Hi friends,
    Greetings.
    How do we pass the query Results from one function to another function?
    Actually i have a database in the server and i am the client.
    Client sends the id to the server as an argument. From HTML file this goes to the JSP file(which i am using as a link between HTML and EJB) and then this goes to the RemoteInterface and then to the Bean itself. The functions are written in the bean. Bean connects to the database using jdbc:odbc driver and then a query is written and executed as follows:
    In the Stateless Session Bean, there is one function with the following query.
    public ResultSet check(String id)
    //other code
    ResultSet rs = Statement.("select * from table1 where id=123");
    if(!rs.next)
    // print no such id exists. other ids are
    rs=Statement.("select * from table1");
    return rs;
    I have written it approximately only because the problem is not with the query :(
    Now, in rs there's a resultset. Now how do i display it in a tabular format in HTML? This should obviously be done using JSP. How can we do it?
    In JSP file if i write
    ResultSet rs1=Remote.check(12);
    i get NullPointerException
    Thank you in anticipation to your reply!
    Regards

    Crossposted over all places:
    [http://forums.sun.com/thread.jspa?threadID=5336533]
    [http://forums.sun.com/thread.jspa?threadID=5336534]
    [http://forums.sun.com/thread.jspa?threadID=5336532]
    [http://forums.sun.com/thread.jspa?threadID=5336519]
    [http://forums.sun.com/thread.jspa?threadID=5336510]
    Stop crossposting. It's very rude.

Maybe you are looking for

  • Can't get uzbl to work [solved]

    I installed uzbl-git with yaourt. Then I copied /usr/share/uzbl/examples/config/uzbl to ~/.config Then I try to start uzbl-browser with dmenu. It flashes the screen grey for a second then nothing happens. I missed a step somewhere? Edit: I rebuilded

  • Is/was there ever a way to create a printable PDF in Captivate?

    I have seen these Cp created online CBTs and in the upper left hand corner is a button that you can click on which says "Printable Version". This printable version is a PDF w/o the animation produced in Cp. Each slide prints as a separate page. I am

  • Anyone with 27" iMac and 24" Apple 24" LED to compare brightness?

    I am running them in a dual monitor set up. I notice the new 27" screen not as bright as the 24". Anyone else? Is this the same as yours in comparison, just wanted to make sure there is not a problem with the new 27". I have both at their respective

  • To calcuate the accumulated value

    Hello, I would like to write a calc script for the following scenario: I have a series of data value, and would like to calcuate the accumulated value based on the sequence of from the smallest to the largest. The case is like this: The input is as f

  • Blur background video

    Im using FCPX 10.1.3 I insert a freeze frame for a clip in my video. I am overlaying a smaller picture over the freeze frame. I would like to freeze frame to blur while the picture is being displayed over the freeze frame. I almost positive Ive done