Case-sensitive wild-cards in Select Query

Hi,
I have to make a search help for Portal like it is in standard SAP's Who's Who search help in HR-ESS.
I have to fetch data (wildcards) from Portal & on the basis of that I need to give them the actual no. of matching data.
In short, I'll take only one data, say 'Short Text of Organizational Unit' - T527X-ORGTX .... ( 'Organizational unit' - PA0002-ORGEH ).
Here, in this case, I'm converting all '*' with '%' with this statement :
  ORGTX1 = ORGTX.
  REPLACE ALL OCCURRENCES OF '*' IN
  ORGTX1 WITH '%' .
  SELECT ORGEH FROM T527X
           INTO CORRESPONDING FIELDS OF TABLE itab
           WHERE ORGTX like ORGTX1
           and        SPRSL = 'EN'.
My problem comes, when the user enters data like HR dep and the actual data in the table is HR Department, then the select query doesn't work.
I'm providing some other cases:
Provided data by User           Actual Data in Syatem
emp                                    Employee
EMP1*                                Employee1
hr                                        HR
Hr                                       HR
so many, other permutations & combinations like this.
I've checked so many threads, but didn't get the actual answer. Some persons are saying to use translate, but I can only use translate after fetching the data. here the problem is with fetching itself & I can't judge at runtime that which letter the user will put in upper case & which in lowercase.
Can someone please guide me, how to tackle this problem ???

Hello Mohit,
First of all, welcome to SDN!
What you have done as far as the implementation of the solution is concerned is quite correct. Please understand that wildcard search in SAP is case sensitive - so if the user enters data like HR dep * and the actual data in the table is HR Department then the user will not get any results back which is fully justified i.e. that's the way it should be. If you refer back to the table T527X and try a wildcard search on field ORGTX, the result is the same if you enter what the user is entering on the Portal i.e. HR dep*.
I think the users should be aware that this is how wildcard searches are designed to behave in SAP - this could be part of their training or you can even produce a message in your program when the select query fails.
The other option is of course to use TRANSLATE but there could be so many scenarios / permutation combinations - I don't suggest anyone goes that way to "guess" (or read) user's mind then deliver the solution because there will come a scenario when the program will be unable to "read" the user's mind as a result the select query will inevitably fail.
Hope this helps.
Cheers,
Sougata.

