How to assign a value to the viewcriteria attribute from backing bean ?

Hi,
I have a readonly VO with the following query
select attr1,attr2, attr3, attr4
from sometable
I have a view criteria in the above VO something like
attr1=
and attr2=
I have dragged and dropped this criteria on a Status.jsff page as query panel with table. So the user can search the records by manually entering the values in the query panel. Also, there is another page Main.jsff where, if the user clicks on a button, it redirects him to Status.jsff page carrying a numeric value from the Main.jsff page. Now I have to assign this numeric value to "attr1" of the view criteria and execute this VO and show the updated results in the Status.jsff page.
I used the below code :
ViewObject vo = appModule.findViewObject("VOName");
ViewCriteria criteria = vo.getViewCriteriaManager().getViewCriteria("CriteriaName");
criteria.getVariableManager().setVariableValue("attr1", numericValue);
vo.applyViewCriteria(criteria);
vo.executeQuery();
For the above code, i got an error saying that Variable "attr1" not defined in "VOName"
Then i tried setting simple where clause
vo.setWhereClause("attr1="+numericValue);
vo.executeQuery();
For this code, i got an error saying that SQL error during statement preparation.Statement: SELECT * FROM (select attr1 ,attr2,attr3,attr4,from VOName) QRSLT WHERE (attr1=1234)
Please let me know the solution to this problem.

Thank you all for the suggestions.
The idea of Bind Variable works to query the criteria. But I have a Status.jsff page where User can even manually enter the attr1 value and query the results. When I added a bind variable to my VO, one extra input text field with the Bind variable name got added to the query panel in Status.jsff page. Also the table in the page did not show any results even after performing the executeQuery() on the VO(as per the steps explained in the Andrejus blog link that Navneeth has provided)
Please suggest

