Dynamic Order by with user defined Where clause...

Hello!
I have a block based on a table, with no order by set and no where clause.
The block is queryable so users can filter the data to be retrieved.
Each of the columns on the form have a button above which requeries the block, applying the order by (SET_BLOCK_PROPERTY ( 'B12', ORDER_BY, :bc1.h_b12_custom_orderby ); )
The problem is that each time the block is requeried the user definied filter criteria is lost. Is there any way I can get a handle on this and maintain the filtering?
GET_BLOCK_PROPERTY(item, DEFAULT_WHERE); only retrieves the query entered while in design mode so this won't work.
I'm using Oracle Forms 6i, web based. Any suggestions are very much appreciated.
Thanks in advance,
Jay

Many thanks for your response Hedy,
Below is the procedure I used to achieve this.
I found GET_BLOCK_PROPERTY ( p_block, LAST_QUERY ) worked better than :SYSTEM.last_query. As the first time it is called within a block :SYSTEM.last_query returned the query made in another block - which I'm sure has it's applications.
Thanks again,
Jay
PROCEDURE set_last_query_where ( p_block IN VARCHAR2
, p_where IN VARCHAR2 DEFAULT NULL )IS
l_last_query VARCHAR2(10000);
l_last_where VARCHAR2(10000);
BEGIN
IF p_where IS NULL THEN
l_last_query := UPPER(GET_BLOCK_PROPERTY ( p_block, LAST_QUERY ));
l_last_where := SUBSTR ( UPPER ( l_last_query),
INSTR ( l_last_query, 'WHERE')+6, INSTR(SUBSTR(UPPER(l_last_query), INSTR(l_last_query, 'WHERE')+8), 'ORDER BY'));
ELSE
l_last_where := p_where;
END IF;
SET_BLOCK_PROPERTY ( p_block, DEFAULT_WHERE, l_last_where );
EXCEPTION
     WHEN FORM_TRIGGER_FAILURE THEN
     ref_raise_ftf;
     WHEN OTHERS THEN
     ref_others( 'P-SLQW' );
END;

