ADF BC: modifying VO bind params before executing the query

Hi gang
I've a use case in ADF BC where I need to modify View Object bind parameters (eg. convert strings to uppercase) entered by users to change the result of the underlying VO query, and show the modified bind parameters to the user after the query.
Normally I would do this in the VO query by modifying the query where clause with the appropriate SQL. However this method is not applicable in this specific use case as the user doesn't get to see the modified bind parameters as a result.
I've thought about a few options including:
1) Generating the bind parameter accessors for the ViewObjectImpl and overriding the bind parameter setters to convert all string values to uppercase. This wasn't suitable as it looks like ADF Faces RC doesn't make use of the accessors via the default ADF bindings.
2) Overriding the applyViewCriteria() method in the ViewObjectImpl - which however isn't appropriate as it applies to search fields entered as view criteria, not bind parameters.
3) Overriding the executeQueryForCollection() method in the ViewObjectImpl - I thought I was on a winner here as I could retrieve the bind parameters via a call to getNamedWhereClauseParams(), modify the bind params and then call setNamedWhereClauseParams() to set them back. Unfortunately to really set the params I then need to call executeQuery() inside executeQueryForCollection() which puts the VO in a loop. You can see my sample code below:
@Override
protected void executeQueryForCollection(Object queryCollection,
                                         Object[] bindParams,
                                         int noUserParams) {
  AttributeList bindParamList = getNamedWhereClauseParams();
  String[] bindParamNames = bindParamList.getAttributeNames();
  Object[] bindParamValues = bindParamList.getAttributeValues();
  boolean valueChange = false;
  if (bindParamNames != null && bindParamValues != null) {
    String bindParamName = null;
    Object bindParamValue = null;
    for (int i = 0, j = bindParamNames.length; i < j; i++) {
      bindParamName = bindParamNames;
bindParamValue = bindParamValues[i];
if (bindParamName != null && !bindParamName.equals("")) {
if (bindParamValue instanceof String) {
if (bindParamValue != null && !bindParamValue.equals("")) {
bindParamList.setAttribute(bindParamName, (Object)((String)bindParamValue).toUpperCase());
valueChange = true;
} // else do nothing; null String
} // else do nothing; only interested in converting Strings to upper case
} // else do nothing; bind parameter name is null
} // else do nothing; bind parameter name or value list is null
if (valueChange) {
setNamedWhereClauseParams(bindParamList);
// executeQuery(); // we can't do this; causes an infinite loop
super.executeQueryForCollection(queryCollection, bindParams, noUserParams);
I can think of a number of solutions/hacks in ADF Faces RC to get around this issue, but ideally I'd like to keep the solution in the model layer. Does anybody have a better idea of how I could do this? Your help appreciated.
Thanks & regards,
CM.
PS. JDev 11g Boxer 5188: ADF BC + ADF Faces RC

Hi Chris,
have you tried modifying the passed-in bindParams argument to work around the need to call executeQuery()?
That's what I would've done:
I would have set the named where clause params (like you do) and after that I would have tried to get a new parameters Object[] back by calling ViewRowSetImpl.getParametersAsStorageType() and pass that to the super call.
Sascha

Similar Messages

  • Select the Key Figures to be presented in a query before execute the it

    Hi,
    I want to select(through checkbox) the Key Figures to be presented in a query before executing the query. I'm creating BEX queries and web templates (I'm working on BEX 7.0).
    I haven't found clear post about this so if you have implemented something like this please help me and share your solution.
    Kind regards,
    Ana

    Hi,
    If you set a property of your KF as "Hide and can be shown", you will get a filter option for these KFs after executing the report in the navigational block of web report.
    When you click on that filter, you will get the list of KFs, then you can select the desired KFs using check box.
    Regards,
    Yogesh.

  • Issue While executing the Query for Pagination using ROWNUM with like

    Issue While executing the Query for Pagination using ROWNUM with like.
    Database is Oracle11G.
    Oracle Database Table contains 8-9 lakh records
    1) SQL equal (=)
    SELECT /*+ FIRST_ROWS(n) */ ROWNUM RNUM, A.* FROM LINE A
    WHERE A.REFERENCE = 'KMF22600920'
    Execution Time:- 0.00869245 seconds
    Returns 2 resultsets
    2) SQL like (one %)
    SELECT /*+ FIRST_ROWS(n) */ ROWNUM RNUM, A.* FROM LINE A
    WHERE A.REFERENCE = 'KMF22600920%'
    Execution Time:- 0.01094301 seconds
    Returns 2 resultsets
    3) SQL like (two%)
    SELECT /*+ FIRST_ROWS(n) */ ROWNUM RNUM, A.* FROM LINE A
    WHERE A.REFERENCE like '%KMF22600920%'
    Execution Time:- 6.43989658 seconds
    Returns 2 resultsets
    In Pagination, we are using Modified version of SQL Query 3) with ROWNUM as mentioned below :-
    4) SELECT * FROM (
    SELECT /*+ FIRST_ROWS(n) */ ROWNUM RNUM, A.* FROM LINE A
    WHERE REFERENCE like '%KMF22600920%' AND ROWNUM <= 20 ) WHERE RNUM > 0
    Execution Time:- Infinite
    ResultSets:- No as execution time is infinite
    a) Instead of like if we use = in the above query it is returning the 2 resultsets (execution time 0.02699282 seconds)
    b) Instead of two % in the above query, if use one example REFERENCE like 'KMF22600920%' it is returning the 2 resultsets (execution time 0.03313019 seconds)
    Issue:- When using two % in like in the above query i.e. REFERENCE like '%KMF22600920%' AND ROWNUM <= 20 ) , it is going to infinite.
    Could you please let us know what is the issue with two % used in like and rownum
    5) Modified version of Option1 query (move out the RNUM condition AND RNUM <= 20)
    SELECT * FROM (
    SELECT /*+ FIRST_ROWS(n) */ ROWNUM RNUM, A.* FROM LINE A
    WHERE REFERENCE like '%KMF22600920%' ) WHERE RNUM > 0 AND RNUM <= 20
    Execution Time:- 7.41368914 seconds
    Returns 2 resultsets
    Is the above query is best optimized query which should be used for the Pagination or still can improve on this ?

    This would be easier to diagnose if there was an explain plan posted for the 'good' and 'bad' queries. Generally speaking using '%' on both sides precludes the use of any indexes.

  • How can i know which index will be used when executing the query ?

    1 ) I have query in which i have 3-4 tables but there multiple index on one column .
    so how can i know which index will be used when executing the query ?
    2) I have a query which ia taking too much time . how can i know which table is taking too much time ?
    3) Please Provide me some document of EXplain plan ?

    Hi Jimmy,
    Consider the below example
    /* Formatted on 2011/02/04 21:59 (Formatter Plus v4.8.8) */
    CREATE TABLE FIRST AS
    SELECT * FROM all_objects;
    UPDATE FIRST
    SET object_name = 'TEST'
    WHERE owner != 'SCOTT';
    CREATE INDEX idx_first ON FIRST(object_name);
    SELECT *
    FROM FIRST
    WHERE object_name = 'TEST';
    It has not used index
    Execution Plan
    Plan hash value: 2265626682
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 58678 | 7334K| 163 (4)| 00:00:02 |
    |* 1 | TABLE ACCESS FULL| FIRST | 58678 | 7334K| 163 (4)| 00:00:02 |
    /* Formatted on 2011/02/04 21:59 (Formatter Plus v4.8.8) */
    SELECT *
    FROM FIRST
    WHERE object_name = 'emp';
    This has used the index
    Execution Plan
    Plan hash value: 1184810458
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1 | 128 | 1 (0)| 00:00:01 |
    | 1 | TABLE ACCESS BY INDEX ROWID| FIRST | 1 | 128 | 1 (0)| 00:00:01 |
    |* 2 | INDEX RANGE SCAN | IDX_FIRST | 1 | | 1 (0)| 00:00:01 |
    From this we can come to the conclusion that, whether to use one index or not by oracle
    would also depend on the data which is present in the table. This has to be this way as
    we see in the bind peeking, if oracle sticks to only one plan, say only use the full table
    scan, it would be a performance hit when it searches for the second query ie where object_name
    ='emp';
    2.
    If we have a query like below.
    select * from emp
    where upper(ename) = upper(:p_ename);
    Evenif we have the index on ename column, oracle wouldn't be able to use the index, as there is a function in the predicate column. If you need oracle to use the index, we need to create a function based index as below.
    Create index idx_ename on emp(upper(ename));
    Regards,
    Cool

  • Invalid read mode while executing the query

    Hi,
    I have developed a query based on a cube in MM module.
    When I try to execute the query, the following error is being displayed:
    Invalid read mode
    Message no. BRAIN017
    Diagnosis
    If queries (often unintentionally) are assigned the read mode "Query to Read All Data at Once", this often results in performance problems. To eliminate this problem, this warning is displayed when you execute a query with this read mode when the query is generated.
    Procedure for System Administration
    Before you execute the query, repair the read mode:
    u2022     You can repair the read mode for this query in the Query Monitor (transaction RSRT1). You can set the read mode for the selected query by choosing Query -> Read Mode.
    u2022     If this warning is displayed when you check a query, you need to change the default read mode for new queries in the InfoCube in InfoCube maintenance. In InfoProvider maintenance, choose Environment -> InfoProvider Properties -> Change and make the relevant settings on the Query/Cache tab page.
    Please let me know what are the exact setting that I need to do and where.
    Thanks in advance.
    Will assign points for the solution.
    Thanks & Regards.

    Hi Ganesh,
    You can change the read mode by going to transaction RSRT, entering the query name and then clicking the properties button. A dialog box will then be displayed that allows you to change the read mode.
    The question of what's the best read mode for you query depends on the requirements of the query:
    If you choose "read all data at once", it will take quite awhile before the first view of the query is shown. This is because it basically reads all data needed for your query (e.g. data for hierarchy nodes etc). However, after the initial view, successive navigations might be a lot faster.
    The read mode "Read data during navigation and expansion of hierarchies" is usually the best mode. The initial view will show up in the least amount of time in this mode. However, when the users start to navigate, data will then be read from the database (aggregates, or the main cube tables) or the cache.
    The read mode "Read data during navigation" is like the "Read data during navigation and expansion of hierarchies" mode. However, it will also read the data for the hierarchy nodes. Expansions of the hierarchy will therefore be faster in this mode. Of course, there's additional overhead for the initial view.
    Hope this helps. Cheers.

  • While executing the query sales org not given in Selection screen but still

    Hi ,
    while am executing a query even though am not giving any sales organization  input in selection sceen , and execute , the query will run and pop up windows displays as ' you do not Authorization to read Zsales organization,
    same query i executed last days before  , it worked fine, but now its not working, plz advice

    Hi,
    you might made Sales org Info object as Auth relevant, hence it is giving that error.
    Eirther disable the authorization relevant check in the infoobject maintainance in Bex explorer tab...
    Or create a auth  variable for the infoobject and use it in the query..
    Regards,
    Rangz

  • Can I stop a report from Re-executing the query when I go back to that page

    I have a report that has a complicated query and looks at a lot of information to display the results. This query then links of to show details of individual items that were displayed in the result. But when I hit the back button on the browser, it executes the query again and it takes a while for the page to load.
    Is there any way to stop this and only execute the query when the User pushes a Button on the page else display the previous results.
    Thanks
    Sriram

    Another alternative is to make that detail link open in a popup window using
    javascript:popupURL(...);This way, the complicated report page is always visible.

  • While executing the query in the web template I am  facing below issue

    Hello SAP geniuses,
    Please help me on my issue  ,
    while executing the query in the web template i am  facing below issue.
    The variable for characteristic (region) is appearing but this characteristic (region) is not appearing in the free characteristic zone  but when we are executing the query with out webtemplate it is showing both variable and free characteristic
    can anybody help us to identify what is the issue with the web template.
    Thanks
    Alok

    Hi,
    Plz check ur report and execute at the designer and take its technical name and go to RSRT. log out and log in and try..
    if not check ur authorisation.
    Regards....KP

  • 0ADHOC error while executing the query from Report Designer

    Hi All,
    When I am executing The Query from Report Designer,  am getting the below error.
    Please help me in this regard.
    The initial exception that caused the request to fail was:
    The Web template "0ADHOC" does not exist in the master system
    com.sap.ip.bi.base.exception.BIBaseRuntimeException: The Web template "0ADHOC" does not exist in the master system
    at com.sap.ip.bi.webapplications.runtime.service.template.impl.TemplateService.getTemplateContent(TemplateService.java:57)
    at com.sap.ip.bi.webapplications.runtime.jsp.portal.service.template.PortalTemplateAccessService.getTemplateContent(PortalTemplateAccessService.java:82)
    at com.sap.ip.bi.webapplications.runtime.preprocessor.Preprocessor.parseTemplate(Preprocessor.java:163)
    at com.sap.ip.bi.webapplications.runtime.xml.XmlTemplateAssembler.doInit(XmlTemplateAssembler.java:79)
    at com.sap.ip.bi.webapplications.runtime.template.TemplateAssembler.init(TemplateAssembler.java:133)
    Thanks,
    KVR

    Hi,
    The web template 0ADHOC is usually the standard web template for 3.x queries. The Report Designer executes the reports in java web, thus tries to find the template 0ADHOC in the 7.0 templates and does not find it. Check whether you have maintained the standard web template 0ADHOC for 7.0 reports also:
    Transaktion SPRO -> SAP Reference Image -> SAP NetWeaver -> Business Intelligence -> Settings for Reporting and Analysis -> Bex Web -> Set Standard Web Templates
    Best regards,
    Janine

  • While executing the query getting an error u2018Page Not Foundu2019 in the bowser.

    Hello,
    I opened a Bex Query in Query Analyzer and clicked on the Execute button to execute the query in our portal site. But I am getting an error u2018Page Not Foundu2019 in the bowser.
    As I am new to BI,Kindly guide me through the steps.
    what all setting needs to be done?
    Regards,
    Rachel

    Hi,
    The Path is C:\WINDOWS\system32\drivers\etc\hosts
    You need to update "host file" in your server/in your PC. So ask Network people to do it and also you need to change your browser LANsettings.
    Eg:   11.11.8.161     BWQ1     BWQ1.***.com
    Like above you need to change in your host file.
    Thanks
    Reddy
    Edited by: Surendra Reddy on Nov 27, 2008 8:12 AM

  • Error while executing the query in RSRT

    Hi to all,
    I am executing the query in client development system in RSRT.
    Error coming (Query could not open Genun  id is invalid)
    I shall be thankfull to you for this.
    Regards
    Pavneet Rana

    Hi,
    Plz check ur report and execute at the designer and take its technical name and go to RSRT. log out and log in and try..
    if not check ur authorisation.
    Regards....KP

  • Error while executing the query-VIMP

    Dear alll
    I am executing the query in production i am getting this below error message
    BRAIN 629 Specify a value for variable companycode(single values,entry,mandatory)
    BRAIN  629 specify a values for variables Simulkation ID1Individal values,requireed entry)
    RSBOL 000 Program error in class SAPMSSY1 Method UNCAUGHT_EXCEPTION
    BRAIN 633 varibale contain invalid values
    It have been worked untill yesterday
    Please suggest me in futhuru its very very imp to deliver the reports

    Hi,
    Try one of these
    1. Take of the infoobject from the query definition and see if the query is working.
    2. Try saving this Query as another one and try executing it.
    REgards
    Govind

  • Serious system error while executing the query: java.lang.OutOfMemoryError

    From ALSB, we are trying to insert records in a table, by calling the ALDSP webservice. It is working fine when the xml (ie., given as input to the ALDSP webservice) is small. But facing the following error when the input xml size is large.
    <ALDSP> <BEA-000000> <Product> <Serious system error while executing the query:
    {ld:ABC/Test}createTest:1
    java.lang.OutOfMemoryError: Java heap space
    We do not want to increase the heap size. Is there any other way we can solve this problem?

    In logical dataservice of ALDSP we have created a procedure called createTest, which is used to insert mulitple rows in the table. We have created a webservice for that logical DataService.
    Using the ALSB, we are calling the webservice -> createTest Operation and we are passing xml as input to that createTest function.
    Input xml:
    <ns1:createTest>
    <ns1:createTemps>
    <ns0:createTemp>
         <ns0:field1>1</ns0:field1>
              <ns0:field10>test1</ns0:field10>
    </ns0:createTemp>                
    <ns0:createTemp>
         <ns0:field1>2</ns0:field1>
              <ns0:field10>test2</ns0:field10>
    </ns0:createTemp>
         </ns1:createTemps>     
    </ns1:createTest>
    each ns0:createTemp represent a row that need to be inserted in the table.
    When the number of ns0:createTemp is less ( when the number of rows that need to be inserted is less) then no problem occurs, it is getting inserted properly. But when there are more number of ns0:createTemp then we are getting the following error
    <ALDSP> <BEA-000000> <Product> <Serious system error while executing the query:
    {ld:ABC/Test}createTest:1
    java.lang.OutOfMemoryError: Java heap space

  • Dump while executing the Query

    Hi,
    when I try to execute the query I get the following dump.
    ASSIGN_TYPE_CONFLICT
    Error analysis
    You attempted to assign a field to a typed field symbol,
    but the field does not have the required type.
    Pleaes assist , its urgent
    Regards,
    ANita

    Hi,
    The problem is Solved.
    If the problem is occuring while running the query,  regenerate the query through transaction RSRT.
    Regards,
    ANita

  • [Execute SQL Task] Error: Executing the query failed with error: "The COMMIT TRANSACTION request has no corresponding BEGIN TRANSACTION."

    I have an package with source , data flow and destination to execute on begin and commit.
    in the below i have just used for questioning purpose with diagram removing my Data Flow task explaining my problem
    on execution, i get error as
    [Execute SQL Task] Error: Executing the query "COMMIT TRAN DimCompanyCode" failed with the following error: "The COMMIT TRANSACTION request has no corresponding BEGIN TRANSACTION.". Possible failure reasons: Problems with the query, "ResultSet"
    property not set correctly, parameters not set correctly, or connection not established correctly.
    as mentioned , i have checked the ResultSet, parameters , connection establish.. all are fine.
    Kindly advice on what has to be done.
    ShanmugaRaj

    To avoid this error, the RetainSameConnection property should set to 'True' for the Connection Manager - Application_DB.
    Narsimha

Maybe you are looking for

  • 'Unspecified' value in the Prompt drop down

    Hi All, I am facing a very unusual issue in my report. The 'Unspecified' value keeps showing up in the Prompt drop down even if doesn't really exist in the Database. This 'Unspecified' value refers to the NULL value. I have tried using a filter on th

  • How to place a pdf form online?

    I created a new pdf form with all the necessary field but when i uploaded it online, I could not write anything in the form fiels or tick a box

  • Creative Sound Mixer / EAX Control Panel-Audio HQ Sect

    After updating my Creative LABS Sound Blaster, I now have a problem with the [color="#cc3333">Reverb & Chous effects. The sliders no longer increase or decrease the number sequence, meaning from number (0) zero to whatever the highest number is. It n

  • Hp pavilion dv7-1160us

       Ran tests and I get this message at start up. Hard test passed. Hard disk 1 quick (303) Hard disk 1 full (305) I bought a new hard drive and tryed to clone my old one with no luck. The clone devise says to many read errors. So how do I install win

  • Can't import .avi files?

    I'm trying to record my screen using a program called Debut by NCH Software, but this program only saves the video as .avi.  Then when I try to import it into Premiere, I get a dialogue box saying "Add media failure" and "This type of file is not sup