Radix Sort for Type Chars

I have a code for sorting Radix Sort of type Interger but im not sure how to modify it to sort Characters. This is my code for type Int:
import java.util.ArrayList;
import java.util.Iterator;
public class RadixSort {
    private static final int RADIX = 10;
    private ArrayList[] buckets = new ArrayList[RADIX];
    public RadixSort() {
        for( int i = 0 ; i < RADIX; i++ ) {
            buckets[i] = new ArrayList();
        clearBuckets();
    private void clearBuckets() {
        for( int i = 0 ; i < RADIX; i++ ) {
            buckets.clear();
private boolean distribute( Integer[] array, int position ) {
// build the divisor
int divisor = 1;
while( position >= 1 ) {
divisor *= RADIX;
position--;
boolean done = true;
for( int i = 0 ; i < array.length; i++ ) {
int val = (array[i].intValue()/divisor);
if ( val != 0 ) done = false;
int bin = val % RADIX;
buckets[bin].add( array[ i ] );
return done;
private void collect( Integer[] array ) {
int index = 0; // next available position in array
for( int i = 0 ; i < RADIX; i++ ) {
Iterator<Integer> it = buckets[i].iterator();
while( it.hasNext() ) {
array[ index ] = it.next();
it.remove();
index++;
// what happens if this removed?
if ( index >= array.length ) return;
public void sort( Integer[] array ) {
clearBuckets(); // is this necessary?
int position = 0;
boolean done;
do {
done = distribute( array, position );
position++;
collect( array );
} while ( !done );

As in the maximum size of a string?
Do you mean characters or actual byte size?

Similar Messages

  • Having probs with radix Sort for strings

    I am creating a method that does radix sort for string values. I think I need to know the maximum value for strings to do this, and I have no Idea what that would be

    As in the maximum size of a string?
    Do you mean characters or actual byte size?

  • Radix sort using integers

    Cany anyone help me convert my code to sort using integers and maybe using a Queue?
    Thanks in advance, I appreciate it.
    import java.util.*;
    public class RadixSort{
      String[] input;
      int maxLength;
      public RadixSort(String[] sa){
        input = sa;
        maxLength = input[0].length();
        for (int i = 1; i < input.length; ++i){
          if (input.length() > maxLength){
    maxLength = input[i].length();
    public String[] sort(){
    for (int i = maxLength -1; i > -1; --i){ //begin compare from the last char
    Arrays.sort(input, new RadixComparator(i));
    return input;
    // give two or more strings as command line args
    // ex. java RadixSort vouch wacky lover love banana ananas
    public static void main(String[] args){
    RadixSort rs = new RadixSort(args);
    String[] result = rs.sort();
    for (int i = 0; i < result.length; ++i){
    System.out.println(result[i]);
    class RadixComparator implements Comparator{
    int columnNum; //start from 0
    public RadixComparator(int col){
    columnNum = col;
    public int compare(Object o1, Object o2){
    char c1, c2;
    String s1 = (String)o1;
    String s2 = (String)o2;
    int l1 = s1.length();
    int l2 = s2.length();
    if (l1 < (columnNum + 1)){ //s1 too short
    if (l2 < (columnNum + 1)){ //both too short
    return 0;
    else{
    return -1;
    else if (l2 < (columnNum + 1)){ //s2 too short
    return 1;
    else{
    c1 = s1.charAt(columnNum);
    c2 = s2.charAt(columnNum);
    return (c1 - c2);

    sort using integersIf your integer set only contains positive numbers, you could readily use radix sort for strings for
    them. You could easily convert int[] to String[] and vice versa. If your integer set is a mix of
    positives and negatives, then you would have to run radix sort twice and concatenate the
    results. One for positives, and anothe for negatives -- the latter should be a reverse
    radix sort because -1234 is larger than -5678.

  • How to sort a column of type CHAR

    Hi,
    I have a report for which the o/p is displayed in ALV grid format.There is one column in the O/p strcuture which is "No of days".Based on certain conditions,i need to display the value for some of the days as Negative e.g. " - 45".Becasuse of this,I have declared the field for the "No of days" of the type "CHAR".
    Now when i sort(using ALV grid SORT function) the list on basis of this column,it doesnt give me the correct o/p.
    CAN anyone tell me how do i handle this?I want the list to be sorted correctly on basis of the "No of days" column.
    \[removed by moderator\]
    Edited by: Jan Stallkamp on Dec 17, 2008 6:32 PM

    Hi,
    Amit,
    Apologies for violation of rule.
    All,
    For getting the negative sign in the front of the no,i.e. "-45",i had declared as CHAR.
    Is there any way we can get the o/p in the form "-45" and not "45-" as well as use the SORT functionality?
    BR,
    SRM Tech

  • Cannot obtain an appropriate JDBC type for class char.

    The above error while deploying...The full error is below. The only datatypes used are: integer, timestamp,string, decimal and date (so no char).  Can anybody help?
    Caught exception during application deployment from SAP J2EE Engine's deploy service:
    java.rmi.RemoteException: Cannot deploy application sap.com/SAPAS12013.. Reason: Cannot obtain an appropriate JDBC type for class char. To store the field with this class in the database, the class must implement java.io.Serializable.; nested exception is: com.sap.engine.services.deploy.container.DeploymentException: <--Localization failed: ResourceBundle='com.sap.engine.services.deploy.DeployResourceBundle', ID='com.sap.engine.services.ejb.exceptions.deployment.EJBDeploymentException: Cannot obtain an appropriate JDBC type for class char. To store the field with this class in the database, the class must implement java.io.Serializable.
    at com.sap.engine.services.ejb.deploy.tools.sql.Mappings.getDefaultSqlTypeForJavaType(Mappings.java:131)
    at com.sap.engine.services.ejb.deploy.xml.CMPParser.fillCmpFieldInfo(CMPParser.java:89)
    at com.sap.engine.services.ejb.deploy.xml.CMPParser.parseCMPFields(CMPParser.java:644)
    at com.sap.engine.services.ejb.deploy.xml.CMPParser.parseFields(CMPParser.java:121)
    at com.sap.engine.services.ejb.deploy.xml.EJBJarParser.parseXml(EJBJarParser.java:173)
    at com.sap.engine.services.ejb.deploy.xml.EJBJarParser.parseXml(EJBJarParser.java:97)
    at com.sap.engine.services.ejb.deploy.DeployAdmin.parseSingleJar(DeployAdmin.java:296)
    at com.sap.engine.services.ejb.deploy.DeployAdmin.generate(DeployAdmin.java:246)
    at com.sap.engine.services.ejb.EJBAdmin.deploy(EJBAdmin.java:2118)
    at com.sap.engine.services.deploy.server.application.DeploymentTransaction.makeComponents(DeploymentTransaction.java:594)
    at com.sap.engine.services.deploy.server.application.DeployUtilTransaction.commonBegin(DeployUtilTransaction.java:379)
    at com.sap.engine.services.deploy.server.application.DeploymentTransaction.begin(DeploymentTransaction.java:296)
    at com.sap.engine.services.deploy.server.application.ApplicationTransaction.makeAllPhasesOnOneServer(ApplicationTransaction.java:290)
    at com.sap.engine.services.deploy.server.application.ApplicationTransaction.makeAllPhases(ApplicationTransaction.java:323)
    at com.sap.engine.services.deploy.server.DeployServiceImpl.makeGlobalTransaction(DeployServiceImpl.java:3033)
    at com.sap.engine.services.deploy.server.DeployServiceImpl.deploy(DeployServiceImpl.java:463)
    at com.sap.engine.services.deploy.server.DeployServiceImplp4_Skel.dispatch(DeployServiceImplp4_Skel.java:1555)
    at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:294)
    at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:183)
    at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:119)
    at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)
    at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)
    at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)
    at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)

    Hi Ashley,
    And yet, apparently you have a cmp-field with type <b>char</b> in one of your CMP entity beans. This is not supported. Please refer to the <a href="http://help.sap.com/saphelp_nw04/helpdata/en/13/dbb2b66146934a9662918755038ea1/frameset.htm">Object/Relational Mapping Rules</a> and especially to the first bullet under the table.
    Hope that helps!
    Vladimir

  • Sort-by-type for column view in open/save dialog boxes?

    Hello all,
    I've done a fairly good search both on Google and in these forums and can't seem to find this question addressed. When I go to open or save something (in Preview, for example) I prefer to use Column View in the dialog box, since it is easy to see and navigate the folder structure. However, Column View always shows up sorted by name, even if I specified in Finder that the folder be sorted by type. Because of this, I have to scroll down and hunt for subfolders rather than having them conveniently listed at the top.
    My question is this: is there a way to get Column View to sort by type in the open/save dialog boxes? (The Command+J that works in regular Finder does nothing in these dialog boxes.)
    Thanks!

    No. Column view will only sort by name. If you wanted to put a space before each folder name, then they will sort to the top. Sorting by Kind will put folders above files, but it will also put anything else except files at the top. If there are only folders, however, that would put them first in the sort list.

  • How can I use jbo:InputSelect for a char type filed?

    How can I use <jbo:InputSelect for a char type filed?
    I have two tables. One is room (primary key is room(type is char)), another table is responsibility (foreign ker is room(type is char)). Both tables have same length for room column.
    There is a problem:
    If I use (in the "DataEditComponent.jsp" file)
    <jbo:InputSelect multiple="false" datasource="dsEdit" displaydatasource="roomData" displaydataitem="ROOM" displayvaluedataitem="ROOM" ></jbo:InputSelect>
    to get the room input for responsibility from combobox(Datasource roomData is from room table). In the form the room field cannot bind the data in combobox, alway select the first item. And if I select one item and click the update button.There is an error message:
    Error Message: JBO-27010: Attribute set with value H409 for Room in Responsibility has invalid precision/scale
    I found If I changed the field type from char to varchar2 in database also change the entity objects, it works well. I wonder if there are any diffrence using <jbo:InputSelect tag in char and varchar2 type. How can I use <jbo:InputSelect for a char type filed as i don't want to change my datatype in database at this stage.
    I try this in JDeveloper 9.03, 9.034, 9.04. The result is the same.

    If I were in your shoes, here's how I would do it:
    <%-- Assuming you have dsRoom and dsResponsibility --%>
    <%-- Select is an HTML tag --%>
    <select name="ROOM" size="1">
    <% char roomID =""; // Init your character var
    // Open a rowsetIterator to get the records and add them to the LOV
    <jbo:RowsetIterate datasource="dsResponsibility" changecurrentrow="true" >
    <% roomID = (char)dsResponsibility.getRowSet().getCurrentRow().getAttribute("ROOM"); // Grab the char value
    // add the value to the LOV
    %>
    <option value="<%=roomID%>"><%=roomID%></option>
    </jbo:RowsetIterate>
    </select>
    If you are using this as part of an edit page you may want to utilize the "selected" option of the <option> tag. In one instance I am doing this on an edit page because the use may open an existing record. If I don't account for it, then it will change the DB to contain the first value from the list! You can do a simple check like:
    //Set the current record's char
    char curRecord = (char)rowEdit.getAttribute("ROOM");
    // inside the iterate:
    if (curRecord == roomID) {
    <option value="<%=roomID%>" selected><%=roomID%></option>
    } else {
    <option value="<%=roomID%>" ><%=roomID%></option>
    Hope that helps!

  • Can't we use Binary SEARCH  for TYPE SORTED TABLE?(Performance Improvement)

    Hi Expert!
                       I have declare a sorted type table with NON -UNIQUE, and want to use Binary search in read statement. But while  using bunary search in read statement I'm facing an error. The ERROR is
    "Table LI_MARC is a SORTED TABLE or INDEX TABLE. The BINARY SEARCH
    addition is only allowed for these tables if the key specified is an
    initial part of the table key."
    Please find detail
    TYES: tt_marc  TYPE SORTED TABLE OF marc   WITH NON-UNIQUE KEY matnr,werks.
    DATA: li_marc type tt_marc.
    READ TABLE li_marc INTO marc WITH KEY matnr = i_mbew-matnr     
                                                                          werks = i_mbew-bwkey BINARY SEARCH . 
    To my understanding , there is no need to mention Bianry Search  for sorted table TYPE. Please  let me know can  i use ?

    Hello,
    there is no need to mention Bianry Search for sorted table TYPE.
    Yes, this is because for SORTED TABLEs binary search algorithm is used by default for READ TABLE. Although you can use BINARY SEARCH addition but it's use is redundant.
    As for your case you've defined the KEY fields incorrectly There shouldn't be any "comma(s)" between the fields.
    TYPES: tt_marc TYPE SORTED TABLE OF marc WITH NON-UNIQUE KEY matnr werks.
    When you define it with commas
    TYPES: tt_marc TYPE SORTED TABLE OF marc WITH NON-UNIQUE KEY matnr, werks.
    the result is something like this:
    TYPES: tt_marc TYPE SORTED TABLE OF marc WITH NON-UNIQUE KEY matnr.
    TYPES: werks.
    Hence you were getting the syntax error!
    BR,
    Suhas
    PS: As for MARC you can use UNIQUE KEY addition because MATNR & WERKS are the key fields in the table.

  • Wrong XML OraDbType code for database column type CHAR

    Hi there!
    I have a strange issue with the XML retrieved from an Oracle DB. I'm using OraDB11g and my problem is described next:
    When I create a table with a CHAR type columns and get the XML from a query the returns a cursor with the table rows, I get the supposed right OraDbType code 104:
    Table creation:
    create table AA_Table1
    ID number(2,0) not null,
    ColumnA         char(1)                    null,
    ColumnB         char(1)   default 'S'   not null,
    constraint PK_AA_Table1
    primary key ( ID )
    tablespace "X"
    storage
    compress for all operations
    and the returned XML:
    <?xml version="1.0" encoding="utf-16"?>
    <xs:schema id="o_ListaTable" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop">
    <xs:element name="o_ListTable" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
    <xs:complexType>
    <xs:choice minOccurs="0" maxOccurs="unbounded">
    <xs:element name="o_List" msprop:REFCursorName="REFCursor">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="ID" msprop:OraDbType="111" type="xs:short" minOccurs="0" />
    *<xs:element name="COLUMNA" msprop:OraDbType="104" type="xs:string" minOccurs="0" />*
    *<xs:element name="COLUMNB" msprop:OraDbType="104" type="xs:string" minOccurs="0" />*
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:choice>
    </xs:complexType>
    </xs:element>
    </xs:schema>
    BUT...when I insert another column on the table, changing it, after that, I get a wrong OraDBType code on the returned XML for the new added column...
    Added new column:
    alter table AA_Table1 add ColumnC char(1) default 'S' not null;
    The returned XML is:
    <?xml version="1.0" encoding="utf-16"?>
    <xs:schema id="o_ListaTable" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop">
    <xs:element name="o_ListTable" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
    <xs:complexType>
    <xs:choice minOccurs="0" maxOccurs="unbounded">
    <xs:element name="o_List" msprop:REFCursorName="REFCursor">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="ID" msprop:OraDbType="111" type="xs:short" minOccurs="0" />
    <xs:element name="COLUMNA" msprop:OraDbType="104" type="xs:string" minOccurs="0" />
    <xs:element name="COLUMNB" msprop:OraDbType="104" type="xs:string" minOccurs="0" />
    *<xs:element name="COLUMNC" msprop:OraDbType="126" type="xs:string" minOccurs="0" />*
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:choice>
    </xs:complexType>
    </xs:element>
    </xs:schema>
    My question is: why is this OraDbType code different? Check that the same column type CHAR(1) NOT NULL DEFAULT 'S' is created on table create and the OraDbType is ok, so I think this can be a bug...Because of this, I cannot do a right XML parser to convert CHAR(1) columns in other type I want, in this case, to convert it to .Net bool type. My parser now is ignoring the OraDbType code 126, because this is also the code used for nvarchar2, and I won't convert nvarchar2 to bool.
    How can I solve this problem?
    Some additional tests I've done:
    Have also inserted new columns nullable/not nullable and with default value:
    alter table AA_Table1 add ColumnD char(1);
    alter table AA_Table1 add ColumnE char(1) not null;
    alter table AA_Table1 add ColumnF char(1) default 'S';
    And the returned XML was:
    <?xml version="1.0" encoding="utf-16"?>
    <xs:schema id="o_ListTable" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop">
    <xs:element name="o_ListTable" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
    <xs:complexType>
    <xs:choice minOccurs="0" maxOccurs="unbounded">
    <xs:element name="o_Lista" msprop:REFCursorName="REFCursor">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="COLUMNA" msprop:OraDbType="104" type="xs:string" minOccurs="0" />
    <xs:element name="COLUMNB" msprop:OraDbType="104" type="xs:string" minOccurs="0" />
    <xs:element name="COLUMNC" msprop:OraDbType="126" type="xs:string" minOccurs="0" />
    *<xs:element name="COLUMND" msprop:OraDbType="104" type="xs:string" minOccurs="0" />*
    *<xs:element name="COLUMNE" msprop:OraDbType="104" type="xs:string" minOccurs="0" />*
    *<xs:element name="COLUMNF" msprop:OraDbType="104" type="xs:string" minOccurs="0" />*
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:choice>
    </xs:complexType>
    </xs:element>
    </xs:schema>
    All OraDbTypes are right, except that one for the column not null and with default value. Any solution for this issue?
    If I change the type of the column that returns the wrong code (ColumnC) to CHAR(1) null default 'S' and then change it again to the original type CHAR(1) not null default 'S', I get the right ORaDbType code 104 as expcted and not the 126. This behaviour is strange - can this be an Oracle bug?
    I am using the following Oracle DLL and respective version:
    oci.dll (version 11.2.0.1)
    Oracle.DataAccess.dll (version 4.112.3.0)
    orannzsbb11.dll (version 11.0.0.1)
    oraocci11.dll (version 11.2.0.3)
    OraOps11w.dll (version 2.112.3.0)
    Edited by: 929091 on 23/Abr/2012 2:44

    Have you tried using minOccurs="1" ? Since the column is not null, it is guaranteed 1 value, correct?

  • List of characters not supported for a field search of type char

    Hi,
    I have a field of type char.
    When we create entries for that field in a table we use special characters like &, etc. When searched it is not supported and not displayed in results.
    I suppose it might be because SAP can support for characters of specific ASCII codes.
    If you have any list of the ASCII codes supported in search, kindly let me know.
    Thanks and Regards,
    Jaisish

    Hi Jaisish,
    as far as I know, there are two "special" characters that act as jokers in a field search
    +: standing for one character
    *: standing for zero or more characters
    You can search for these characters into the content of a field, if you "escape" them. The symbol for escaping is "#" (before the special character + or *).
    For example, if you search for "#*", this will search all entries with an asterisk in its content.
    I hope this helps. Kind regards,
    Alvaro

  • Operand data type char is invalid for sum operator

    can someone help me re-writing the following so I wont keep getting thie baopv ementioned error: here is the statement:
    RIGHT('0000000000'+REPLACE(CAST(SUM(PAID_AMT) AS VARCHAR),'.',''),14) AS TOT_NET_PAID
    +
    RIGHT('0000000000'+REPLACE(CAST(SUM(PAID_AMT)
    AS
    VARCHAR),'.',''),14)
    AS TOT_NET_PAID
    It keeps retuning he following error messages:
    Operand data type char is invalid for sum operator

    As Jingyang said, you cannot sum a non numeric field. Cast it to a numeric first (INT maybe?)
    + RIGHT('0000000000'+REPLACE(CAST(SUM(CAST(PAID_AMT AS INT)) AS VARCHAR),'.',''),14) AS TOT_NET_PAID
    Don't forget to mark helpful posts, and answers. It helps others to find relevant posts to the same question.

  • Add a Hyper link sort of on char

    Hello
    Is there a way where we can enter a hyper link sort of type against a char which will contain the information about that chart. Like what i mean is that if a free char is dragged and dropped in and the user wants to know what is this free char about then can a hyper link or something be added against the char so that the user can get information regarding that char.
    Please let me know
    thanks

    Hello,
    This question was asked nearly two years ago! Like the original questioner, I have searched and searched for instruction for hyperlinking an image in mail.app. When I select the image in the body of an email and go to the edit menu to add a hyperlink, the link simply replaces the photo. When I cntrl/click on the image, there is no option to add or edit a link.
    Can someone assist? Or confirm that this simple task is not possible in mail.app? Or suggest a plug in?
    thanks!

  • What are the different values available for type attribute

    Hi,
        I am working with IDOC to Stored Procedure. For each field we need to give the values for 'isInput' and 'type' attributes. I need to pass values for 'datetime' and 'numeric' fields. What are the list of values availabIe for 'type' attribute. I know only about 'CHAR' attribute.
         Can anybody please tell me what all the values availabe for attribute 'type'. I am facing this problem while giving the value for type attribute.
    Thanks in Advance,
    Murthy.

    Does this help
    tring
        Data that contains a combination of letters, numbers, and special characters. String data types are listed below:
    CHARACTER: Fixed-length character strings. The common short name for this data type is CHAR.
    VARCHAR: Varying-length character strings.
    CLOB: Varying-length character large object strings, typically used when a character string might exceed the limits of the VARCHAR data type.
    GRAPHIC: Fixed-length graphic strings that contain double-byte characters.
    VARGRAPHIC: Varying-length graphic strings that contain double-byte characters.
    DBCLOB: Varying-length strings of double-byte characters in a large object.
    |BINARY: A sequence of bytes that is not associated with a |code page.
    |VARBINARY: Varying-length binary strings.
    BLOB: Varying-length binary strings in a large object.
    |XML: Varying-length string that is an internal representation |of XML.
    Numeric
        Data that contains digits. Numeric data types are listed below:
    SMALLINT: for small integers.
    |INTEGER: for large integers.
    |BIGINT: for bigger values.
    DECIMAL(p,s) or NUMERIC(p,s), where p is precision and s is scale: for packed decimal numbers with precision p and scale s. Precision is the total number of digits, and scale is the number of digits to the right of the decimal point.
    |DECFLOAT: for decimal floating-point numbers.
    REAL: for single-precision floating-point numbers.
    DOUBLE: for double-precision floating-point numbers.
    Datetime
        Data values that represent dates, times, or timestamps. Datetime data types are listed below:
    DATE: Dates with a three-part value that represents a year, month, and day.
    TIME: Times with a three-part value that represents a time of day in hours, minutes, and seconds.
    TIMESTAMP: Timestamps with a seven-part value that represents a date and time by year, month, day, hour, minute, second, and microsecond.
    Regards
    Ravi

  • How to disable sorting for some columns in a ALV GRID?

    Hi i have requirement where I have to disable sorting for some columns in a ALV GRID. i am using REUSE_ALV_GRID_DISPLAY function module.
    Can anybody help me. how to acieve this? Any code snippets will really be appreciated.

    Hi,
    I have tried this but not completely successful. I think this can be done using the OOPS method.
      DATA: it_event_exit TYPE  slis_t_event_exit.
      DATA: w_exit TYPE slis_event_exit.
      w_exit-ucomm = '&ODN'.
      w_exit-before = 'X'.
      CLEAR w_exit-after.
      APPEND w_exit TO it_event_exit.
      w_exit-ucomm = '&OUP'.
      w_exit-before = 'X'.
      CLEAR w_exit-after.
      APPEND w_exit TO it_event_exit.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program          = w_repid
          i_callback_top_of_page      = 'ALV_TOP_OF_PAGE'
          i_callback_html_top_of_page = 'ALV_HTML_TOP_OF_PAGE'
          i_callback_user_command     = 'USER_COMMAND'  <- User command form
          is_layout                   = wm_layout
          it_fieldcat                 = wt_fieldcat
          it_events                   = i_events
          it_event_exit               = it_event_exit    <- Need to fill
          it_sort                     = wt_sort
          i_default                   = 'X'
    Now you can capture this events in the user command
    FORM user_command  USING r_ucomm LIKE sy-ucomm
                             rs_selfield TYPE slis_selfield.
      IF r_ucomm = '&OUP' and rs_selfield-SEL_TAB_FIELD = 'Your field name'.
      ENDIF.
    ENDFORM.                    "user_command
    In this form you will get the function code in 'r_ucomm' and the field selected for sorting in 'rs_selfield-SEL_TAB_FIELD'. But reseting 'r_ucomm' will not work.
    May be somebody else can give some help on this.
    But this will work if you follow the oop method.
    Please see this document for more info.
    http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/an easy reference for alv grid control.pdf
    Thanks
    Vinod

  • Popup Menu(F1- Help values) is not diaplying for a char at selection screen

    Hi,
    After executed the query, we are trying to get help (F4) values for info object Employee Group (EMPLGROUP) in the selection screen but it is taking long time nearly 1 hr and getting timed out. And for other Chars we are getting the help popup menu.
    for your info...     
    There are only 6 values are there in Employee Group master data table.
    And the characteristic settings in Business Explorer tab are as the following,
    Display u2013 Text
    Text type u2013 Default
    BEx description u2013 Short description
    Selection u2013 No selection Restriction
    Query Def. Filter Value Selection u2013 Only values in Infoprovider
    Query Execution Filter Val. Selection u2013 Only Posted Values for Navigation
    Can any one please suggest us which settings we needs to change to get the popup menu (help values) for Employee Group at selection screen and what is the reason for not displaying the help popup menu?.
    and can any one explain us about the setting "Query Execution Filter Val. Selection u2013 Only Posted Values for Navigation"
    Thanks & Regards,
    Raju. E

    Hi,
    I am getting the data aslo for Employee Group in the query when I drill down that char.
    But I dont know why it is taking long time and getting time out to display the popup menu for help values at selection screen.
    I think this is due to the below setting only at char level,
    Query Execution Filter Val. Selection u2013 Only Posted Values for Navigation
    and there are 3 opstions for the above seeting as below,
    1. Only values in master data
    2. Only values in Infoprovider
    3. Only Posted Values for Navigation
    Can any one help me, which opstion will solve the issue and can any one explain me what is the difference between 2 & 3
    Thanks,
    Raju. E

Maybe you are looking for

  • Help with RTF and special characters

    Hi, I'm curently working on apex 4.1 and i want to generate an .rtf file which i fill with the information coming from a form. I am doing so without any problems when it comes to normal Americam letters. I face a problem when i wan't to dynamicly cha

  • Acrobat 9 pro, Mac OS X 10.10.3, Inatlationsfehler

    Nach der NEU Installation von Yosemite 10.10.3 läuft die Installation von Acrobat 9 pro nur, wenn man das ADOBE PDF Viewer Safari-Plug-In nicht aktiviert (sonst bleibt die Installation stehen). Beim Update der Version 9.3.2 auf 9.5.5 erscheint ein Fe

  • Missing Fonts in my inDesign file...

    Just recently completed an inDesign file, but it is telling me it has missing fonts.  The file was originally started in CS4 by a coworker and completed by me in CS5.  I'm confused because the fonts show up in the file, but still are classified as mi

  • How to install SSD on Mac pro as boot disc

    Currently using two WD 500GB HDs, one cloned by Super Duper. I'm replacing these with two Hitachi 1TB (6 Gb/s) and would like to add an SSD for a boot up and app disk. Please help with advice on how to mechanically install the SSD (E.g., is an adapte

  • Looking for and SQL query to match CTI OS agent login ID with the Directory Number (instrument)

    Hi All, I am looking for an SQL query to request the HDS database to find out which Directory Number / instrument  was associated with a specific CTI OS agent login ID. Has anyone done such a query before ? Thanks and Regards Nick