Sort Itab - Ignoring Case

Hi,
I need to sort an Internal Table by name field by ignoring the CASE.
One way is: Convert the Name into Upper or Lower case and do the sorting.
However, is there any other way we could handle this?  Do we have SORT which can ignore the case?
Thanks for the reply.
Thanks,
Sandeep

Hi Sandeep,
I think that is the way to do that. Make that as either upper /lower case and do sorting. Normally when we sort upper case will come first & lower case will come next.
refer this thread:
http://scn.sap.com/thread/1309978
Regards,
Poornima

Similar Messages

  • Ignoring case.................

    Hello Experts ,
            I am trybin to read data from infotype table pa0002  . I am accepting  the Last name ( vorna ) as input .
    I am trying to fetch matching records in internal table USING SELECT QUERY .
    But the name (vorna ) is *case sensitive* so  in table name can be stored as
    Rahul
    RAHUL
    rahul
    If user input is RahuL . Query return zero number MATCHING  of records .
    My requirement is Query should return all three matching records .
    How can i  do the comparison of name to retrive all matching records IGNORING THE CASE .
    i tried following query
    SELECT PERNR VORNA NACHN GBDAT FROM PA0002
        INTO CORRESPONDING FIELDS OF TABLE ITAB
        WHERE upper( VORNA )   = upper(  STRU_USERIP-VORNA )
        AND   ENDDA >= SY-DATUM
        AND   BEGDA <= SY-DATUM .
    But wont work since UPPER is not allowed ,
    can anyone provide solution to this problem .
    Your Help will be appericiated .
    thks ,
    Rushi

    hi,
    There are few ways to ignore case while selecting values :
    1. Have all the records in either Capitals or Small Letters in DataBase Table.
    2. Have one extra column with either Capitals or Small Letters to do search.
    3. Declare Range Tables.
    An Example of Ranges :
    a. Range declared for which search criteria is there.
    Data : lr_name TYPE RANGE OF fmfint-bezeich,
              lr_name_line LIKE LINE OF lr_name.
    Data lt_rfc type table of fmfint,
            wa_rfc type fmfint,
            w_output type fmfint,
           t_output type table of fmfint.
    b. i_name is the value entered by user in Search Criteria.
    if i_name is not initial.
          lr_name_line-sign = 'I'.
            lr_name_line-option = 'CP'.
            lr_name_line-low = i_name.
    APPEND lr_name_line to lr_name.
    ENDIF.
    c. Select all records.
    select * from fmfint into table lt_rfc.
    d. Filter records using Loop and where condition
    loop at lt_rfc into wa_rfc where
    bezeich IN lr_name.
    MOVE-CORRESPONDING lw_rfc TO w_output.
            APPEND w_output TO t_output.
            CLEAR: w_output,lw_rfc.
    endloop.
    now finally you have all records based on input entered in table t_output.

  • Runtime error in sorted itab

    Q2]]  A runtime error occurs if you violate the sort order of a sorted table by appending to it -
    WHY?

    Hi,
    First of all you should try and understand the meaning of Append and Insert.
    Append always adds a new line to the end of the internal table.If the table is empty,then it would add it as the first line.
    Insert always inserts the row according to the sorting or if you have given any condition then accordingly.
    Modify can play the role of either the Append or Insert depending on the type of the table.
    Hence,if you try to use Append in a sorted table, it adds a new row at the end of the table and disturbs the sorting.Insert on the other hand includes the row at a place according to the sorting.
    In case you have any further clarifications,do let me know.
    Regards,
    Puneet Jhari.

  • SORT ITAB BY VARIABLE_NAME

    hi,
    i want to sort the int table with variable parameters, like VKBUR, BUDAT, VKORG, MATNR, etc.
    for that ive created a char variable of 5 length (say CRIT) and assigned value based on selection criteria by the user.
    Then, im using SORT ITAB BY CRIT. Its not getting sorted properly.
    Any suggestions,
    Regards,
    Naveen

    You can easily achieve it by using filed symbols.
    Assign the field (upon which you require sorting) to field symbol<Fs> and then sort the table with (<Fs>)reference.
    Sample code is given below for your help.
    DATA: BEGIN OF x1 OCCURS 0,
            t1 TYPE string,
            t2 TYPE string,
            t3 TYPE string,
           END OF x1.
    FIELD-SYMBOLS: <fs> TYPE ANY.
    x1-t1 = 'B'.
    x1-t2 = 'D'.
    x1-t3 = '9'.
    APPEND x1.
    x1-t1 = 'C'.
    x1-t2 = 'X'.
    x1-t3 = '4'.
    APPEND x1.
    x1-t1 = 'F'.
    x1-t2 = 'Y'.
    x1-t3 = '6'.
    APPEND x1.
    LOOP AT x1.
      WRITE: / x1-t1, '    ', x1-t2, '    ', x1-t3.
    ENDLOOP.
    SKIP 2.
    * Sort by field T1
    ASSIGN 't1' TO <fs>.
    SORT x1 BY (<fs>).
    LOOP AT x1.
      WRITE: / x1-t1, '    ', x1-t2, '    ', x1-t3.
    ENDLOOP.
    skip 2.
    * Sort by field T3
    ASSIGN 't3' TO <fs>.
    SORT x1 BY (<fs>).
    LOOP AT x1.
      WRITE: / x1-t1, '    ', x1-t2, '    ', x1-t3.
    ENDLOOP.

  • Interactive Reports filter ignoring case

    Is there a way to have the built-in interactive report filter ignore case? I am currently passing the 'LIKE' filter to my interactive report to search for employee names. I want it to ignore the case so 'SMITH' would be the same as 'Smith' when doing search.
    ie. upper(:P1_NAME) like upper(EMP.NAME)

    But I'm not capturing the time. The default format is DD-MON-RR.
    This is crazy, I have used other Adhoc tools that didn't treat dates that way.
    Seeing as the operators change depending on the data type selected by the user, the option must be controlled in the application. Oracle is excluding it for some reason, but they really need to let the administrator control that.
    This is in Interactive Reports. The users don't want to have to format the dates, or anything else. They just want to filter the data to a certain date and the = sign should be allowed. If they are capturing time, then the administrator can truncate the date and make it available via another field/column.
    Edited by: ABD -- DBA on Jan 22, 2010 11:56 AM
    Edited by: ABD -- DBA on Jan 25, 2010 8:05 AM

  • When sorting, Itunes ignores "The" of my artists names

    When sorting, Itunes ignores "The" of my artist name.
    Is it normal?
    Like "The Offsprings" is sort with my "O" artist.
    Is there a way that I tune would recognize it?

    Ok but its weird, itunes recognize The on my bros laptop and not on mine.

  • Sort  itab by using field symbol

    All,
    I have a field symbol  that pointing to a field value in work area of an internal table i_sort ( For example work area that contains the field name having a value MATNR' ( this decides only at runtime) )
    My requirement is i need to sort another table for example i_tab (structure same as records in i_sort) using this field symbol.
    Any Info?

    Hi,
    Check the below report sorting table VBAP based on field VBELN dynamically.
    Let me know if u need any clarification.
    REPORT  ZTEST1.
    tables: dd03l.
    field-symbols: <fs1> type any,
                   <fs2> type any.
    data:
       wa_1 type vbak,
       w_index type sy-index.
    data:
      itab like standard table of vbap,
      ftab like standard table of dd03l.
      select * from vbap into table itab
               up to 10 rows.
    select single * from vbak into wa_1 where vbeln ne space.
    assign wa_1-vbeln to : <fs1>,
                           <fs2>.
    do.
      assign component sy-index of structure wa_1 to <fs1>.
      if <fs1> = <fs2>.
        w_index = sy-index.
        exit.
      endif.
    enddo.
    select *
      from DD03L
      into table ftab
    where TABNAME eq 'VBAK'.
    sort ftab by position.
    read table ftab with key position = w_index into dd03l.
    sort itab by (dd03l-FIELDNAME).
    Thanks,
    - Ram

  • Sort itab by select-options

    Hi,
    i have this code:
    SELECT-OPTIONS:   S_MATNR   FOR MARA-MATNR.
      SELECT  * FROM MARA WHERE MATNR IN S_MATNR.
        CLEAR: WA_ITAB.
        WA_ITAB-MATNR = MARA-MATNR.
        WA_ITAB-MTART = MARA-MTART.
        WA_ITAB-MATKL = MARA-MATKL.
        APPEND WA_ITAB TO IT_ITAB.
      ENDSELECT.
    now i want to sort the it_itab by the given select-options. Is this possible?
    ( select-options can have single valuse, ranges, meta characters)
    Or is it possible to use select from table mara in order by select-options?
    Regards, Dieter

    Hi,
    First of all please avoid such a select statement. It causes a lot of performance problem.
    Code like this
    SELECT  *  FROM MARA
    INTO CORRESPONDING FIELDS OF TABLE IT_ITAB
    WHERE MATNR IN S_MATNR.
    Secondly what do you mean by SORT ITAB by SELECT_OPTIONS S_MATNR.
    You yourself have said that the select-option can contain single values or multiple values or ranges.
    So how should the SORT be?
    Kinldy check with the requirment. It seems a little weird.
    Regards,
    Ankur Parab

  • UI Designer, DataModel-View, Element-Search-Filter should ignore case

    Hi,
    I'm currently working within UI Designer and want to bind elements to my OWL.
    After selecting a name space and a BO afterwards, I want to search within the loaded BO meta data.
    Doing so, I figured out that the search is case sensitive.
    In other words, search for 'node' brings no results, but 'Node' does the job.
    Hopefully there are no derivations like 'nOde'
    @DevTeam, please do 'ignore case'.
    Thanks.
    ByD Studio release as of 05.March.2011
    Regards
    Martin

    Hi,
    I tested in 3.0, there the search is no longer case sensitive. So it seems to be corrected.
    Regards,
    Thomas

  • Ways of building sort itabs

    eg. is this way of doing correct for building sorted table?
    will this lose the binary properties for quick access?
    sort standard_itab by a b c.
    sorteditab[] = standard_itab[]
    or should it be this way? using insert?
    loop at standard_itab into wa.
      insert wa into sorteditab.
    endloop.

    Hi Charles,
    This link: http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb34d0358411d1829f0000e829fbfe/content.htm
    soesn't specify anything about the type of tables when assigning.
    So, your first code looks ok.
    This code works fine for me:
    REPORT ZTEST.
    DATA: ftab TYPE SORTED TABLE OF f
               WITH NON-UNIQUE KEY table_line,
          itab TYPE standard TABLE OF i ,
          fl   TYPE f.
      DO 3 TIMES.
      INSERT sy-index INTO TABLE itab.
      ENDDO.
    sort itab.
    LOOP AT itab INTO fl.
      WRITE: / fl.
    ENDLOOP.
    ftab[] = itab[].
    LOOP AT ftab INTO fl.
      WRITE: / fl.
    ENDLOOP.
    Regards,
    Ravi
    Message was edited by:
            Ravi Kanth Talagana

  • Sort itab stable

    Hi,
    can you please  explain me diffrence between Sort itab stable and sort itab using simple example.
    Regards,
    Suresh.

    1  3
    2  2
    1  3
    1  2
    2  3
    SORT ITAB STABLE always gives the output same
    1  2
    1  3
    1  3
    2  2
    2  3
    but SORT ITAB gives
    1  2
    1  3
    1  3
    2  2
    2  3
    or
    1  3
    1  3
    1  2
    2  2
    2  3
    or
    1  3
    1  2
    1  3
    2  3
    2  2

  • TableFileterDemo - ignore case

    I have implemented the code from the java tutorials "TableFilterDemo" into some of my code and have it working. I was trying to tweak it a bit to have it ignore the case when you enter text to filter for. I took a look at the String class and the equalsIgnoreCase but I'm not comparing it in this case. I also went the route of pattern:
    final int flags = Pattern.CANON_EQ | Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE;
    pattern = Pattern.compile(filterText, flags);but that broke it where it would not filter anything. Any ideas on what I might be missing?
    package tablefilter;
    * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
    *   - Redistributions of source code must retain the above copyright
    *     notice, this list of conditions and the following disclaimer.
    *   - Redistributions in binary form must reproduce the above copyright
    *     notice, this list of conditions and the following disclaimer in the
    *     documentation and/or other materials provided with the distribution.
    *   - Neither the name of Oracle or the names of its
    *     contributors may be used to endorse or promote products derived
    *     from this software without specific prior written permission.
    * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
    * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
    * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
    * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
    * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
    * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    * TableFilterDemo.java requires SpringUtilities.java
    import javax.swing.*;
    public class TableFilterDemo extends JPanel {
        private boolean DEBUG = false;
        private JTable table;
        private JTextField filterText;
        private JTextField statusText;
        private TableRowSorter<MyTableModel> sorter;
        public TableFilterDemo() {
            super();
            setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
            //Create a table with a sorter.
            MyTableModel model = new MyTableModel();
            sorter = new TableRowSorter<MyTableModel>(model);
            table = new JTable(model);
            table.setRowSorter(sorter);
            table.setPreferredScrollableViewportSize(new Dimension(500, 70));
            table.setFillsViewportHeight(true);
            //For the purposes of this example, better to have a single
            //selection.
            table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
            //When selection changes, provide user with row numbers for
            //both view and model.
            table.getSelectionModel().addListSelectionListener(
                    new ListSelectionListener() {
                        public void valueChanged(ListSelectionEvent event) {
                            int viewRow = table.getSelectedRow();
                            if (viewRow < 0) {
                                //Selection got filtered away.
                                statusText.setText("");
                            } else {
                                int modelRow =
                                    table.convertRowIndexToModel(viewRow);
                                statusText.setText(
                                    String.format("Selected Row in view: %d. " +
                                        "Selected Row in model: %d.",
                                        viewRow, modelRow));
            //Create the scroll pane and add the table to it.
            JScrollPane scrollPane = new JScrollPane(table);
            //Add the scroll pane to this panel.
            add(scrollPane);
            //Create a separate form for filterText and statusText
            JPanel form = new JPanel(new SpringLayout());
            JLabel l1 = new JLabel("Filter Text:", SwingConstants.TRAILING);
            form.add(l1);
            filterText = new JTextField();
            //Whenever filterText changes, invoke newFilter.
            filterText.getDocument().addDocumentListener(
                    new DocumentListener() {
                        public void changedUpdate(DocumentEvent e) {
                            newFilter();
                        public void insertUpdate(DocumentEvent e) {
                            newFilter();
                        public void removeUpdate(DocumentEvent e) {
                            newFilter();
            l1.setLabelFor(filterText);
            form.add(filterText);
            JLabel l2 = new JLabel("Status:", SwingConstants.TRAILING);
            form.add(l2);
            statusText = new JTextField();
            l2.setLabelFor(statusText);
            form.add(statusText);
            SpringUtilities.makeCompactGrid(form, 2, 2, 6, 6, 6, 6);
            add(form);
         * Update the row filter regular expression from the expression in
         * the text box.
        private void newFilter() {
            RowFilter<MyTableModel, Object> rf = null;
            //If current expression doesn't parse, don't update.
            try {
                rf = RowFilter.regexFilter(filterText.getText(), 0);
            } catch (java.util.regex.PatternSyntaxException e) {
                return;
            sorter.setRowFilter(rf);
        class MyTableModel extends AbstractTableModel {
            private String[] columnNames = {"First Name",
                                            "Last Name",
                                            "Sport",
                                            "# of Years",
                                            "Vegetarian"};
            private Object[][] data = {
             {"Kathy", "Smith",
              "Snowboarding", new Integer(5), new Boolean(false)},
             {"John", "Doe",
              "Rowing", new Integer(3), new Boolean(true)},
             {"Sue", "Black",
              "Knitting", new Integer(2), new Boolean(false)},
             {"Jane", "White",
              "Speed reading", new Integer(20), new Boolean(true)},
             {"Joe", "Brown",
              "Pool", new Integer(10), new Boolean(false)}
            public int getColumnCount() {
                return columnNames.length;
            public int getRowCount() {
                return data.length;
            public String getColumnName(int col) {
                return columnNames[col];
            public Object getValueAt(int row, int col) {
                return data[row][col];
             * JTable uses this method to determine the default renderer/
             * editor for each cell.  If we didn't implement this method,
             * then the last column would contain text ("true"/"false"),
             * rather than a check box.
            public Class getColumnClass(int c) {
                return getValueAt(0, c).getClass();
             * Don't need to implement this method unless your table's
             * editable.
            public boolean isCellEditable(int row, int col) {
                //Note that the data/cell address is constant,
                //no matter where the cell appears onscreen.
                if (col < 2) {
                    return false;
                } else {
                    return true;
             * Don't need to implement this method unless your table's
             * data can change.
            public void setValueAt(Object value, int row, int col) {
                if (DEBUG) {
                    System.out.println("Setting value at " + row + "," + col
                                       + " to " + value
                                       + " (an instance of "
                                       + value.getClass() + ")");
                data[row][col] = value;
                fireTableCellUpdated(row, col);
                if (DEBUG) {
                    System.out.println("New value of data:");
                    printDebugData();
            private void printDebugData() {
                int numRows = getRowCount();
                int numCols = getColumnCount();
                for (int i=0; i < numRows; i++) {
                    System.out.print("    row " + i + ":");
                    for (int j=0; j < numCols; j++) {
                        System.out.print("  " + data[i][j]);
                    System.out.println();
                System.out.println("--------------------------");
         * Create the GUI and show it.  For thread safety,
         * this method should be invoked from the
         * event-dispatching thread.
        private static void createAndShowGUI() {
            //Create and set up the window.
            JFrame frame = new JFrame("TableFilterDemo");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            //Create and set up the content pane.
            TableFilterDemo newContentPane = new TableFilterDemo();
            newContentPane.setOpaque(true); //content panes must be opaque
            frame.setContentPane(newContentPane);
            //Display the window.
            frame.pack();
            frame.setVisible(true);
        public static void main(String[] args) {
            //Schedule a job for the event-dispatching thread:
            //creating and showing this application's GUI.
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createAndShowGUI();
    }

    sorter.setRowFilter(RowFilter.regexFilter("(?i)" + text));, works for ASCII, but doesn't works correctly for Latin1-X and another Charsets for some chars near to EnterKey (on the keaboard)
    please for Swing rellated question is there Swing

  • Ignoring case in Hashtable key names

    Is there any way to check a Hashtable for a key value (which is a string) but to ignore the case of the letters in the string?
    if(hashtable.contains(keyValue)){ .... }
    returns false if the string keyValue has different capitalization from the key in the hashtable.
    Thanks
    J A

    No, if you want to do it by subclassing Hashtable (incidentally, why Hashtable rather than HashMap?) then you want to override the put, get, contains, and remove methods to call String.lowerCase() on the key. Sylvia's suggestion was to insert a wrapper around String into the map rather than to subclass the map.

  • Sort itab by another itab?

    Hi,
    i have 2 itabs: itab0 with matnr and lgpbe. itab1 with matnr matkl brgew.
    it sort itab0 by lgpbe.
    Is it possiple to sort itab1 like itab0 without having lgpbe and without changing
    the entries of itab1?
    i look for any like "sort itab1 by itab0-matnr"???
    Regards, Dieter

    HI,
      you cannot use sort statement like this..
      how ever.. just do this way.
       loop at itab0.
       loop at itab1 where matnr  = itab0=matnr.
       itab2 = itab1.
       append itab2.
       endloop.
       endloop.
    at end of this itab2 will have ur sorted data.

  • ALV sort being ignored if using a variant

    Hi,
    I'm using the class CL_GUI_ALV_GRID to display an ALV in a Custom Control. I'm calling the method SET_TABLE_FOR_FIRST_DISPLAY to populate the ALV and am specifying the sort order via the table IT_SORT.
    This works fine. However, if I also specify a layout via IS_VARIANT my sort order is ignored, along with any filter (IT_FILTER). I've checked the layout variant and no sorting is defined within it ?.
    Anyone get any ideas.
    Thanks very much in advance.
    Gary
    Message was edited by: Gary Kilby

    hi ,
    Are u populating I_SAVE with "U" and IS_VARIANT. Populate them and try.
      CALL METHOD G_GRID->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
          IS_LAYOUT            = GS_LAYOUT
          IS_VARIANT           = G_VARIANT
          IT_TOOLBAR_EXCLUDING = LT_EXCLUDE
          I_SAVE               = X_SAVE
          I_DEFAULT            = P_DEF
        CHANGING
          IT_FIELDCATALOG      = GT_FIELDCAT
          IT_OUTTAB            = I_PROD_TA[].

Maybe you are looking for

  • All-day events moving a day ahead

    I've recently (three weeks or so) started experiencing a problem whereby all-day events in iCal on my Mac appear a day earlier on my iPhone. So, for example, my sister's birthday on the 9th shows up on the 8th on the iPhone. Dates appear OK on the iP

  • Error when compiling firefox...Out of memory: Kill process 6763

    I'm trying to compile the firefox version 15 as both 16.0.1 and I always get the same error, which I think leaves me with no ram even though I have 8 gigs, i try it with 8 gigs of swap but does exactly the same, here are all the facts about this prob

  • Develop tab missing in Admin Console

    Hi, Ive tried contacting customer support twice - no response. I have a site that is not showing Develop tab. Im new to BC - however the develop tab is showing on one site ive tried. Can someone please help me? Thanks Paul

  • Spotlight hidden behind menu bar in Leopard?

    I updated to Leopard three days ago with no problems. Today, however I suddenly find my spotlight drop down box is three quarters hidden behind the menu bar and I cannot get it to appear in front of it. Weird. Does anyone have an idea what's going on

  • HP Touchpad not working at all

    I have a HP Touchpad which isn't responding at all. The screen is blank yet the button is lit up, I know it is charged from my last use. I have tried resetting it with the solutions given such as pressing and holding the home button with the power bu