Similar Messages

  • What is considered as a wild card for a query

    I am calling a query from Visual Composer. But I need to run the query when the variable is not selected. I have made the Variable optional.
    But whenever the "input field" is left blank, it seems like Visual composer is passing a NULL value or something. I need to pass a wild card instead of NULL.
    Does anybody have any idea what would be a wild card. I have tried ' ' but it did not work.
    Thanks,

    Arun,
    I am on BI 7.0. I tried your recommendations, but when I enter '#' it does not get any data in Bex.
    For VC, %20 also does not work. Any other ideas??
    Thanks,
    Naseer

  • Using case when statement in the select query to create physical table

    Hello,
    I have a requirement where in I have to execute a case when statement with a session variable while creating a physical table using a select query. let me explain with an example.
    I have a physical table based on a select table with one column.
    SELECT 'VALUEOF(NQ_SESSION.NAME_PARAMETER)' AS NAME_PARAMETER FROM DUAL. Let me call this table as the NAME_PARAMETER table.
    I also have a customer table.
    In my dashboard that has two pages, Page 1 contains a table with the customer table with column navigation to my second dashboard page.
    In my second dashboard page I created a dashboard report based on NAME_PARAMETER table and a prompt based on customer table that sets the NAME_ PARAMETER request variable.
    EXECUTION
    When i click on a particular customer, the prompt sets the variable NAME_PARAMETER and the NAME_PARAMETER table shows the appropriate customer.
    everything works as expected. YE!!
    Now i created another table called NAME_PARAMETER1 with a little modification to the earlier table. the query is as follows.
    SELECT CASE WHEN 'VALUEOF(NQ_SESSION.NAME_PARAMETER)'='Customer 1' THEN 'TEST_MART1' ELSE TEST_MART2' END AS NAME_PARAMETER
    FROM DUAL
    Now I pull in this table into the second dashboard page along with the NAME_PARAMETER table report.
    surprisingly, NAME_PARAMETER table report executes as is, but the other report based on the NAME_PARAMETER1 table fails with the following error.
    Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 16001] ODBC error state: S1000 code: 1756 message: [Oracle][ODBC][Ora]ORA-01756: quoted string not properly terminated. [nQSError: 16014] SQL statement preparation failed. (HY000)
    SQL Issued: SET VARIABLE NAME_PARAMETER='Novartis';SELECT NAME_PARAMETER.NAME_PARAMETER saw_0 FROM POC_ONE_DOT_TWO ORDER BY saw_0
    If anyone has any explanation to this error and how we can achieve the same, please help.
    Thanks.

    Hello,
    Updates :) sorry.. the error was a stupid one.. I resolved and I got stuck at my next step.
    I am creating a physical table using a select query. But I am trying to obtain the name of the table dynamically.
    Here is what I am trying to do. the select query of the physical table is as follows.
    SELECT CUSTOMER_ID AS CUSTOMER_ID, CUSTOMER_NAME AS CUSTOMER_NAME FROM 'VALUEOF(NQ_SESSION.SCHEMA_NAME)'.CUSTOMER.
    The idea behind this is to obtain the data from the same table from different schemas dynamically based on what a session variable. Please let me know if there is a way to achieve this, if not please let me know if this can be achieved in any other method in OBIEE.
    Thanks.

  • Case sensitive statement in the select-statement

    Hi All,
    i have a table in the abap-dictionary filled with names...when i try to select them with the select-statement with condition:
    table-name_column like 'some_name'
    I have encountered some problems...the inquiry is case-sensitive. What i want to do is to read the value from the abap-dictionary table uppercase or lowercase and compare it with the needed value also translated in uppercase or lowercase.
    The only idea i have is to select all values of the dictionary table into an internal table and to translate the values there in uppercase or lowercase and then to loop trough it. But this approach would cost a lot of performance.
    Do someone has an other proposal?

    check...
    Select statement
    It would be difficult , because it is based on how data is stored in the data base , now consider the scenario of the system i am using , we can material description as 'test' or 'TEST' , 'Test' .
    If in your system there are only stored in either caps or small the you can perform the select twice .
    But i myself dont find it to be such a good solution , but you can give it a try
    There is one more solution specific to material description ,and that is in the table MAKT there is a field MAKTG , which stored the description in uppercase , so for this you can first convert the description to uppercase and then perform select on this field

  • How to prevent the use of wild cards in select-option

    Hello experts,
    Is it possible to prevent the use of wild cards in a select-option? If yes, how is it done please?
    I have a
    SELECT-OPTIONS: o_comp  FOR dbtab-field OBLIGATORY DEFAULT 'FI'.
    and, I want to prevent the users for giving in some thing like FI* with the wildcard bc it would lead to dump.
    I want an error message to display and prevent the users for making such entry.
    Please I need your help and I would be very grateful.
    Thanks
    Nadin

    You have to use SELECT_OPTIONS_RESTRICT to restrict input allowed. Call this FM in INITIALIZATION or SELECTION-SCREEN OUPUT sections.
    Sample :
    TYPE-POOLS: sscr.
    INITIALIZATION.
    * Restrict SELECT-OPTIONS
      PERFORM restrict_select.
    FORM restrict_select.
      DATA: restrict TYPE sscr_restrict,
            opt_list TYPE sscr_opt_list,
            *** TYPE sscr_***.
    * Défine select-options modes (aka option list)
    * - ALL standard - all options allowed
      CLEAR opt_list.
      MOVE 'ALL' TO opt_list-name.
      MOVE 'X' TO: opt_list-options-bt,
                   opt_list-options-cp,
                   opt_list-options-eq,
                   opt_list-options-ge,
                   opt_list-options-gt,
                   opt_list-options-le,
                   opt_list-options-lt,
                   opt_list-options-nb,
                   opt_list-options-ne,
                   opt_list-options-np.
      APPEND opt_list TO restrict-opt_list_tab.
    * - EQU only equality allowed (list of values)
      CLEAR opt_list.
      MOVE 'EQU' TO opt_list-name.
      MOVE 'X' TO opt_list-options-eq.
      APPEND opt_list TO restrict-opt_list_tab.
    * Affect modes to parameters or block of parameters
    * ALL by default
      CLEAR ***.
      MOVE: 'A'          TO ***-kind,
            '*'          TO ***-sg_main,
            'ALL'        TO ***-op_main.
      APPEND *** TO restrict-***_tab.
    * EQU to internal material number
      CLEAR ***.
      MOVE: 'S'          TO ***-kind,
            'S-MATNR'    TO ***-name,
            'I'          TO ***-sg_main, " no exclusion
            'EQU'        TO ***-op_main. " only value list
      APPEND *** TO restrict-***_tab.
    * Call  FM
      CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'
           EXPORTING
                restriction = restrict
           EXCEPTIONS
                OTHERS      = 1.
    ENDFORM.                    " restrict_select
    In the sample, only select-options for matnr is restricted to single value list.
    For your request build a mode with all options except "pattern" ones : CP and NP.
    Regards

  • Wild card pattern selection '+' compatibilty with BWA

    Hello BWA experts,
    We have a situation in our production system where, when we enter a wild card string character in the variable selection like for example 1++6* the report does not return any result. The same when run with 16 output is obtained.
    The reason behind using '+' string as a wild card character is because we want to restrict the wild card entries only for fixed length.
    For example if in the cube we have data for a character like 12568, 12469, 12369, 1269, 1368. The report should fetch only data for 12568, 12469 & 12369 and not for 1269 & 1368.
    We use BW Accelarator for this report. I made a check while running the report without BWA and this kind of pattern selection (1++6*) works fine.
    Is it that the pattern selection with string '+' is not possible with BWA or is there any setting that needs to be maintained so that BWA returns data when pattern selection like the above is used?
    Thanks in advance for your valuable inputs.
    Regards,
    Sandeep

    Hello Sandeed,
    please check SAP Note <a href="http://service.sap.com/sap/support/notes/1340060">1340060</a>.
    Regards,
    Marc
    SAP Techology RIG

  • Case expression error with a select query in the condition

    Consider the two query below:
    1. The first one use a case expression :
    select case when 3 > (select 1 from dual)*2 then 1 else 0 end from dual
    2. The equivalent with a decode expression:
    select
    decode(sign(3-(select 1 from dual)*2),1,1,0) from dual
    The first query return an ORA-00905 error but not the second one. It seems that the arithmetic operation (select 1 from dual)*2 cause the error. The folowing query doesn't return this error:
    select case when 3 > (select 2 from dual) then 1 else 0 end from dual
    I run the test with Oracle 8.1.7.3 Enterprise Edition. Is it a known bug ?
    Thomas

    ora8174>select case when 3 > (select 1 from dual)*2 then 1 else 0 end from dual;
    select case when 3 > (select 1 from dual)*2 then 1 else 0 end from dual
    ERROR at line 1:
    ORA-00905: missing keyword
    ora8174>select case when 3 > cast((select 1 from dual)*2 as number) then 1 else 0 end from dual;
    CASEWHEN3>CAST((SELECT1FROMDUAL)*2ASNUMBER)THEN1ELSE0END
                                                           1
    1 row selected.
    ora8174>select case when 3 > to_number((select 1 from dual)*2) then 1 else 0 end from dual;
    CASEWHEN3>TO_NUMBER((SELECT1FROMDUAL)*2)THEN1ELSE0END
                                                        1
    1 row selected.
    ora8174>@connect
    Connected.
    ora9204>select case when 3 > (select 1 from dual)*2 then 1 else 0 end from dual;
    CASEWHEN3>(SELECT1FROMDUAL)*2THEN1ELSE0END
                                             1
    1 row selected.

  • Can we write select query regardless of case sensitivity?

    Hello Everyone,
    I have written one function module. And in this FM i am using one import parameter which has Data element and domain as type. In that i have checked Upper/Lower case checkbox, to retain case of the data in table. But when firing query to database i have to supply same case as it is stored in table.
    so, can i ignore the case of the parameter in select query and can i fire the query regardless of the case of the where conition??
    Thanks in Advance,
    Bhavik

    Hi Bhavik,
    You can do this without adding a column to the table.
    Just Fetch all the data in one internal table then loop that table inside that loop check whether that field contains that string or not. For this you use CP operator, that checks for string irrespective of the case. This can perform wild serach also. The following code may help you,
        SELECT * FROM /cpd/d_mp_hdr_s INTO TABLE it_mast_hdr_desc1.
        LOOP AT it_mast_hdr_desc1 INTO wa_mast_hdr_desc.
          IF wa_mast_hdr_desc-text CP lv_mp_text.
            APPEND wa_mast_hdr_desc TO it_mast_hdr_desc.
            CLEAR wa_mast_hdr_desc.
          ENDIF.
        ENDLOOP.
    Here both the internal table and the work area are of type /cpd/d_mp_hdr_s.
    Hope this helps you.
    With Regards,
    Ajeet Pratap Singh

  • Wild Card Selection in BEX

    Hi Gurus,
    I am trying to use the wild cards in Query in  the selection screen . I have created a variable of type " Selection Option ".
    Now when I execute the report it is giving a box before the input box, and when I select * from that box and executing the query, I am not getting the required results.
    From ex: when i give : G19  in input box  with * in the box before the input box  , it is displaying as "No Applicable Data Found. " , even though data is present for G197.
    Can some one explain me how to use wild cards in query.
    Thanks in advance,
    Ananya

    Check this:
    Wild cards in Select-options and Parameters
    how to enable wild search(*) on a query variable
    Note: That feature is not available in BI 7.0.
    It works only with BW 3.x queries.
    Re: Using wild card * in the selection screen
    /message/2983877#2983877 [original link is broken]
    Re: Wild Card Selection in BEX
    Hope it helps..
    Edited by: ashok saha on Mar 18, 2008 8:54 PM

  • How to add * wild card to a specific field on the selection-screen.

    Hello,
    How to add a * WIld card to a field in selection screen.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS : S_STCTS FOR G_STCTS OBLIGATORY,      "NUMBER SCHEME
                     S_AT20A FOR G_ATTR20A,    "SUBSTANCE ID
    SELECTION-SCREEN END OF BLOCK B1.
    I need to add Wild card functionality to Number scheme field S_STCTS on selection-screen.
    Any suggestions would be apprecaited..
    Regards,
    Kittu

    Hi Kittu,
    Here is one sample code:-
    select-option : s_name like kna1-name1.
    start-of-selection.
    if s_name-low = '*'.
    select * from kna1 into table it_kna1.
    elseif s_name-low = 'pat*' or s_name-low = 'pat'.
    select * from kna1 into table it_kna1 where name1 like 'Pat%'.
    endif.
    In case of wild card Select should be :-
    select * from <dbtab> where <field> like 'P%'.
    You can also use RANGES in your Code.
    E.g. RANGES: R_OBJNR FOR JEST-OBJNR
    R_OBJNR-SIGN = 'I'.
    R_OBJNR-OPTION = 'CP'.
    R_OBJNR-LOW = 'K1*'.
    R_OBJNR-HIGH = 'K2*'.
    Hope this helps.
    Thanks & Regards
    Jitendra Gujarathi

  • Wild card problems

    Hi ,
    My requirement is:
    first in the selction screen i need to enter--
    from and to values of cost centre
    imagine--  from:9999912
                   to:    9999920
    now, i need to concatenate from and to vaues like this
    from :KL + WWWW + 9999912 + *
    = KLWWWW9999912*
    to  : KL + WWWW + 9999920 + *
    =  KLWWWW9999920*
    now i need to get the records from COEP table
    by passing these values to the OBJNR field of COEP
    table.
    SELECT * from COEP into I_COEP
                    where OBJNR in between KLWWWW9999912*
                    and KLWWWW9999920*
    can any body please let me know how to code where condition
    for this wild card in select-options [where  objnr ?????????? ]
    because i need to enter multiple cost centers in the selcetion screen...........
    Thanks and Regards,
    Vasu

    Hi Kiran,
    Do it in this way.
    First create a Range
    RANGES: R_OBJNR FOR JEST-OBJNR.
    Now concatenate the text like this.
    R_OBJNR-SIGN = 'I'.
    R_OBJNR-OPTION = 'CP'.
    R_OBJNR-LOW = 'KLWWWW9999912*'.
    R_OBJNR-HIGH = 'KLWWWW9999920*'.
    APPEND R_OBJNR.
    Now execute your Select query like this.
    SELECT * from COEP into I_COEP
    where OBJNR in R_OBJNR.
    Thanks,
    Chidanand

  • Oracel Link server is case sensitive

    Hi,
    I had created a Link server for with oracle . it working fine ,only issue is table name are case sensitive.
    when i run Select * from temp , it is running directly in oracle but when i try to run this by link server it says temp table don't not exists .
    And if i Write Select * from TEMP then it works. Can any one know how to fix this issue case it very difficult to remember table name with case.

    Hi Mujahid.hassan,
    Thank you for your update. As I mentioned above the collation of an identifier depends on the level at which it is defined. The database name is sever level collation and is assigned the default collation of the instance. 
    The server collation acts as the default collation for all system databases that are installed with the instance of SQL Server, and also any newly created user databases. The server collation is specified during SQL Server installation
    If you want to change the server level collation you need to rebuild your system databases. For how to Setting and Changing the Server Collation, please follow the steps in changing the server collation section from
    here.
    Regards, Amber zhang

  • Case Sensitive problem in Select Option for wild card search

    Hi,
         Can anyone please let me know how to make the wild card search in any select-option non case-sensitive. What I mean by this is for eg. we want to find out all the POs with short text containing the word  'process', what we do we populate a range with OPTION = 'CP' and LOW = 'process' and select EKPO with short text in this range. This select is however case-sensitive and POs with short text containing 'Process' is not retrieved. But my requirement is that this should be non case-sensitive and both the POs should be in the result set.

    Hi,
    Hope this helps you
    CS:
    You can select characters in operand2 for a direct comparison by adding the escape symbol "#" before the required characters. For these characters, upper/lower case is taken into account, wildcard characters and the escape symbol itself do not receive special treatment, and trailing blanks in operands of type c are not cut off.
    Covers Pattern: True, if the content of operand1 fits the pattern in operand2. Wildcard characters can be used for forming the operand pattern, where "" represents any character string, and "+" represents any character. Upper/lower case is not taken into account. If the comparison is true, sy-fdpos contains the offset of operand2 in operand1, whereby leading wildcard characters "" in operand2 are ignored if operand2 also contains other characters. If the comparison is false, sy-fdpos contains the length of operand1.
    Regards
    Krishna

  • How to retrieve column names in a query in a case sensitive way

    Given a query, I want to extract all the column names/aliases in the query in a case-sensitive way.
    When I use dbms_sql.describe_columns() or java.sql.ResultSetMetaData classes getColumnName() or getColumnLabel()
    it returns the columns name ONLY in Upper case.
    My application needs to extract the column names in the same case as it appears in the query string.
    Is there any API to get this without parsing the SQL query string?
    Thanks
    PS: The dbms_sql.describe_columns() returns the column name in upper case.
    declare
    IS
    l_column_recs DBMS_SQL.DESC_TAB;
    l_cur NUMBER;
    l_column_count NUMBER;
    BEGIN
    l_cur := dbms_sql.open_cursor;
    dbms_sql.parse(l_cur, 'select target_type from targets', dbms_sql.NATIVE);
    dbms_sql.describe_columns(l_cur, l_column_count, l_column_recs);
    FOR i IN l_column_recs.FIRST..l_column_recs.LAST
    LOOP
    dbms_output.put_line(l_column_recs(i).col_name);
    end loop;
    end;
    /

    As far as the result set is concerned, though, the column name is in all upper case. If you query the data dictionary, you would see that the TARGET_TYPE column in the TARGETS table is stored in upper case.
    The way Oracle works is that column names that are not enclosed in double-quotes are converted to upper case in the data dictionary and elsewhere and then Oracle looks for the column name in the table definition. That is what allows Oracle to have case-insensitive identifiers unless a user specifies case-sensitive identifiers by enclosing the identifier in double quotes.
    If you changed the query to be
    SELECT target_type as "target_type"
      FROM targetsOracle should report the alias in a case sensitive fashion because you've now indicated that the alias should be treated as case sensitive.
    Justin

  • Case Sensitive Problem in the query

    Hii All
    Good Day
    I have created zperson infoobject & has lowercase letters tick marked.
    This is the navigational attribute of 0activity infoobject.
    The user wants to have the functionality of
    "The text field should be non-case sensitive so when it is used in a query to search the name can be typed in whichever case a person wants"
    How to do this? can any one suggest?
    regards
    Jana.

    Hello,
    I dont have a solution to convert the value automatic in the selection variables. but as an alternate solution: When you load data for zperson, use formula or routine to translate to upper case. Then the user can always use uppercase in the selection.
    Happy Tony

Maybe you are looking for

  • Resolve this error during installation of EBS 11i

    i faced this error when install Oracle 11i on windows XP. It Bootrstapping to temp. folder and after Bootrstapping log file show below error: plz any one can help me to resolve this mentioned issued on last two lines...... ===========================

  • Broken functionality after update (gnome, pam, glib2, systemd, etc.)

    I upgraded my system yesterday after going for a month or two without updates and a ton of authentication-related stuff broke. Here are some of the issues/symptoms I'm currently experiencing: Seeing this message in journalctl: May 22 13:13:50 deepspa

  • System Sounds Have Started Playing Through Internal Speakers

    I have a Presonus Firebox sound card through which I play all my audio. Suddenly and mysteriously, all my system sounds (email sent, email received, trash emptied, etc.) are going through my internal speakers, while all my apps remain as they were --

  • I recently bought "premiere element 10"

    Hello, my name is Gilles from France, I recently bought "premiere element 10" and I want to know if I can use my videos I reworked with "premiere element 10" for youtube monetization ? Can the material from "premiere element 10" (background, pictures

  • How can i get my songs from my ipad to my macbook?

    i just got a new macbook pro and i want to add my songs from the ipad to my mac. how do you do that