Similar Messages

  • Retain standard SAP order type after copying with user defined order type

    Hello SAP Gurus,
    We have a requirement of retaining the standard SAP order types after copying with User defined order types. But the issue is we don't want to see the standard SAP order type such as PM01, PM02 in production system while using transaction like IW31 etc.
    Is there anybody who has answer to retain these stanadard SAP order types without deleting from system configuration?
    Thanks in advance.
    Cheers,
    Vaibhav

    Vaibhav,
    When you F4 on the order type field in IW31 you will get the popup showing the order type list. At the top of this list is a button with a green "+" sign (Insert in personal list).
    You can use this button to select your favourite list.
    This function is available in most F4 drop-down lists.
    However, you cannot set this setting for all users. You will need to write an ABAP program to do this.
    PeteA

  • Define a Standalone Download Integrator with an Additional Where clause - SQL error

    Hi,
    I am trying to create a standalone integrator with an Additional Where clause. Followed the steps mentioned in the metalink note 360105.1. When I run the integrator, I get the following error message.
    Please resolve the following error to continue.
    SQL error: ORA-00936: missing expression occurred
    processing stored SQL for Content 20007:GENERAL_441_CNT.
    When I look at the log file, here is what I can see:
    10/22/14 10:50 AM AJPRequestHandler-HTTPThreadGroup-15 TRACE          BneHrSQLControl - SQL:SELECT  FROM PER_PEOPLE_V where last_name=$PARAM$.last_name
    10/22/14 10:50 AM AJPRequestHandler-HTTPThreadGroup-15 TRACE          validateSQLStatement value of sqlStatement is: SELECT  FROM PER_PEOPLE_V where last_name=:RSQLP1
    10/22/14 10:50 AM AJPRequestHandler-HTTPThreadGroup-15 DETAIL         BneHrSQLControl.validateSQLStatement() paramName: last_name
    10/22/14 10:50 AM AJPRequestHandler-HTTPThreadGroup-15 DETAIL         BneHrSQLControl.validateSQLStatement() error in SQL: java.sql.SQLSyntaxErrorException: ORA-00936: missing expression
    So, clearly, the SQL statement that is getting built internally is wrong. Ideally, I would expect the statement to be something like this:
    SELECT *  FROM PER_PEOPLE_V where last_name=$PARAM$.last_name.
    RDBMS : 11.2.0.3.0
    Oracle Applications : 12.1.3
    Any pointers towards the resolution of the issue would be of great help.
    Thanks in Advance!
    Lalitha.

    This is a duplicate post of your other question:  create trigger automatic
    DO NOT start duplicate threads for the same question.
    Locking this thread

  • Cardinality estimator 2014 is off with OR in where clause

    Here is my test setup on SQL Server 2014.
    -- Create big table
    CREATE TABLE [dbo].[Store](
    Id int IDENTITY(1,1) NOT NULL,
    City int NOT NULL,
    Size int NOT NULL,
    Name varchar(max) NULL,
    CONSTRAINT [PK_Store] PRIMARY KEY CLUSTERED ([Id] ASC)
    GO
    CREATE NONCLUSTERED INDEX [IX_Store] ON [dbo].[Store] (City ASC, Size ASC)
    GO
    -- Fill with 100k rows
    INSERT Store
    SELECT i % 101, i % 11, 'Store ' + CAST(i AS VARCHAR)
    FROM
    (SELECT TOP 100000 ROW_NUMBER() OVER (ORDER BY s1.[object_id]) AS i
    FROM sys.all_objects s1, sys.all_objects s2) numbers
    GO
    -- Create small table
    CREATE TABLE #StoreRequest (City int NOT NULL, Size int NOT NULL)
    GO
    INSERT #StoreRequest values (55, 1)
    INSERT #StoreRequest values (66, 2)
    Now I execute the following query (I force the index to show statistics estimates)
    SELECT s.City
    FROM #StoreRequest AS r
    INNER JOIN Store AS s WITH(INDEX(IX_Store), FORCESEEK)
    ON s.City = r.City AND s.Size = r.Size
    WHERE s.Size <> 1 OR r.City <> 55
    Here are the estimates that I get (I'm not allowed to upload pictures):
    Index Seek IX_Store
    Actual Number of Rows: 90
    Estimated Number of Rows: 50000
    Fixing WHERE clause to use one table not two makes the estimate perfect:
    SELECT s.City
    FROM #StoreRequest AS r
    INNER JOIN Store AS s WITH(INDEX(IX_Store), FORCESEEK)
    ON s.City = r.City AND s.Size = r.Size
    WHERE s.Size <> 1 OR s.City <> 55
    Index Seek IX_Store
    Actual Number of Rows: 90
    Estimated Number of Rows: 89.74
    Switching to 2012 compatibility mode gives estimate of 1 in both cases:
    Index Seek IX_Store
    Actual Number of Rows: 90
    Estimated Number of Rows: 1
    Could anyone explain the first result? I'm a bit worried about it. The fix in this case is trivial, but this problem gave us quite some headache in more complex real life queries with multiple joins.
    Thank you!

    But not full statistics on a field basis, just sometimes some default stats like total row count that some plans will build.  Even your StoreRequest table only has one two-field index that will have a full histogram.
    But I've seen SQL Server make massively bad plans on two-field indexes.
    I've seen SQL Server go wrong one-column indexes, so that is not a very relevant point.
    Temp tables or not, the estimate here is clearly incorrect. SQL Server knows the density of Size and City. It knows the cardinality of the temp table. The density information gives how many rows the the join will produce. The WHERE clause will then remove
    a certain number of rows. With no statistics for the temp table, it does not now how many, but it will apply some standard guess.
    50000 is a completely bogus number, because the join cannot produce that many rows, and SQL Server is able to compute the join with out the WHERE clause decently. (Well, it estimates 90, when the number is 180.) No, this is obviously a case of the cardinality
    estimator giving up completely.
    It is worth noting that both these WHERE clauses gives reasonable estimates:
     WHERE r.Size <> 11 OR r.City <> 550
     WHERE s.Size <> 11 OR s.City <> 550
    Whereas these two gives the spooky 50000:
     WHERE s.Size <> 11 OR r.City <> 550
     WHERE r.Size <> 11 OR s.City <> 550
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Dynamic webservice client for User-defined datatypes

    Hi All,
    I have a webservices with user-defined datat types. I want to write a dynamic client that will work even if there are any changes in the wsdl, so that I do not want to recompile the client or make any changes on the client side.
    I tried using DII but we need to modify the custome objects and recompile the same. Suggest me any alternative.
    Regards,
    Sanjay

    Rob, unfortunately not. If I ever come across the solution, I will post it here.
    The reason I wanted to use weblogic webservices was to take advantage of the asynchronous webservice functionality. I ended up using xfire instead for my webservices, as we already had that in place in the application, and then using polling clients to get the response. Not an ideal solution, but it works very good anyway.
    regards,
    Marcus

  • Create a view with a changing where clause

    Hi all,
    i'm developing an application with oracle forms i want to create a view in the database with a different where clause in every time , the where clause is determined due to the department id of the current user .
    thanks alot.

    SQL> create view emp_view as select empno, ename, deptno from emp;
    View created.
    SQL> select * from emp_view where deptno = 10;
         EMPNO ENAME          DEPTNO
          7782 CLARK              10
          7839 KING               10
          7934 MILLER             10
    SQL>

  • Error erase Queries in Query Manager- The query is used with user-define...

    Hello Experts
    I have deleted a User Field that had a Formatted Search and now I can not remove it because it is linked according to a UF, the error message is as follows:
    "The query is used with user-defined values [Message 952-23]"
    There will be a way to resolve this issue???
    Thanks in advance

    Hi Juan,
    I have tried this very limited, but the formid, is this a number in your case?
    SELECT * from cshs t0 inner join ouqr t1 on t0.queryid = t1.intrnalkey
    where t1.qname = '[%0]'
    Running this query I can get the form id that I need to recreate, but I have a feeling you already know the form id, is this correct?
    - Is there an error when you try to recreate the form id?
    - Will it not let you recreate the same form id because the id is given by the system?
    If it is not possible to recreate the form id, please prepare a backup and log a message. Support should be able to correct the entry in table cshs.
    Hope it helps.
    Jesper

  • Personalization Publication with user defined / multiple / discrete values

    Hello,
    I try to personalize a main report ( with Enterprise XI 12.1.0, Crystal Report XI  )
    ( parameter p_company_code ( as string ),  with user defined / multiple / discree and range values )
    with dynamic recipients ( Crystal Report ).
    For a single value it works.
    But I did not find a solution how to set up the values for my parameter p_company_code so that I can start the main report
    with the following company codes  ( 4711, 4712, 0815-0890 ) for one recipients ( only one report for all this company codes  )
    Thans for your help
    H. Blum

    Hi Fabio,
    It works as follows.
    let's say you have 3 multiple single lines for your cost center variable.
    once you are in the folder, select any single value & the layout is ready for planning with the corresponding cost center.
    now, select the "Cost center variable row" in the header of the folder within section "Name of Variable" & click on "Trash Can" icon to "Delete Selection" of variable.
    this basically deletes all the entered selections (3 entries) & displays for all.
    It works this way, because we don't have "resriction of values required by user".
    if am not wrong & correct me if am wrong,
    overall, this is nothing but equal to "planning level not restricted with any variable".
    I just tested this & the flaw in this is that, it is not only displaying for all the initially entered 3 lines but it displays for each & every cost center irrespective of the variable selections.
    hope it is clear.

  • In which order does the query's where clause condition is checked

    Hi All,
    can anyone tell me in which order does oracle evaluate the where clause condition?
    for ex: select * from users where user_type='Admin' and stauts='Enabled'

    user9981103 wrote:
    The conditions in the WHERE clause are checked in the reverse order of the given order.
    i.e; first it will check stauts='Enabled'* and then user_type='Admin'* for your given queryWhy do you believe that?
    If there is a sufficiently selective b-tree index on USER_TYPE, the optimizer would undoubtedly use that index to process the USER_TYPE = 'Admin' condition and then check the STATUS column.
    If there is a sufficiently selective b-tree index on STATUS, the optimizer would undoubtedly use that index to process the STATUS='Enabled' condition and then check the USER_TYPE column.
    If there is a composite b-tree index on (STATUS, USER_TYPE), the optimizer would use that index to process the two conditions nearly simultaneously, though technically the leading column of the index is evaluated first. Of course, if you reverse the order of columns in the index, you get a different evaluation order
    If there are bitmap indexes on STATUS and USER_TYPE, Oracle can combine the two indexes and evaluate the two conditions simultaneously.
    And that is leaving out tons of query plan options and other optimizer wrinkles.
    Justin

  • On success of form save I want to go to another for with a detail where clause

    I have the follow code snippet which is intented to go to a form on a successfull save. I query some data based on the save then build a url to navigate to a new form. I want the form to show only data that is lacking in one column not being populated (column is null). The url works, but the form detail where clause is ignored. Does anyone have any experience with passing detail where clauses to a form? Did I miss something in the code below?
    begin
    select count(rl_id) into n_rl_id_cnt
    from rfq_lines
    where part_part_id is null and rh_rh_id=n_rh_id;
    exception
    when others then
    null;
    end;
    htp.p('cnt '||to_char(n_rl_id_cnt));
    if n_rl_id_cnt>0 then
    htp.p('cnt >1');
    my_url := 'PORTAL30.wwa_app_module.link?' ||
    'p_arg_names=_moduleid&p_arg_values=3677858481' ||
    '&p_arg_names=_show_header&p_arg_values=YES' ||
    '&p_arg_names=rh_id&p_arg_values=' || LTRIM(TO_CHAR(n_rh_id)) ||
    '&p_arg_names=_rh_id_cond&p_arg_values=%3D'||
    '&p_arg_names=_detail_where_clause&p_arg_values=part_part_id%20is%20null'; -- <this is not working right. where clause is ignored.
    htp.p(my_url);
    go (my_url);

    Hi Jeffrey ,
    You need to use a custom Format script for the field.
    Regards
    Sukrit Dhingra

  • Does the Order of the tablesjoins in Where clause matter in ORDERED hint?

    The ORDERED hint requests that the tables listed in the FROM clause of a SQL statement be joined in the order specified. But does the order of the join in "where" clause matters?
    Will be there any performance difference between below query? The order of the table in the FROM clause remains the same, but there is a difference in the order of conditions in the WHERE clause
    SELECT /*+ ORDERED */ a.fp_i f
    FROn iw_owner.revenue_fpct b,
    dw_owner.fp_dinn c,
    dw_owner.nanaged_at_dinn a,
    dw_owner.at_dinn_curr d,
    iw_owner.na_progran e,
    dw_owner.fp_dinn_curr f,
    dw_owner.fpn_of_at_dinn g
    WHERE a.nacc_dinn_i = b.nacc_dinn_i
    AND b.fp_dinn_i = c.fp_dinn_i
    AND a.acc_i = d.acc_i
    AND a.acc_nacc_c = e.npn_pro_c
    AND a.fp_i = f.fp_i
    AND b.org_fpn_dinn_i = g.org_fpn_dinn_i(+)
    AND c.fp_i IN ('JG 04')
    AND b.dte_dinn_i BETWEEN '1-Apr-2011' and '30-Apr-2011'
    SELECT /*+ ORDERED */ a.fp_i f
    FROn iw_owner.revenue_fpct b,
    dw_owner.fp_dinn c,
    dw_owner.nanaged_at_dinn a,
    dw_owner.at_dinn_curr d,
    iw_owner.na_progran e,
    dw_owner.fp_dinn_curr f,
    dw_owner.fpn_of_at_dinn g
    WHERE c.fp_i IN ('JG 04')
    AND b.dte_dinn_i BETWEEN '1-Apr-2011' and '30-Apr-2011'
    AND b.fp_dinn_i = c.fp_dinn_i
    AND a.nacc_dinn_i = b.nacc_dinn_i
    AND a.acc_i = d.acc_i
    AND a.acc_nacc_c = e.npn_pro_c
    AND a.fp_i = f.fp_i
    AND b.org_fpn_dinn_i = g.org_fpn_dinn_i(+)
    Thanks

    Gangadhar Reddy wrote:
    Does it matter the order of first 2 tables?This question makes me really wonder. It's fairly easy to see how explain changes when using hints.
    Your question indicates that you do not look at explain plans?
    Then why are you asking about hints in the first place?
    Using hints is something you do when you want to force a specific execution plan as part of some investigation, because you know something that the optimizer does no, or you have found a bug in the optimizert.
    In all cases you know exactly what you are doing.
    The /*+ ORDERED */ is all about you telling the optimizer to join the tables in the order you specified them in the from clause.
    As to your original question, there exists a similar ORDERED_PREDICATES hint.
    Regards
    Peter

  • Problem with user-defined functions in XQuery String

    hello
    i've a problem with user-defined functions in XQuery String
    details are here (the code is not Human-readable via forum's embedded editor ?? strange)
    http://docs.google.com/Doc?id=ddqwddsr_21c96d9x
    thanks !!

    See
    michaels>  select xmlquery('declare function local:test_function($namecmp as xs:string?, $inputtype as xs:string?) as xs:string?      
                        return {$inputtype}
                     local:test_function("1","2")' returning content) o from dual
    Error at line 5
    ORA-19114: error during parsing the XQuery expression:
    LPX-00801: XQuery syntax error at '{'
    3                       return {$inputtype}
    -                              ^
    michaels>  select xmlquery('declare function local:test_function($namecmp as xs:string?, $inputtype as xs:string?) as xs:string?      
                        $inputtype
                     local:test_function("1","2")' returning content) o from dual
    O   
    2   
    1 row selected.

  • Display of document line items with user defined fields

    Hi all,
    I have created two user defined fields in CI_COBL structure and they are available on OBC4 screen. I maintained  optinal for entry in the screen layout. I posted one document with user defined fields and saved.
    Now the document is updated in BSEG table. I then display the document, and it display the doucment
    But when i double click on the one of the line items system gives an error that there is some problem in customising and entries missing in Table COBM.
    I checked OXK3 and see that in field information for user fields, it says entries maintained in table COBM.
    But still i couldnt display my line items in detail.
    Any solutions
    Thanks in advance
    Ram

    Yes your are looking at the correct sap note.
    Things look pretty straight forward in the notes documentation.
    1)Extend the VBKRED structure with the fields you want.
    2)Populate thse values in the user exit in program DBKMVF02 in FORM routine USER_EXIT_FUELLEN_XVBKRED.
    For extending a standard structure you need to create a zstructuree in se11 first and then append it to the standard structure.
    In your case you need to  extend VBKRED_EX1 structure rather than VBKRED.
    Regards,
    ravi

  • ALV with user-defined buttons on toolbar in wd abap

    Hi All,
    I have to create an alv with user defined buttons  in wd abap on its toolbar.Could any one tell me in detail about it or provide me with any tutorial based on it.
    Thanking you all in advance.

    DATA: LR_CMP_USAGE TYPE REF TO IF_WD_COMPONENT_USAGE.
    DATA: LR_INTF_ALV TYPE REF TO IWCI_SALV_WD_TABLE.
    LR_CMP_USAGE = WD_THIS->WD_CPUSE_ALV( ).
    IF LR_CMP_USAGE->HAS_ACTIVE_COMPONENT( ) EQ ABAP_FALSE.
       LR_CMP_USAGE->CREATE_COMPONENT( ).
    ENDIF.
    LR_INTF_ALV = WD_THIS->WD_CPIFC_ALV( ).
    WD_THIS->M_MODEL = LR_INTF_ALV->GET_MODEL( ).
    DATA: LR_FUNCTION TYPE REF TO CL_SALV_WD_FUNCTION.
    LR_FUNCTION =
    WD_THIS->M_MODEL->IF_SALV_WD_FUNCTION_SETTINGS~CREATE_FUNCTION(
                            ID = 'ISSUE' ).
    DATA: LR_BUTTON TYPE REF TO CL_SALV_WD_FE_BUTTON.
    CREATE OBJECT LR_BUTTON.
    LR_BUTTON->SET_TEXT( 'Issue/Receive' ).
    LR_FUNCTION->SET_EDITOR( LR_BUTTON ).
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/101df93f-4b5c-2910-14aa-9eb0338c2110
    Abhi

  • Want to proceed with User defined fuction in Mapping i dont know java

    Hi all ,
                  i dont know Java , i want to proceed with user defined fuction , i  have worked with ABAP but not with java ,  i do want abt some knowledge about it ,
    thanks
    sridhar

    Hi,
    Please see the below links ,
    /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i
    Difference in using java,xslt,message mapping
    /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i
    /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-ii
    /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-iii
    /people/stefan.grube/blog/2006/10/23/testing-and-debugging-java-mapping-in-developer-studio
    /people/thorsten.nordholmsbirk/blog/2006/08/10/using-jaxp-to-both-parse-and-emit-xml-in-xi-java-mapping-programs
    /people/rahul.nawale2/blog/2006/07/18/java-mapping-an-alternate-way-of-reading-a-csv-file
    /people/amol.joshi2/blog/2006/03/10/think-objects-when-creating-java-mappings
    XSLT Mapping
    /people/prasadbabu.nemalikanti3/blog/2006/03/30/xpath-functions-in-xslt-mapping
    /people/sreekanth.babu2/blog/2005/01/05/design-time-value-mappings-in-xslt
    /people/anish.abraham2/blog/2005/12/22/file-to-multiple-idocs-xslt-mapping
    XSLT Mapping with java enhancement
    /people/pooja.pandey/blog/2005/06/27/xslt-mapping-with-java-enhancement-for-beginners
    Regards
    Chilla..

Maybe you are looking for

  • Trigger Problum

    HI i have table audit_any_table CREATE TABLE audit_any_table     user_name VARCHAR2(100),     Primary_key1 VARCHAR2(100),     table_name VARCHAR2(30),     col_name VARCHAR2(30),     old_value VARCHAR2(1000),     new_value VARCHAR2(1000),     UPDATE_D

  • How to get the Attributes of file ?

    Hi Guru, How to find of the Attributes of file in sap u2018 AL11u2019. The file attribute details need to show in the report. If any idea plz. Help me. Regards, Subash

  • How to use function module 'MC_POPUP_TO_MARK_VALUES' ?

    Hai, I  used   CALL FUNCTION  'MC_POPUP_TO_MARK_VALUES'   to delete duplicates in the F4 help  but    in my program ,When we press F4 help , radio buttons are appearing in the F4 help window. How to avoid that ? Or is there any other function module

  • IView Displaying sets of 15 DMS documents at a time.

    I have an iView which is displaying DMS documents. It currently displays 15 at a time with "1-15 16-30 31-45 46-53 > >>  / 53 " displayed at the bottem of the list. How do I get it to display more than 15? Even better if someone could point me to som

  • SJSAS v9.0 : jsf-api 1.2 in javaee.jar causes trouble for jsf 1.1 apps

    In Sun Java System Application Server v9.0 (or 9.1), jsf-api v1.2 is embeded in javaee.jar. This causes a lot of trouble when deploy web applications written with jsf v1.1. Is there a way to avoid this without modifying web applications to migrate to