Similar Messages

  • How to assign date value in the report

    Hi,
    I want to compared between two dates. One date is dynamic and other one is fixed.
    for example Date1 = today's date
    Date2 = 12/31/9999
    How do i fix the date2 in the report.
    Please any one help me
    Thanks & Regards
    Jagannadha Raju

    you can use default values in the properties of the date variable that will allow it to be the data yo uwant it to be
    the 2nd date which is current use sap provided variable current data on it as restrickted value( Not default).
    hope that helps

  • Passing params to the AMImp method from backing bean

    Hello. I am an ADF/Jdeveloper Noob and i have a requirement where I have created an AM method below and exposed it to my View Controller.
    I am using Jdeveloper 11..1.1.4 to doe this.
    //In AM
    public boolean createSRTask(String sourceName, Number sourceRow)
    //insert new row in the Entity Object.
    EntityDefImpl SRTaskDef = MassSrImportEOImpl.getDefinitionObject();
    MassSrImportEOImpl newSRTask = (MassSrImportEOImpl)SRTaskDef.createInstance2(getDBTransaction(), null);
    newSRTask.setSourceName(sourceName);
    newSRTask.setSourceRow(sourceRow);
    return(true);
    I have a text file i am reading and I get the parameters from processing that file when the user presses the upload button... I can loop thru the file contents etc. with no issues but i have yet
    to figure out how to code the backing bean to call the AMImp method with the parameters I have read in.
    Thank you in advance for any help.
    Edited by: 832187 on Jan 16, 2012 6:51 AM
    Edited by: 832187 on Jan 16, 2012 7:01 AM

    In this case you should build a VO which is build on EO, add it to the data model of the application module. The you can either implement the service method in the VO or the application module. Let's assume you put it in the am (application module) like you already did. the method there would look like
    //In AM
        public boolean createSRTask(String sourceName, Number sourceRow) {
            ViewObjectImpl massView = (ViewObjectImpl)findViewObject("MassSrImportView1");
            Row row =  massView.createRow();
            row.setAttribute("Source", sourceName);
            row.setAttribute("SRCNR", sourceRow);
            massView.insertRow(row);
            return true;
        }Some note on this:
    1. the rows are not inserted in the db as long as you don't commit the transaction
    2. It look like your view does not have a PK. The framework works better if you have one
    3. If you always return true, you can omit the return value totally
    4. If you plan to insert multiple rows you should consider passing hte file to the am method and do a bulk insert in there as this would minimize round trips.
    I strongly recommend the you read the http://docs.oracle.com/cd/E25054_01/web.1111/b31974/bcintro.htm to get more knowledge about the business layer.
    Timo

  • How to assign a value to the page variable to enable partial page rendering

    This is part of my code:
    <bc4j:rootAppModuleScope name="App1"
    rendered="on@ctrl:page">
    Now, I want to change the value of "on@ctrl:page" to "true" after user click a button so that part of the page will be displayed. But how do I assign the value to "on@ctrl:page". I tried to put the followings in my even handler:
    <bc4j:setPageProperty name="on" value="true">
    <bc4j:parameter name="on" />
    </bc4j:setPageProperty>
    But it doesn't work. Could someone pls tell me how I should do it.
    Thanks a lot!
    Ling

    You should do is:
    in your event handle codes,you add the list:
    public static EventResult eventname(
    BajaContext context,
    Page page,
    PageEvent event) throws Throwable
    EventResult result = new EventResult(page);
    result.setProperty("on","true");//or "false"
    return result;
    then,
    change
    rendered="on@ctrl:page" -> data:rendered="on@ctrl:eventResult"
    also ,you should see the 5th part of 'UIX Developer's Help'

  • How to assign a value of the bean to a js variable.

    Hi,
    Im getting some values from the DB which is stored in a list , Now the list is sent across to the jsp through the bean.
    I need to get the length of the list
    I tried something like this.
    <script>         
    var size = <% rmaLicenseTransferForm.slfextUiElements.size(); %>
    </script>rmaLicenseTransferForm is the name of the formBean and slfextUiElements is the name of the list.
    I guess this wont work....by the way i using struts framework.....
    Thanks

    Use the JSTL fn:length tag.

  • How to assign and display an attribute value from backing bean?

    Hello all,
    I am using Jdev 11g. I have a form page which has two inputText attributes The first one implements a valueChangeListener feature. When the user enters a value in the first field, a backing bean function will be invoked through the valueChangeListener . In this backing bean function, based on the value in the first field, I want to assign the value to the second field and display it on the page. Can somebody help me how to achieve this?
    Thanks,
    John

    Hi John,
    Here is small example.
    Create two string variables in your backing bean and generate accessors for them.
        private String text;
        private String text1;
        public void setText(String text) {
            this.text = text;
        public String getText() {
            return text;
        public void setText1(String text1) {
            this.text1 = text1;
        public String getText1() {
            return text1;
        }Bind this variables to the value property of the input texts you have. Add the valuechangedlistener for the first input text (and also set autosubmit to true for that item). Also, add the id of the first input text as partial triggers for the second input text. Like,
            <af:inputText label="Label 1"
                          binding="#{backingBeanScope.backing_untitled1.it1}"
                          id="it1"
                          valueChangeListener="#{backingBeanScope.backing_untitled1.textValueChanged}" autoSubmit="true"
                          value="#{backingBeanScope.backing_untitled1.text}"/>
            <af:inputText label="Label 2"
                          binding="#{backingBeanScope.backing_untitled1.it2}"
                          id="it2"
                          value="#{backingBeanScope.backing_untitled1.text1}"
                          partialTriggers="it1"/>Finally, put the logic on your value changed listener. Like,
        public void textValueChanged(ValueChangeEvent vce){
            this.setText1("Hi " + vce.getNewValue());
        }Now, when you run the page and enter your name in the first input text, the second input text will display Hi <your_name>
    HTH.
    -Arun

  • Can we assign two values to the same parameter? If yes how? For details ple

    Can we assign two values to the same parameter? If yes how? For details please go through the following SAP related program.
    Here I need to print 2 queries using the same parameter "QUERY" the value assigned to this parameter(query) is REPORT_TEST1. I want to assign one more value to this Parameter. Is is possible? This question may sound stupid if it is not possible please kindly reply.
    I want to do this to print two documents(values) with a single command (parameter)
    Anybody please help quickly,
    Now, I have 2 tables from different queries. I have a print (HTML written) option in my WEB Template
    JAVA PROGRAM:
    <param name="QUERY" value="REPORT_TEST1"/>
    function PrintReport(typePaper) {
    document.title ='Report';
    if (typePaper == "0")
    {var CurrentReportName = '&?mp=U&ptot=1&rtot=0&psize=' + escape(typePaper) + '&fsize=' + escape('39') + '&qtitle=' + escape(document.title);};
    if (typePaper == "1")
    {var CurrentReportName = '&?mp=U&ptot=1&rtot=0&psize=' + escape(typePaper) + '&fsize=' + escape('52') + '&qtitle=' + escape(document.title);};
    CurrentReportName += '&ASOFDATE=' + escape(AsOfLabel.innerText);
    var openCMD='<SAP_BW_URL>';
    openCMD += '&DATA_PROVIDER=REPORT_TEST1&TEMPLATE_ID=DPW_PRINT_PAGE&CMD=RELEASE_DATA_PROVIDER';
    openCMD += CurrentReportName;
    openWindow(openCMD,'MainTitleNow',800,600);
    The data provider here is REPORT_TEST1. Now it only prints the corresponding data for the data proviedr 1 i.e., REPORT_TEST1. I have a second table whose data comes from the data provider 2 when i use this HTML to print I want the second table contents from the data provider 2 (REPORT_TEST2)also to be printed simlutaneously.
    Please help.
    THANX A LOT,
    SRINI

    Hi,
    Try assigning two values seperated by a delimiter ( say '|') to the same parameter.
    In the function get the parameter value and seperate the values using the same delimiter.
    <param name="QUERY" value="REPORT_TEST1|REPORT_TEST2"/>
    Regards,
    Uma

  • Can we assign two values to the same parameter? If yes how?

    Can we assign two values to the same parameter? If yes how? For details please go through the following SAP related program.
    Here I need to print 2 queries using the same parameter "QUERY" the value assigned to this parameter(query) is REPORT_TEST1. I want to assign one more value to this Parameter. Is is possible? This question may sound stupid if it is not possible please kindly reply.
    I want to do this to print two documents(values) with a single command (parameter)
    Anybody please help quickly,
    Now, I have 2 tables from different queries. I have a print (HTML written) option in my WEB Template
    JAVA PROGRAM:
    <param name="QUERY" value="REPORT_TEST1"/>
    function PrintReport(typePaper) {
    document.title ='Report';
    if (typePaper == "0")
    {var CurrentReportName = '&?mp=U&ptot=1&rtot=0&psize=' + escape(typePaper) + '&fsize=' + escape('39') + '&qtitle=' + escape(document.title);};
    if (typePaper == "1")
    {var CurrentReportName = '&?mp=U&ptot=1&rtot=0&psize=' + escape(typePaper) + '&fsize=' + escape('52') + '&qtitle=' + escape(document.title);};
    CurrentReportName += '&ASOFDATE=' + escape(AsOfLabel.innerText);
    var openCMD='<SAP_BW_URL>';
    openCMD += '&DATA_PROVIDER=REPORT_TEST1&TEMPLATE_ID=DPW_PRINT_PAGE&CMD=RELEASE_DATA_PROVIDER';
    openCMD += CurrentReportName;
    openWindow(openCMD,'MainTitleNow',800,600);
    The data provider here is REPORT_TEST1. Now it only prints the corresponding data for the data proviedr 1 i.e., REPORT_TEST1. I have a second table whose data comes from the data provider 2 when i use this HTML to print I want the second table contents from the data provider 2 (REPORT_TEST2)also to be printed simlutaneously.
    Please help.
    THANX A LOT,
    SRINI

    Hi,
    Try assigning two values seperated by a delimiter ( say '|') to the same parameter.
    In the function get the parameter value and seperate the values using the same delimiter.
    <param name="QUERY" value="REPORT_TEST1|REPORT_TEST2"/>
    Regards,
    Uma

  • How do you assign a value to the APEX field APP_USER

    Application Express 4.0.2.00.07
    Hi
    Is there a special function/procedure to assign a value to the APP_USER field
    or a simple APP_USER := :P1_LOGIN_NAME would do
    Z

    Hello Zac,
    >> or a simple APP_USER := :P1_LOGIN_NAME would do
    The APEX engine is already doing it for you after a successful login – setting the value of APP_USER as the user login name. You can use it as a substitution string or with the bind variable notation (:APP_USER).
    Regards,
    Arie.
    &diams; Please remember to mark appropriate posts as correct/helpful. For the long run, it will benefit us all.
    &diams; Author of Oracle Application Express 3.2 – The Essentials and More

  • How to assigne multiple value in key of read table

    Hi gurus,
    I want read table xxxx with key field1 = ' xxx' or field1 = 'yyy'.
    how to assign multiple value as key for the same field while reading internal table.
    Regards
    sagar

    Hi ,
    You can loop the internal table like
    loop at  <table xxxx> where field1 = ' xxx' or field1 = 'yyy'
    or you can write two read statements to read the internal table in wrk area.
    read table   <table xxxx> with key field1 = ' xxx'.
    if sy-subrc <>0
    read table   <table xxxx> with key field1 = 'yyy'.
    if sy-subrc = 0
    endif.
    else.
    do your data processing.
    endif.
    Thans.

  • How to assign a value for Unit of measure (like PC, KG...) in ABAP program?

    Hi,
        How to assign a value for Unit of measure (like PC, KG...) in ABAP program?
        I want to assign PC in a field to execute the program, like wa-ENTRY_UOM = 'pc'.
        But the system returen a message that "Unit of measure  is not convertible to stockkeeping unit PC"
        Could anyone tell me how to assign the value??
        Thanks!

    hi,
    first convert the quantity in the same unit  ( like in you case ST to PC )  by using FM :    MD_CONVERT_MATERIAL_UNIT
    CALL FUNCTION 'MD_CONVERT_MATERIAL_UNIT'
        EXPORTING
          i_matnr                    = matnr
          i_in_me                    = entry_uom
          i_out_me                   = out_uom
          i_menge                    = quantity
       IMPORTING
         E_MENGE                     = fp_l_v_quant
       EXCEPTIONS
         ERROR_IN_APPLICATION       = 1
         ERROR                      = 2
         OTHERS                     = 3.
      IF sy-subrc <> 0.
              give error message here
       ENDIF.
    bcoz in ur program somewhere the quantities etc are compared and there units may be different... so that is why it is showing such error.  so just convert convert the quantity in the same unit  .
    regards
    rahul
    Edited by: RAHUL SHARMA on Jun 17, 2009 9:31 AM

  • How to assign a value to a parameter {?MyParam} dynamically?

    How to assign a value to a parameter {?MyParam} dynamically?
    Example:
      {?One_Or_Two}  <- my first parameter
      {?MyParam}       <- My second parameter
    The Code:
    If ( {?One_Or_Two} = 'One'  then
        {?MyParam}  = 'One' ;
    else 
        {?MyParam}  = 'Two' ; 
    (THIS IS NOT WORKING FOR ME!  ANYONE KNOW WHY?)
      IT NEVER ASSIGN THE VALUE?
    My Command query looks like:
    SELECT * FROM MyTable
        WHERE MyTable.MyColumn = {?MyParam}
    THANKS

    Hi Joseph,
    I'm a bit unclear as to what you are doing and from what I see you're running in circles. 
    Your Command query is looking for a field that is equal to {?MyParam}. 
    Now you want to take {?MyParam} in the report and change the value after you've set it. 
    Parameters cannot be set from the Command, you can format it and manipulate it but they cannot be set except from the parameters window or from a front-end. 
    Thanks,
    Brian

  • How to display(binding) values in the table from more than one node?

    Hi,
    I have two nodes (TRIPS & AMOUNTS)in the context. How to bind these values into the table control?
    When i bind second one, first one is getting replaced.

    Hi Mog,
    Of course it is possible to create a table from attributes of more than one node, and in some cases this is still necessary, but you have to do this the hard (manual) way.
    If you have a table control, have a look at the properties and the elements belonging to it.
    First of all, there is the property "dataSource", which binds to a multiple node (let's name it TableRootNode). This means that for each element of THIS node, one row is created. In each row the data of exactly one element of this TableRootNode is displayed.
    Then you have columns in this table. Inside of the columns there is a header and an editor. The editor is the interesting part.
    Normally the primary property of this editor is bound to an attribute of the TableRootNode. Then everything works as expected. If it binds to an attribute of a subnode (SUB) of TableRootNode, then in row i the data of the subnode of the i-th element of TableRootNode is displayed. There is no need for SUB to be a multiple node, but it must not be a singleton.
    If you bind a property of the editor to an attribute, which does not lie in the subtree of TableRootNode, then you will see the same value in each row.
    Now it depends on the structure of your context. Take the node, which is relevant for the change in each row (I assume it is TRIPS) and bind the table to the node as you are used to. Then for each additional column, you have to create a new column in the tree, create a new header element with a title and a new editor (e.g. textview or inputfield) and then bind the right property of the editor to the corresponding attribute in node AMOUNTS).
    If these 2 nodes do not have parent-child-relationship, the tip to create a new node, which consists of the attributes of both nodes is the only solution.
    Ciao, Regina

  • How to assign Profit segment to the G/L account

    hi all,
    have anyone know how to assign Profit segment to the G/L account?
    rgds,
    Worached

    Hi,
       Select the
         1. Field Status Group for Profitability segment (T.Code : OBC4)
         2. Select the automatic account assignment (T.Code : OKB9)
         3. Select the PA Transfer Strcuture , direct posting from FI and MM.
      Hope this helps. Please assign points as way of thanks.
      Thanks
      Lakshmi Narayana

  • How can I set the value to a session bean from backing bean

    Hi Experts,
    How can I set the value to a session bean from backing bean where I have created getter and setter
    methods for that variable.
    Basically I am using ADFUtils class where I am able to get the value from session bean
    using following expression
    String claimType =
    (String)ADFUtil.invokeEL("#{ClaimValueObj.getClaimType}");
    Thanks
    Gayaz

    Gayaz,
    Wrong Post !!
    Post in JDeveloper and ADF
    Thanks
    --Anil                                                                                                                                                                                                                               

Maybe you are looking for

  • Lost Adobe tab in Word 2007

    Hi, I had a Word 2007 crash, and when I reopened Word the Adobe tab (for converting to PDF) tab had disappeared When I go to Word options > Add-ins > COM add-ins I can see a check box with Acrobat PDFMaker Office COM add-in.(exact names may not be ac

  • Can I change the OS language?

    If I buy a MacBook in Russia, I would get my Mac OsX in Russian language. How can I change the OS language to English? The keyboard would be in Russian with English letters in a smaller way. I speak Russian, but my wife doesn't, so I would like to ch

  • [yet another] problem with proxy

    On my PC, sometimes I am connected directly to the Internet and sometimes via VPN. In the latter case, all Internet traffic goes via http/https/socks proxy. In either of these situations Skype works well, but... The is a problem when I disconnect fro

  • Worker error

    i was asked to apply the patch 4607647.Here iam getting the worker error. i used the adctrl utility.the status of the worker is as follows AD Controller Menu 1. Show worker status 2. Tell worker to restart a failed job 3. Tell worker to quit 4. Tell

  • Contact Sheet problems with LR 1.3.1 for MAC

    Hey, When I'm saving my contact sheets as PDF files in "Draft Mode Printing" mode about 20% of all the images comes out blurry. It looks just like they are out of focus, this occurs every time I do contact sheets in LR and uses "Draft Mode Printing"