Assigning Javascript value to ABAP variables

Hi Experts,
I have written the HTML code mixed with Javascripts to create a table in the 'View' of a BSP Component.
I was able to set the value of assign the value of ABAP parameters into HTML fields.
This table has some input fields. I need to fetch the value of input parameters which has been entered by screen on an event which is present in Overview Page.
I can calulate the value mentioned in input field but i am not able to assign the same value to ABAP parameter for further processing.
I have already referred the following link but it did not work.
Assign Javascript variable to Abap variable
Please help me how i should i acheive it.
Thanks In Advance,
Rajeev Singh

Hi,
I am not understanding your problem and what you want due to description, but it seems to be very similar to a post which I answered very recently [here|How to return values from a BSP page to Javascript;.

Similar Messages

  • How to check empty string and null? Assign same value to multiple variables

    Hi,
    1.
    How do I check for empty string and null?
    in_value IN VARCHAR2
    2. Also how do I assign same value to multiple variables?
    var_one NUMBER := 0;
    var_two NUMBER := 0;
    var_one := var_two := 0; --- Gives an error
    Thanks

    MichaelS wrote:
    Not always: Beware of CHAR's:
    Bug 727361: ZERO-LENGTH STRING DOES NOT RETURN NULL WHEN USED WITH CHAR DATA TYPE IN PL/SQL:
    SQL> declare
      2    l_str1   char (10) := '';
      3    l_str2   char (10) := null;
      4  begin
      5  
      6    if l_str1 is null
      7    then
      8      dbms_output.put_line ('oh STR1 is null');
      9    elsif l_str1 is not null
    10    then
    11      dbms_output.put_line ('oh STR1 is NOT null');
    12    end if;
    13  
    14    if l_str2 is null
    15    then
    16      dbms_output.put_line ('oh STR2 is null');
    17    elsif l_str2 is not null
    18    then
    19      dbms_output.put_line ('oh STR2 is NOT null');
    20    end if;
    21  end;
    22  /
    oh STR1 is NOT null
    oh STR2 is null
    PL/SQL procedure successfully completed.
    SQL> alter session set events '10932 trace name context forever, level 16384';
    Session altered.
    SQL> declare
      2    l_str1   char (10) := '';
      3    l_str2   char (10) := null;
      4  begin
      5  
      6    if l_str1 is null
      7    then
      8      dbms_output.put_line ('oh STR1 is null');
      9    elsif l_str1 is not null
    10    then
    11      dbms_output.put_line ('oh STR1 is NOT null');
    12    end if;
    13  
    14    if l_str2 is null
    15    then
    16      dbms_output.put_line ('oh STR2 is null');
    17    elsif l_str2 is not null
    18    then
    19      dbms_output.put_line ('oh STR2 is NOT null');
    20    end if;
    21  end;
    22  /
    oh STR1 is null
    oh STR2 is null
    PL/SQL procedure successfully completed.
    SQL> SY.

  • Passing JavaScript values to JSP variables

    Can any body correct the follwing code
    <Script language="JavaScript">
    function test( x )
    <%
    int num = x;
    num = num * 2;
    %>
    v.value = "<%out.print(num);%>";
    <input type="button" name="b" value="test" onClick="test(5)">
    <input type="text" name="v" value="0">
    In short, I am trying to pass JavaScript value to JSP variable. I hope that it is possible to do that. If it is possible then how can I do it. I want to assing the variable x passed to the JavaScript function called test to the JSP variable called num.
    Regards,
    Ageel

    Thank you for your reply,,,
    I think then the only way to do it is to post the
    value on the server and then use request.getParameter
    method in jsp code
    but the question now how can I post values to the
    server using JavaScript without reloading the pageyes... you can to it by create a new popup window which will submit the value to server after page was loaded... then, server return a value to the same window in html/jsp page which then using javascript to set it back to the opener and close up the window... however, this is not a good choice unless you have no other alternative...
    >
    There is other possible solution
    if I can get the text field value from the same page
    without reloading it that would work fine and will
    solve my problem, is it possible?yes... you can get the value from the textfield...
    for example :
    function showValueInTextField()
        alert(document.forms[0].elements["mytextfieldname"].value);
    >
    My final question> can jsp change things on the same
    page without reloading it. I mean can it work like
    JavaScript so that I can use it's internal functions
    instead of using java script :S
    not really know what you trying to say here...

  • Getting JS variable value in ABAP variable

    hi experts,
    I am fairly new to ABAP programming so please bear with me. To my issue.
    I am creating a BSP which will read from the tax number table in CRM into an itab.
    Next it loops into an wa and then passes each tax number through a javascript/JQuery API to validate the number. 
    The JSON response then comes back and is stored in a JS variable.
    I am unclear how to get this into an ABAP variable so I can handle as needed.  I have read some posts but they seem to be created for those ABAP experts which I am not there yet.
    Any help is most appreciated.
    thank you kindly!
    Chris

    Thanks for the reply Kiran.
    I am still stuck where I try to create the hidden field, assign the JS variable value to it and then retrieve on server side using ABAP.
    I read some places where it mentions accessing in the controller but this is not specific enough for me to know what to do.  Here is a snippet of my JS/html code.
    <form id="api">
    <div><input type="hidden" name="json" id="json" value="" /></div>
    var json = data;
    document.getElementById("json").value = json;
    document.api.submit();
    </form>
    I am using a Jquery api to get a boolean value and storing it in the json variable.  then I want to pass that value to an ABAP variable.  I did maintain a page attribute of json type STRING as well.  I also tried maintaining a controller class attribute of the same.  I did not redefine any controller class methods.
    Your help is most appreciated.
    thx
    Chris

  • Assign Javascript Value to JSP

    I have a dynamic link that links to a Javascript function:
    test
    The javascript function:
    function frames(testing)
    <%=testHere%> = testing
    <%
    HttpSession testSession = request.getSession(true);
    testSession.putValue("tested", testHere);
    %>
    I want to assign the javascript value, testing, into JSP value,testHere, which will be place in the session, which is :~
    .......putValue("tested", testHere).
    Does anyone know how to solve it? =)
    Thanks in advance...

    You can't. As is stated here about 3 times a day, Java, the JSP code, and servlets run on the Server, while javascript runs on the client (in the browser). By the time javascript begins to run, the JSP is compiled, run, the response generated and sent to the browser as HTML.
    The only means to do this is to send the variable back to the browser by requesting the same or another page and including the javascript value as a parameter to that page.

  • Error  while assigning resultset value to Querytable variable in Coldfusion 10

    We are upgrading from coldfusion 8 to 10. Internally we were using java function to to get the data.
    In java function we have a resultset object, if we assign this resultset value to Querytable variable, we are getting below error. This code was working fine in coldfusion 8.
    Detail    This exception is usually caused by service startup failure. Check your server configuration.
    Message    The Runtime service is not available.
    StackTrace    coldfusion.server.ServiceFactory$ServiceNotAvailableException: The Runtime service is not available. at coldfusion.server.ServiceFactory.getRuntimeService(ServiceFactory.java:117) at coldfusion.runtime.RequestMonitor.<clinit>(RequestMonitor.java:14) at coldfusion.sql.QueryTable.populate(QueryTable.java:358) at coldfusion.sql.QueryTable.populate(QueryTable.java:283) at coldfusion.sql.QueryTable.<init>(QueryTable.java:96) at com.myCompany.myClass.myFunct(myClass.java:627) at
    Here is the function which is causing error.
    static private QueryTable myFunct(String userId, SessionFactory sf) {
            PreparedStatement pStmt = null;
            ResultSet rs = null;
            QueryTable ret = null;
             try{
                Query q = sf.getCurrentSession().getNamedQuery("ListUsers");
                pStmt = sf.getCurrentSession().connection().prepareStatement(q.getQueryString());
                rs = pStmt.executeQuery();// works fine till here
                ret = new QueryTable(rs);  // error line         
                rs.close();
            }catch(Exception e){
                e.printStackTrace();
                throw new RuntimeException(e.getLocalizedMessage());
            return ret;
    Can you provide some help on this. Please let me know if you need any other details.

    We have found this error is logs
    coldfusion.runtime.Encryptor$InvalidParamsForEncryptionException: An error occurred while trying to encrypt or decrypt your input string: The input and output encodings are not same..
        at coldfusion.runtime.Encryptor.decrypt(Encryptor.java:303)
        at coldfusion.runtime.Encryptor.decrypt(Encryptor.java:284)
        at coldfusion.runtime.CFPage.Decrypt(CFPage.java:5353)
        at coldfusion.runtime.CFPage.Decrypt(CFPage.java:5326)
        at coldfusion.runtime.CFPage.Decrypt(CFPage.java:5458)
        at com.vmware.vcp.service.impl.EncryptColdFusionImpl.decrypt(EncryptColdFusionImpl.java:65)
        at com.vmware.vcp.web.servlet.ApplicationConfigServlet.initEmailService(ApplicationConfigSer vlet.java:119)
        at com.vmware.vcp.web.servlet.ApplicationConfigServlet.init(ApplicationConfigServlet.java:51 )
        at javax.servlet.GenericServlet.init(GenericServlet.java:160)
        at coldfusion.bootstrap.ClassloaderHelper.initServletClass(ClassloaderHelper.java:121)
        at coldfusion.bootstrap.BootstrapServlet.init(BootstrapServlet.java:59)
        at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1266)
        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1185)
        at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1080)
        at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5001)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5278)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1525)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1515)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:722)

  • Assign a value to class variable

    I want to define a class variable in class. And I want all subclasses of that class ot have a different value for that class variable. How can I do that?
    public class BaseClass {
      public static String tableName = "";
    }Now if I have a ClassA and I want to assign a value like this :
    public class ClassA extends BaseClass {
      tableName = "location";
    } I got an error message.
    I can move it in a static initializer block but then it will only work when the class is loaded. In my case its possible i want to get this value without loading the class.
    Ditto if i move it to constructor.
    Any input? Thanks

    Are you saying that if i have 2 classes ClassA and
    ClassB inherited from BaseClass, then both are
    sharing the same copy of 'tableName' staticvariable?
    If yes then I should go with an instance variable.No, I am saying that you can easily declare a
    tablName in A and another tableName in B.
    A.tableName will be shared between all the instances
    s of A. B.tableName will be shared between all the
    instances of B. And BaseClass.tableName is
    irelevant. I think you try to use
    BaseClass.tableName as some kind of template for
    sub-classes, but this does not happen: you need to
    declare tableName again and again in each subclass.
    IThanks for clarifying. Each class needs to have a variable "tableName" and it needs to have one copy of this variable for all of that class's objects. 2 classes will not have the same value of this tableName variable.
    Thats why I was defining it as static variable. And I define it in BaseClass so that I dont have to define it again in each subclass.
    Is there any better way? Thanks

  • Assigning a value to two variables

    I need to assign the same value to two variables is there a way to do this like in some other languages.
    e.g. I have the following currently:
    l_test := 'valval'
    l_counter := 'valval'
    I want to condense this down into something simpler such as:
    l_test := l_counter := 'valval'
    Is anything like this possible?
    Many thanks in advance.

    Because I need to build up two queries gradually since they depend on situations at runtime i.e. I cannot just write the query in one statement and run it since it is built up gradually based on the application.
    One is to obtain the results of the query and the other is purely to count up the results. The reason I am doing this is because it is more efficient than running two CURSORs which is the current situation.
    This will result in a cursor containg the results to loop through and a value which equals the number of results. Where the variables will have the same added to them is with the WHERE clause, since the conditions don't change just how they are stored changes. i.e. One is CURSOR to loop through and one is a straight value.

  • How to read the input field value into ABAP variable?

    Hi All,
    i need a read the value of an input field into an ABAP variable,and i am doing this in the following way
    lstring = request->get_form_field('myFlag').
    here 'myFlag' is the input field name,but this is not returning me any value into lstring.
    I have gone through the SDN and tried to do this.
    could you please help me out to resolve this issue.
    Thanks in Advance,
    Praveena

    Dear Praveena
    In which event are you putting this code. Place it in oninputprocessing event(Page with flow logic Model of coding). Then it will surely work.
    Regards
    Vijay.M

  • How to assign a value to ODI Variable using ODI Procedure

    Hi ,
    Is it possible to assign a value to a ODI Variable using ODI Procedure ?
    If it is possible how we can do that.
    BEGIN
    IF #Counter=1
    Then
    #Next_Increment:=#Counter+1;
    End if;
    END;
    In my example I have 2 ODI Variables #counter and #Next_increment.
    I am trying to assign VALUE TO A ODI VARIABLE #next_increment from another ODI Variable #counter.
    thanks
    prasanna

    Prasanna,
    I have a similar requirement where I need to assign values to ODI variables within a procedure. How do we make use of an ODI package to accomplish this ?
    Actually, I have a sequence of ODI steps, and there is a call to a procedure 'LOG ERROR' from every step which gets called in case error occurs in any step. I just need to identify from which step the error came.
    Please help.

  • How to assigne a value to UNIX variable inside a oracle plsql block

    Hi All,
    How can a assign a value to my UNIX (Shell script)variable inside a oracle procedure and read it back from shell script.
    Can you please help me out regarding this.
    Thanks in advances.
    Regards
    Krishna Shrivas.

    SQL> create or replace function setvar return varchar2 is
      2  begin
      3     return('SOMETHING');
      4* end;
    SQL> /
    Function created.
    SQL> get readvar
      1  select setvar from dual
      2  /
    SETVAR
    SOMETHING
    SQL> Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Production
    With the Partitioning, OLAP and Data Mining options
    [oracle@linuxas tmp]$ cat readvar.sh
    MYVAR=`sqlplus -s scott/tiger @readvar`
    echo $MYVAR | awk '{print $3}'
    [oracle@linuxas tmp]$ ./readvar.sh
    SOMETHING
    [oracle@linuxas tmp]$

  • Error encountered while assigning a value to a variable in ODI.

    we are getting the below error while trying to assign the o/p of the below query to a variable in ODI.THis error is encountered when the Table1 is empty....
    select b.res from (select (select CEIL((select count(1) from Table1)/2) - #SMARTS.loop_variable from dual) result from dual) a, (select CEIL((select count(1) from cst_dsa.m_pb_cable_data)/2) res from dual) b where a.result >= 0
    java.lang.Exception: Error: No value to affect to this variable for DefDate:2012-05-22 13:57:07.0
    DefN:null
    DefV:null
    IndStore:H
    ITxtDefT:null
    ITxtVar:null
    SessNo:800100
    VarDatatype:N
    VarName:SMARTS.total_loop_count_cable
         at com.sunopsis.dwg.dbobj.SnpSessTaskSqlV.execStdOrders(SnpSessTaskSqlV.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSqlV.treatTaskTrt(SnpSessTaskSqlV.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSqlV.treatTask(SnpSessTaskSqlV.java)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand(DwgCommandSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
         at com.sunopsis.dwg.cmd.e.i(e.java)
         at com.sunopsis.dwg.cmd.g.y(g.java)
         at com.sunopsis.dwg.cmd.e.run(e.java)
         at java.lang.Thread.run(Unknown Source)
    can somebody pls let me know ,how to handle this exception..

    This error means that there is no value to assign to your variable, because specified query doesn't return result row. You should rewrite your query to guarantee that it would return row in any case.
    For example, select nvl(min(b.res), -1) from (select (select CEIL((select count(1) from Table1)/2) - #SMARTS.loop_variable from dual) result from dual) a, (select CEIL((select count(1) from cst_dsa.m_pb_cable_data)/2) res from dual) b where a.result >= 0 group by a,b
    Edited by: apiminov on 15.06.2012 8:18
    Edited by: apiminov on 15.06.2012 8:19

  • Is it possible to read the contents of an Excel cell in DIAdem and assign its value to a variable in a VBS script.

    Hi All,
    Initially I thought this little problem would be relatively straight forward but now I’m not so sure. I am familiar with the mechanism by which DIAdem communicates with Excel and how to change the contents of a cell via a VBS script. In my task the contents of the cell in the first row, first column of MyProblem.xls contains the text “DIAdem”. I would like to be able to read this value and assign it to the variable MyString. I originally thought of doing something simple like this:
    Dim MyString
    Dim Excel, ExcelSheet
    Set Excel = CreateObject(“Excel.Application”)
    Excel.Workbooks.Open(“C\MyProblem.xls”)
    Set ExcelSheet = Excel.Workbooks(“MyProblem.xls”).Sheets(“Sheet1”)
    MyString = ExcelSheet.Cells(1,1)
    At this point I would have hoped that MyString would have been set equal to “DIAdem” and I could have used MyString to change the name of a channel in the data portal if I desired using the following code:
    Data.Root.ChannelGroups(1).Channels(1).Name = MyString
    Doesn’t seem to work though. I’m guessing it is because MyString has not picked up the value of the contents of the cell? Can anybody propose a solution to my problem or indeed confirm whether what I am proposing to do is technically feasible.
    Thanks in advance for any responses.
    Matthew

    Hi Matthew,
    Just staring at your ActiveX code, it looks fine to me.  My first thought is that this should work as you outlined it, and I've done this sort of thing many times, so I know it can work.  My second thought though, is that what you probably really want is a DataPlugin and not a VBScript.  Then you could just drag&drop the Excel file into the Data Portal and load all the properties and channels you want from the Excel file.  If you have DIAdem 2010 or later you can use the SpreadSheet reader object in the DataPlugin to avoid the Excel ActiveX functions (and Excel's jealously with other applications trying to read a file it has open already).
    Feel free to send me a few sample Excel files and describe what you want to load from the various cells, and I'd be happy to help you get a DataPlugin written to load your data.  You can also email me at [email protected]
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments

  • Assigning a value to a variable

    declare
    -- Local variables here
    v_temp1 number;
    v_temp2 number;
    v_temp3 number;
    v_final number;
    begin
    v_temp1 :=2;
    dbms_output.put_line('v_tmp1:'||v_temp1);
    dbms_output.put_line('v_tmp2:'||v_temp2);
    dbms_output.put_line('v_tmp3:'||v_temp3);
    --i should not do the below
    --v_final :=v_temp1;
    dbms_output.put_line('v_final:'||v_final);
    end;
    declare
    -- Local variables here
    v_temp1 number;
    v_temp2 number;
    v_temp3 number;
    v_final number;
    begin
    v_temp2 :=2;
    dbms_output.put_line('v_tmp1:'||v_temp1);
    dbms_output.put_line('v_tmp2:'||v_temp2);
    dbms_output.put_line('v_tmp3:'||v_temp3);
    --i should not do the below
    --v_final :=v_temp2;
    dbms_output.put_line('v_final:'||v_final);
    end;
    Hi,
    I have some 10 temp variables of which only one variable will have a value and rest will not
    have a value..it can be any temp variable
    I want to assign the temp variable to v_final that means which ever temp has a value that needs to be assigned to v_final, i cannot do this as above which is commented
    In the above example i have give 3 temp variables..
    Can any one please tell me how can i achieve this.
    Regards
    RG

    May help
    declare
    -- Local variables here
    v_temp1 number;
    v_temp2 number;
    v_temp3 number;
    v_final number;
    begin
    v_temp2 :=2;
    dbms_output.put_line('v_tmp1:'||v_temp1);
    dbms_output.put_line('v_tmp2:'||v_temp2);
    dbms_output.put_line('v_tmp3:'||v_temp3);
    v_final := case when v_temp1 is not null then v_temp1 when v_temp_2 is not null then v_temp2 when v-temp3 is not null then v_temp3.......
                      when v_temp10 is not null then v_temp10 end;
    dbms_output.put_line('v_final:'||v_final);
    end;Cheers!!!
    Bhushan

  • Assign numeric value to a variable from an item

    Someone please help me. I am attempting to assign a variable a numerical value from a text field. For example,
    my text field item is :P202_AMOUNT. How do I assign the number that is entered into this item to a PLS_INTEGER variable? I have attempted to uss this line of code but it hasn't worked:
    v_amount PLS_INTEGER := :P202_AMOUNT;
    Please help.
    -Stefano

    Stefano,
    The code you showed will work in the declaration section of a PL/SQL block that is part of your application's metadata (region, process, computation, etc.). Perhaps you are attempting to compile such a block externally using the bind variable. If that is the case, try v('P202_AMOUNT') instead. Or maybe your question is about format masks... How about giving us a bit more to go on?
    Scott

Maybe you are looking for

  • How to play videos on safari's apple website (msg: missing Plug-in) ?

    how do I play the video's on the apple website in safari ? getting 'missing Plug-in' no problems for youtube or other sites

  • Cannot access icloud at all?

    It started with no synch with ical. Had to change password, now can't access icloud at all. why?

  • "duplicate button press" problem in jsf 1.1

    I think the problem come from "duplicate button press", when the users press the button several time, many request is generated, the sad is I don't have the source code of this page, I just have the source code which receive these request, what I wan

  • NT or Unix

    Can someone suggest a way that I can determine, in code, if my JAVA application is running on a UNIX or an NT platform?

  • Populate a field via mailGetAddrs

    Hello, I have created a local .js file with the following to allow the restricted mailGetAddrs function to work: // Trust the mailGetAddrs function KCI_mailGetAddrs = app.trustedFunction( function (cTo, cCc, cBcc, cCaption, bCc, bBcc) app.beginPriv()