Experimenting with hashed table.

Hello experts,
I am currently experementing with using hashed table for my report and this is my first time to try this. Below is my code:
DATA: it_iloa  type hashed TABLE OF t_iloa
       WITH unique KEY iloan.
Now here is my problem, Originally I am reading it_iloa using its header line. Now, how can I define my hashed table to have a work area/header line?
Again, thanks guys and have a nice day!

Hi,
The SORTED table / HASH table are best used along with a LEY definition of the table, meaning you will declare a key for the internal table.
So, while declare the table add the WITH UNIQUE KEY column1.
This will create a HASH index on the column1 and when you are reading the table, make sure you have column1 in the where clause so that HASH index is used and the performance is improved.
However, unless the table has got huge data you will not be able to see the difference.
Regards,
Ravi

Similar Messages

  • Problem  FIELD-SYMBOL with HASHED TABLE

    Hello gurus,
    I have a problem with the following code. It is called in method MB_DOCUMENT_BEFORE_UPDATE of badi MB_DOCUMENT_BADI. I need to read the serial numbers of all items. I tried to do it with a field symbol. The information I need is stored in the hased table (SAPLMIGO)LCL_MIGO_GLOBALS=>KERNEL->PT_GOSERIAL_KERNEL. The systems returns sy-subrc = 4 after the assign. Can anyone help me? Thanks!
    TYPES: BEGIN OF ty_s_goserial,
              selected TYPE xfeld,
              serialno TYPE    gernr,
            END OF ty_s_goserial,
            ty_t_goserial  TYPE STANDARD TABLE OF ty_s_goserial WITH
                                                     NON-UNIQUE DEFAULT KEY.
      TYPES: BEGIN OF ty_s_goserial_kernel,
                global_counter TYPE migo_global_counter,
                t_goserial TYPE ty_t_goserial,
            END OF ty_s_goserial_kernel.
    types: tyt_goserial TYPE HASHED   TABLE OF ty_s_goserial_kernel
                                     WITH UNIQUE KEY global_counter.
        fs_l_serialno = '(SAPLMIGO)LCL_MIGO_GLOBALS=>KERNEL->PT_GOSERIAL_KERNEL'.
        FIELD-SYMBOLS: <fs_serialno> type tyt_goserial.
        ASSIGN (fs_l_serialno) TO <fs_serialno>.
        IF sy-subrc = 4.
          WRITE: / 'Ouch...'.
        ENDIF.

    Hi,
    Try adding body operator..at the end as it is an internal table..
    (SAPLMIGO)LCL_MIGO_GLOBALS=>KERNEL->PT_GOSERIAL_KERNEL[]'.
    Thanks
    Naren

  • Hash tables in combination with data references to the line type.

    I'm having an issue with hash tables - in combination with reference variables.
    Consider the following:  (Which is part of a class)  -  it attempts to see if a particular id exists in a table; if not add it; if yes change it.   
      types: BEGIN OF TY_MEASUREMENT,
               perfid      TYPE zgz_perf_metric_id,
               rtime       TYPE zgz_perf_runtime,
               execount    TYPE zgz_perf_execount,
               last_start  TYPE timestampl,
             END OF TY_MEASUREMENT.
    METHOD START.
      DATA:  ls_measurement TYPE REF TO ty_measurement.
      READ TABLE gt_measurements WITH TABLE KEY perfid = i_perfid reference into ls_measurement.
      if sy-subrc <> 0.
        "Didn't find it.
        create data ls_measurement.
        ls_measurement->perfid = i_perfid.
        insert ls_measurement->* into gt_measurements.
      endif.
      GET TIME STAMP FIELD ls_measurements-last_start.
      ls_measurement->execount = ls_measurement->execount + 1.
    ENDMETHOD.
    I get compile errors on the insert statement - either "You cannot use explicit index operations on tables with types HASHED TABLE" or "ANY TABLE".      It is possible that.
    If I don't dereference the type then I get the error  LS_MEASUREMENT cannot be converted to the line type of GT_MEASUREMENTS.
    I'm not looking to solve this with a combination of references and work ares - want a reference solution.   
    Thanks!
    _Ryan
    Moderator message - Moved to the correct forum
    Edited by: Rob Burbank on Apr 22, 2010 4:43 PM

    I think it might work when you change it for
    insert ls_measurement->* into TABLE gt_measurements.
    For hashed table a new line here will be inserted according to given table key.
    Regards
    Marcin

  • Question on the use of hash tables

    I have created a extract program that extract data from the bkpf and the bseg tables. I am extracting a lot of data which is needed for the auditors and depending on the selection criteria (company code and date range), this extract takes quite awhile to run. I had heard from another developer working in a different project that hash tables are used when dealing with a lot of data. I am not that familiar with hash tables and was wondering if the hash table approach would help with the processing time of my process.
    thanks in advance for the help

    this is only part of the code but this is the part when the selects and the writing of the file are. let me know if I have to post the entire program.
    FORM f_get_data .
      SELECT * INTO TABLE wt_bkpf
        FROM  bkpf
        WHERE bukrs IN s_bukrs
        AND   belnr IN s_belnr
        AND   blart IN s_blart
        AND   bldat IN s_bldat
        AND   budat IN s_budat
        AND   bstat IN s_bstat.
      IF sy-dbcnt IS INITIAL.
        MESSAGE i208(00) WITH text-001.
        STOP.
      ENDIF.
      SORT wt_bkpf BY bukrs belnr gjahr.
      SELECT mandt bukrs belnr buzei buzid bschl koart shkzg dmbtr
             wrbtr pswbt sgtxt kostl saknr hkont dmbe2
        INTO TABLE wt_bseg
        FROM  bseg
        FOR ALL ENTRIES IN wt_bkpf
        WHERE bukrs EQ wt_bkpf-bukrs
        AND   belnr EQ wt_bkpf-belnr.
    ENDFORM.                    " f_get_data
    FORM f_split_data .
      DATA wlv_index LIKE sy-tabix.
      DESCRIBE TABLE wt_bkpf LINES wv_index.
      wlv_index     = 0.
      wv_item_index = 1.
      WHILE wlv_index LT wv_index.
        ADD 1 TO wlv_index.
        CLEAR wt_bkpf.
        READ TABLE wt_bkpf INDEX wlv_index.
        IF NOT sy-subrc IS INITIAL. EXIT. ENDIF.
        LOOP AT wt_bseg FROM wv_item_index
          WHERE bukrs EQ wt_bkpf-bukrs
          AND   belnr EQ wt_bkpf-belnr.
          wv_item_index = sy-tabix + 1.
          move wt_bkpf-bukrs to ws_bseg_hold-bukrs.
          move wt_bkpf-belnr to ws_bseg_hold-belnr.
          move wt_bkpf-gjahr to ws_bseg_hold-gjahr.
          move wt_bkpf-blart to ws_bseg_hold-blart.
          move wt_bkpf-bldat to ws_bseg_hold-bldat.
          move wt_bkpf-budat to ws_bseg_hold-budat.
          move wt_bkpf-monat to ws_bseg_hold-monat.
          move wt_bkpf-cpudt to ws_bseg_hold-cpudt.
          move wt_bkpf-cputm to ws_bseg_hold-cputm.
          move wt_bkpf-usnam to ws_bseg_hold-usnam.
          move wt_bkpf-tcode to ws_bseg_hold-tcode.
          move wt_bkpf-xblnr to ws_bseg_hold-xblnr.
          move wt_bkpf-bktxt to ws_bseg_hold-bktxt.
          move wt_bkpf-waers to ws_bseg_hold-waers.
          move wt_bkpf-bstat to ws_bseg_hold-bstat.
          move wt_bkpf-ausbk to ws_bseg_hold-ausbk.
          move wt_bseg-mandt to ws_bseg_hold-mandt.
          move wt_bseg-buzei to ws_bseg_hold-buzei.
          move wt_bseg-buzid to ws_bseg_hold-buzid.
          move wt_bseg-bschl to ws_bseg_hold-bschl.
          move wt_bseg-koart to ws_bseg_hold-koart.
          move wt_bseg-shkzg to ws_bseg_hold-shkzg.
          move wt_bseg-dmbtr to ws_bseg_hold-dmbtr.
          move wt_bseg-wrbtr to ws_bseg_hold-wrbtr.
          move wt_bseg-pswbt to ws_bseg_hold-pswbt.
          move wt_bseg-sgtxt to ws_bseg_hold-sgtxt.
          move wt_bseg-kostl to ws_bseg_hold-kostl.
          move wt_bseg-saknr to ws_bseg_hold-saknr.
          move wt_bseg-hkont to ws_bseg_hold-hkont.
          move wt_bseg-dmbe2 to ws_bseg_hold-dmbe2.
          APPEND ws_bseg_hold TO wt_bseg_output.
        ENDLOOP.
      ENDWHILE.
    ENDFORM.                    " f_split_data

  • How  to Implement a Chained Hash Table with Linked Lists

    I'm making a migration from C/C++ to Java, and my task is to implement a Chained Hash Table with a Linked List. My problem is to put the strings(in this case names) hashed by the table using de Division Metod (H(k)= k mod N) in to a Linked list that is handling the colisions. My table has an interface implemented(public boolean insert(), public boolean findItem(), public void remove()). Any Help is needed. Thanks for everyone in advance.

    OK. you have your hash table. What you want it to do is keep key/value pairs in linked lists, so that when there is a collision, you add the key/value pair to the linked list rather than searching for free space on the table.
    This means that whenever you add an item, you hash it out, check to see if there is already a linked list and if not, create one and put it in that slot. Then in either case you add the key/value pair to the linked list if the key is not already on the linked list. If it is there you have to decide whether your requirements are to give an error or allow duplicate keys or just keep or modify one or the other (old/new).
    When you are searching for a key, you hash it out once again and check to see if there is a linked list at that slot. If there is one, look for the key and if it's there, return it and if not, or if there was no linked list at that slot, return an error.
    You aren't clear on whether you can simply use the provided linked-list implementations in the Java Collections or whether you have to cobble the linked list yourself. In any case, it's up to you.
    Is this what you're asking?
    Doug

  • Creating hash table with more than two columns

    Hello,
    I tried to search around and can't quite find what I'm trying to do. I know I can make a hash table like:
    $Hash = @{"Texas" = "Hot";"Alaska" = "Cold"}
    But I would like to add a third column, so for the sake of an example have the third one say travel by air and the other travel by car. What's the syntax so I can add more columns than two? Also, how can I change the column header names?

    I think you want something more like this:
    New-Object PSObject -property @{
    State="Texas"
    Temp="Hot"
    Travel="Air"
    If I set $hash to equal that:
    $hash = New-Object PSObject -property @{State="Texas";Temp="Hot";Travel="Air"}
    I get this:
    Travel                                  Temp                                    State
    Air                                     Hot                                    
    Texas
    If I have a master variable
    $hashes = @()
    I can set $hash to the new-object of relevant values each pass of a loop:
    $hash = New-Object PSObject -property @{State="Alaska";Temp="Cold";Travel="Car"}
    And add that to $hashes each time:
    $hashes += $hash
    and add to the collection:
    Travel                                  Temp                                    State
    Air                                     Hot                                    
    Texas
    Car                                     Cold                                    Alaska
    As mjolinor suggested, you really need to understand what you want to do.  I suspect you are just unfamiliar with the terms, because what you're describing is an array of values, which is better suited to a PSObject rather than to a hash table.  
    The method for populating a PSObject I describe above is just one variation of one particular method for doing so, there are others that may be more or less suitable for what you want to do.
    I hope this post has helped!
    Thank you, this is what I was looking for. I've never had to use powershell for this type of task before and did know of this process, and only could find hash tables when I poked around. This will make life much easier! 

  • Problems with a hash table

    hi, i have a CountryTable class which i want to implement as a hash table:
    import java.util.*;
    class CountryTable {
         static int count = 0;
         private HashMap table = new HashMap();
         public void addEntry(Colour key, Country country) {
              table.put(key, country);
              count++;
         public Country getCountry(Colour key) {
              return (Country)table.get(key);
         static int getCount() {
              return count;
    The object which are returned from this table is Country:
    class Country {
         //static variables
         static int count = 0;
         //instance variables
         private String name;
         private Colour base;
         //constructor
         Country(String name, Colour base) {
              this.name = name;
              this.base = base;
              count++;
         //return the number of objects created
         static int getCount() {
              return count;
         //return the name
         public String getName() {
              return name;
         public Colour getColour() {
              return base;
    The key for the has table is the class Colour, which includes a hashCode() method:
    class Colour {
         public int rgb;
         Colour(int rgb) {
              this.rgb = rgb;
         public int hashCode() {
              return rgb * -1;
    I implement these classes in a program as follows:
    CountryTable index = new CountryTable();
              Colour colour1 = new Colour(-3473408);
              Country argentina = new Country("Argentina", colour1);
              index.addEntry(colour1, argentina);
              Colour colour2 = new Colour(-131072);
              Country brazil = new Country("Brazil", colour2);
              index.addEntry(colour2, brazil);
                        Colour col = new Colour(or);
                        Country coun = index.getCountry(col);
                        System.out.println(coun.getName());
    I have a list of many countries which i set up, with their relevant countires with which they are associated.
    The variable 'or' contains an RGB value which has been returned elsewhere in the program. The problem that i have is that when a colour is passed into the getCountry() method, nothing is returned and a "nullPointerException" is thrown, even though a colour with which i set up a country was passed in???
    Anyone got any ideas where im going wrong?
    Many thanks Cath

    keeping the other two files same you change the CountryTable to this
    import java.util.*;
    class CountryTable {
    static int count = 0;
    private HashMap table = new HashMap();
    public void addEntry(Colour key, Country country) {
    table.put(key.rgb+"" ,country.getName());
    count++;
    public String getCountry(Colour key) {
    return (String)table.get(key.rgb+"");
    static int getCount() {
    return count;
    public static void main (String args[]){
         CountryTable index = new CountryTable();
    Colour colour1 = new Colour(-3473408);
    Country argentina = new Country("Argentina",colour1);
    index.addEntry(colour1, argentina);
    Colour colour2 = new Colour(-131072);
    Country brazil = new Country("Brazil",colour2);
    index.addEntry(colour2, brazil);
    System.out.println(index.table);
    String coun = index.getCountry(colour2);
    System.out.println(coun);
    }and now try

  • Operation with Hashed and Sorted Tables

    Hi,
    What are all the internal table operations are possible with sorted and Hashed table.
    Kindly let me know,

    Refer this help in case you have not done already.
    http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb35de358411d1829f0000e829fbfe/frameset.htm
    Regards,
    Ravi Kanth

  • Issue with single table hash cluster

    I'm still learning lots about html db so please do bear with me...
    I have a table that is part of a single table hash cluster. The cluster and table are created like so:
    create cluster webmon.owm_system
      db_id number(3),
      env_id number(3)
    size 171
    hashkeys 1009
    single table
    pctfree 2
    pctused 96;
    create table webmon.owm_system
      tier_id number(3) not null,
      host_id number(3) not null,
      port number(4) not null,
      sid varchar2(8) not null,
      admin_user varchar2(32) not null,
      admin_auth varchar2(48) not null,
      primary_dba_id number(3) not null,
      secondary_dba_id number(3) not null,
      primary_bac_id number(3) not null,
      secondary_bac_id number(3) not null,
      version_id number(3) not null,
      log_mode_id number(3) not null,
      db_id number(3) not null,
      env_id number(3) not null,
      admin_conn varchar2(32) null,
      constraint owm_system_pk primary key (db_id, env_id)
    cluster webmon.owm_system
      db_id,
      env_id
    );I have created a form (and report) to view and edit the data in the table. When I click the "Apply Changes" button on the form after editing data, I get an error. The SQL that is sent to the database is incorrect.
    Here is the (reformatted) incorrect SQL that is sent (captured in a database trace file):
    update
      "WEBMON"."OWM_SYSTEM"
    set
      "SECONDARY_DBA_ID" = :DML_BV0001,
      "DB_ID" = :DML_BV0002,
      "DB_ID" = :DML_BV0003,  /* This should not be here */
      "ENV_ID" = :DML_BV0004,
      "ENV_ID" = :DML_BV0005,  /* This should not be here */
      "HOST_ID" = :DML_BV0006,
      "PORT" = :DML_BV0007,
      "SID" = replace(:DML_BV0008,'%null%',null),
      "ADMIN_USER" = replace(:DML_BV0009,'%null%',null),
      "ADMIN_AUTH" = replace(:DML_BV0010,'%null%',null),
      "ADMIN_CONN" = replace(:DML_BV0011,'%null%',null),
      "VERSION_ID" = :DML_BV0012,
      "LOG_MODE_ID" = :DML_BV0013,
      "TIER_ID" = :DML_BV0014,
      "PRIMARY_DBA_ID" = :DML_BV0015,
      "PRIMARY_BAC_ID" = :DML_BV0016,
      "SECONDARY_BAC_ID" = :DML_BV0017
    where
      "DB_ID" = :p_rowid
    and
      "ENV_ID" = :p_rowid2Why are the DB_ID and ENV_ID columns in the statement twice? That is the error.
    Now, if I create the table as just a basic, non-clustered table like this:
    create table webmon.owm_system
      tier_id number(3) not null,
      host_id number(3) not null,
      port number(4) not null,
      sid varchar2(8) not null,
      admin_user varchar2(32) not null,
      admin_auth varchar2(48) not null,
      primary_dba_id number(3) not null,
      secondary_dba_id number(3) not null,
      primary_bac_id number(3) not null,
      secondary_bac_id number(3) not null,
      version_id number(3) not null,
      log_mode_id number(3) not null,
      db_id number(3) not null,
      env_id number(3) not null,
      admin_conn varchar2(32) null,
      constraint owm_system_pk primary key (db_id, env_id)
    );Everything works as expected. The (correct) SQL sent in this case is:
    update
      "WEBMON"."OWM_SYSTEM"
    set
      "SECONDARY_DBA_ID" = :DML_BV0001,
      "DB_ID" = :DML_BV0002,
      "ENV_ID" = :DML_BV0003,
      "HOST_ID" = :DML_BV0004,
      "PORT" = :DML_BV0005,
      "SID" = replace(:DML_BV0006,'%null%',null),
      "ADMIN_USER" = replace(:DML_BV0007,'%null%',null),
      "ADMIN_AUTH" = replace(:DML_BV0008,'%null%',null),
      "ADMIN_CONN" = replace(:DML_BV0009,'%null%',null),
      "VERSION_ID" = :DML_BV0010,
      "LOG_MODE_ID" = :DML_BV0011,
      "TIER_ID" = :DML_BV0012,
      "PRIMARY_DBA_ID" = :DML_BV0013,
      "PRIMARY_BAC_ID" = :DML_BV0014,
      "SECONDARY_BAC_ID" = :DML_BV0015
    where
      "DB_ID" = :p_rowid
    and
      "ENV_ID" = :p_rowid2The "real" system in question has a fairly large number of single table hash clusters. I'm leary of continuing my explorations if there is a problem with using single table hash clusters. On the other hand, I'm quite open to the idea that I've done something wrong!
    Any pointers? Is there anyway to change the SQL that is being generated when using the single table hash cluster? More information needed?
    Thanks,
    Mark

    Mark,
    Can't help with the hash table problem but as a method of dealing with it you could just make a procedure to manage the table.
    Pass the value of :REQUEST (matches value of button) in and you'll be able to modify the tables.
    procedure manage_owm_system (p_request varchar2,db_id number ...)is
    begin
    case p_request
    when 'CREATE' then
    insert
    into ....
    when 'SAVE' then
    update .....
    else
    raise_application_error(-20001,'Unkown request');
    end case;
    end;
    put that in a plsql reqion after submit
    begin
    manage_owm_system(p_request=>:REQUEST,p_dbid=>:P1_DBID .......);
    end;
    You need to create something similar , with out parameters, to populate the items when the pags loads.
    Chris

  • Implementing Hash tables with chaining.

    Hi, I'm in a Java data structures class right now and we have a program to do using hash tables. I've read about hash tables and chaining but does anyone know where i can find some examples of code that implement hash tables using chaining. It's all very confusing to me without seeing how it is used in a program.
    To give you an idea of what we're doing, the assignment is to create a word processor that looks thru a file and adds different words to the table and also counts how many of each word there is in that file. Keep in mind I'm not asking for the code to this assignment just for some example of how coding hash tables/chaining works.

    Simple and probably not complete overview:
    Suppose you have an array in which you will store objects.
    You take an object, and find a "hash code" for it. You then restrict the hash code in to the range of your array. This gives you the index where you can store your object.
    But what if another object is already present at that index?
    Different solutions to this exist - such as re-hashing. One solution is "chaining". Instead of storing the object directly at the hashed index - you store a list of objects which hashed to the same location.
    When you do a lookup, you first get your hash. You then look at the corresponding location in the array. If you find a list rather than the required object, you walk along the list until you find the object you are looking for.
    Of course, with a small array and bad hash distribution, the performance of this solution can degrade fairly quickly.
    BTW, in the real world, just use one of the ready made collections in java.util.

  • Displaying graphical representation of data in hash tables as bar chart?

    I want to be able to display results in my hash table as a bar chart i don't know how to do it could someone help me I've looked through tutorials couldn't find any information that actually helped.
    In my program it doesnt allow matching the capital and small letters
    so for instance if I already have Mike it allows for me to input mike in again so there are 2 Mikes.
    I also want to do a simple user interface the tutorial for it is not simple to understand could any one tell me how to create a simple user interface like putting a button into a place wher i want it to be.
    im not asking anyone to do it for me i just want people to show me how to do it
    thank you
    Edited by: Tek_Hedef on Dec 1, 2007 4:30 AM

    Thanks for the ideas pal but I did have a go at it but my bit of code is making it crash but i removed it now so here's what I have so far
    import java.io.*;
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    class StudentDetails extends JFrame implements ActionListener
         private JTextField StudentNameTxt, StudentMarkTxt;
        private JButton DeleteStudentDetailsBtn, DisplayAllStudentsBtn, SearchStudentBtn, FailedStudentsBtn, PassedStudentsBtn, DistinctionStudentsBtn, AddStudentDetailsBtn, ExitBtn;
        private JPanel DisplayStudentDetailsPnl;
        private JLabel StudentNameLbl, StudentMarkLbl;
        private JTextArea DisplayResultsTxt;
        private Hashtable StudentDetailsTbl;
        private String StudentName, StudentMark;
        public static void main(String[] args)
            StudentDetails frame = new StudentDetails();
             frame.setSize(600,600);
            frame.createGUI();
            frame.setVisible(true);
        public void display(JPanel DisplayStudentDetailsPnl)
            Graphics paper = DisplayStudentDetailsPnl.getGraphics();
            paper.setColor(Color.white);
            paper.fillRect(0, 0, 500, 500);
            paper.setColor(new Color((int)(Math.random()*255),(int)(Math.random()*255),(int)(Math.random()*255) ));
        private void createGUI()
            setDefaultCloseOperation(EXIT_ON_CLOSE);
            Container window = getContentPane();
            window.setLayout(new FlowLayout());
            StudentDetailsTbl = new Hashtable();
            StudentNameLbl = new JLabel("Student Name");
            window.add(StudentNameLbl);
            StudentNameTxt = new JTextField(15);
            window.add(StudentNameTxt);
            StudentMarkLbl = new JLabel("Student Mark");
            window.add(StudentMarkLbl);
            StudentMarkTxt = new JTextField(3);
            window.add(StudentMarkTxt);
            AddStudentDetailsBtn = new JButton("Add Student and Mark");
            window.add(AddStudentDetailsBtn);
            AddStudentDetailsBtn.addActionListener(this);
            DeleteStudentDetailsBtn = new JButton("Delete Student");
            window.add(DeleteStudentDetailsBtn);
            DeleteStudentDetailsBtn.addActionListener(this);
            DisplayAllStudentsBtn = new JButton("Display all Students and Marks");
            window.add(DisplayAllStudentsBtn);
            DisplayAllStudentsBtn.addActionListener(this);
            SearchStudentBtn = new JButton("Search Student");
            window.add(SearchStudentBtn);
            SearchStudentBtn.addActionListener(this);
            FailedStudentsBtn = new JButton("Students which Failed");
            window.add(FailedStudentsBtn);
            FailedStudentsBtn.addActionListener(this);
            PassedStudentsBtn = new JButton("Students which Passed");
            window.add(PassedStudentsBtn);
            PassedStudentsBtn.addActionListener(this);
            DistinctionStudentsBtn = new JButton("Students with Distinction");
            window.add(DistinctionStudentsBtn);
            DistinctionStudentsBtn.addActionListener(this);
            ExitBtn = new JButton("Exit");
            window.add(ExitBtn);
            ExitBtn.addActionListener(this);
            DisplayResultsTxt = new JTextArea();
            DisplayResultsTxt.setPreferredSize(new Dimension(200, 200));
            DisplayResultsTxt.setBackground(Color.white);
            window.add(DisplayResultsTxt);
            DisplayResultsTxt.enable(false);
        public void actionPerformed (ActionEvent e)
             if (e.getSource()== AddStudentDetailsBtn)
                  StudentName = StudentNameTxt.getText();
                   StudentMark = StudentMarkTxt.getText();
                  DisplayResultsTxt.setText("");
                  StudentDetailsTbl.put(StudentName, StudentMark);
                Enumeration enumStudentName = StudentDetailsTbl.keys();
                Enumeration enumStudentMark = StudentDetailsTbl.elements();
                String[] keys = (String[]) StudentDetailsTbl.keySet().toArray(new String[0]);       
                Arrays.sort(keys); 
                    for (String key : keys)
                         DisplayResultsTxt.append(key + " : " + StudentDetailsTbl.get(key)+ "\n");
                    StudentNameTxt.setText("");
                    StudentMarkTxt.setText("");
             if (e.getSource() == DeleteStudentDetailsBtn )
             if (StudentDetailsTbl.containsKey(StudentNameTxt.getText().trim()))
                  DisplayResultsTxt.setText("");     
                  String txt = StudentNameTxt.getText();
                Enumeration enumStudentName = StudentDetailsTbl.keys()  ;                   
                    String currentelement = (String)enumStudentName.nextElement();
                     StudentDetailsTbl.remove(txt);
                     DisplayResultsTxt.append(txt + " has been deleted");  
            if (e.getSource() == SearchStudentBtn)
            if (StudentDetailsTbl.containsKey(StudentNameTxt.getText().trim()))
                 String txt = StudentNameTxt.getText();
                 String result;
                 DisplayResultsTxt.setText("");
                 Enumeration enumStudentName = StudentDetailsTbl.keys();
                Enumeration enumStudentMark = StudentDetailsTbl.elements();
                   while (enumStudentName.hasMoreElements())
                        String currentelement = (String)enumStudentName.nextElement();
                    result = (StudentDetailsTbl.get(currentelement).toString());
                        if (txt.equals(currentelement))
                             DisplayResultsTxt.append(currentelement + " " + result);
                        else JOptionPane.showMessageDialog(null, "Student Name could not be identified");
            if (e.getSource() == DisplayAllStudentsBtn)
                  DisplayResultsTxt.setText("");
                 Enumeration enumStudentName = StudentDetailsTbl.keys();
                Enumeration enumStudentMark = StudentDetailsTbl.elements();
                while (enumStudentName.hasMoreElements())
                DisplayResultsTxt.append(enumStudentName.nextElement()+ " " + enumStudentMark.nextElement()+ "\n");
            if (e.getSource() == PassedStudentsBtn)
                 DisplayResultsTxt.setText("");
                 Enumeration enumStudentName = StudentDetailsTbl.keys();
                Enumeration enumStudentMark = StudentDetailsTbl.elements();
                while (enumStudentName.hasMoreElements())
                     int Mark = Integer.parseInt((String)enumStudentMark.nextElement());
                     String Name = (String)enumStudentName.nextElement();
                     if (Mark >=40)
                          DisplayResultsTxt.append(Name + " " + Mark + "\n");
            if (e.getSource() == FailedStudentsBtn)
                 DisplayResultsTxt.setText("");
                 Enumeration enumStudentName = StudentDetailsTbl.keys();
                Enumeration enumStudentMark = StudentDetailsTbl.elements();
                while (enumStudentName.hasMoreElements())
                     int Mark = Integer.parseInt((String)enumStudentMark.nextElement());
                     String Name = (String)enumStudentName.nextElement();
                     if (Mark <40)
                          DisplayResultsTxt.append(Name + " " + Mark + "\n");
            if (e.getSource() == DistinctionStudentsBtn)
                 DisplayResultsTxt.setText("");
                 Enumeration enumStudentName = StudentDetailsTbl.keys();
                Enumeration enumStudentMark = StudentDetailsTbl.elements();
                while (enumStudentName.hasMoreElements())
                     int Mark = Integer.parseInt((String)enumStudentMark.nextElement());
                     String Name = (String)enumStudentName.nextElement();
                     if (Mark >=75)
                          DisplayResultsTxt.append(Name + " " + Mark + "\n");
    }

  • How about use partial key to loop at a hashed table?

    Such as I want to loop a Internal table of BSID according to BKPF.
    data itab_bsid type hashed table of BSID with unique key bukrs belnr gjahr buzid.
    Loop at itab_bsid where bukrs = wa_bkpf-bukrs
                              and    belnr  = wa_bkpf-belnr
                              and    gjahr  = wa_bkpf-gjahr.
    endloop.
    I know if you use all key to access this hashed table ,it is certainly quick, and my question is when i use partial key of this internal hashed table to loop it, how about its performance.
    Another question is in this case(BSID have many many record) , Sorted table and Hashed table , Which is better in performance.

    You can't cast b/w data reference which l_tax is and object reference which l_o_tax_code is.
    osref is a generic object type and you store a reference to some object in it, right? So the question is: what kind of object you store there? Please note - this must be an object reference , not data reference .
    i.e
    "here goes some class
    class zcl_spfli definition.
    endclass.
    class zcl_spfli implementation.
    endclass.
    "here is an OBJECT REFERENCE for it, (so I refer to a class) i.e persistent object to table SPFLI
    data oref_spfli type ref to zcl_spfli.
    "but here I have a DATA REFERENCE (so I refer to some data object) i.e DDIC structure SPFLI
    data dref_spfli type ref to spfli.
    So my OSREF can hold only oref_spfli but it not intended for dref_spfli . That's why you get this syntax error. Once you have stored reference to zcl_spfli in osref then you will be able to dereference it and access this object's attributes.
    data: osref type osref.
    create object osref_spfli.
    osref = osref_spfli.
    "now osref holds reference to object, you can deference it
    oref_spfli ?= osref.
    osref_spfli->some_attribute = ....
    OSREFTAB is just a table whose line is of type OSREF (so can hold multiple object references - one in each line).
    Regards
    Marcin

  • How to get values from Hash Table

    Hi all,
    I have a hash table "lovResults" craeted with following code -
    String lovInputSourceId = pageContext.getParameter(SOURCE_PARAM);
    Hashtable lovResults = pageContext.getLovResultsFromSession(lovInputSourceId);
    values which I can see through SOP are - ******Value of lovResults is{roleid=1000, domainFV=CREATIVE, Role=Account Director}
    How can I get the domain value "domainFV=CREATIVE" from hash table in a variable because I have to set this vaue in another field.
    Please help me ASAP
    Thanks
    Amit

    Hi Amit ,
    Since you are successfully printing the values using sop's , please try this code
    Capture the value in controller .
    if(oapagecontext.getParameter("domainFV") != null)
    String formvalue= oapagecontext.getParameter("domainFV") // ensure hashtable id is correct
    Keerthi
    Edited by: keerthioaf on Nov 26, 2012 8:46 PM

  • How to use one hash table inside another hash table

    Hi everyone,
    Any example of hash table inside another hash table.
    Can one here help me how to write one hash table inside another with repeating keys for the first hash table.
    Thanks,
    kanty.

    Do you mean you want the 'value' entries in a hash table to themselves be hash tables? Easy but this often indicates a design flaw.
    Hashtable<String,<Hashtable<String,Value>> fred = new Hashtable<String,<Hashtable<String,Value>> ();But what do you mean by "with repeating keys for the first hash table"?
    Edited by: sabre150 on Jul 2, 2010 10:11 PM
    Looks like you have already handled the declaration side in your other thread. I suspect you should be writing your own beans that hold the information and these beans would then be stored in a Map. The problem I have is that your description is too vague so I can't be certain.

  • How do I use Get-ADUser to get just the Managers attribute? And then get rid of duplicates in my array/hash table?

    Hello,
          I am trying to just get the Managers of my users in Active Directory. I have gotten it down to the user and their manager, but I don't need the user. Here is my code so far:
    Get-ADUser-filter*-searchbase"OU=REDACTED,
    OU=Enterprise Users, DC=REDACTED, DC=REDACTED"-PropertiesManager|SelectName,@{N='Manager';E={(Get-ADUser$_.Manager).Name}}
    |export-csvc:\managers.csv-append 
    Also, I need to get rid of the duplicate values in my hash table. I tried playing around with -sort unique, but couldn't find a place it would work. Any help would be awesome.
    Thanks,
    Matt

    I would caution that, although it is not likely, managers can also be contact, group, or computer objects. If this is possible in your situation, use Get-ADObject in place of Get-ADUser inside the curly braces.
    Also, if you only want users that have a manager assigned, you can use -LDAPFilter "(manager=*)" in the first Get-ADUser.
    Finally, if you want all users that have been assigned the manager for at least one user, you can use:
    Get-ADUser
    -LDAPFilter "(directReports=*)" |
    Select @{N='Manager';E={ (Get-ADUser
    $_.sAMAccountName).Name }}
    -Unique | Sort Manager |
    Export-Csv .\managerList.csv -NoTypeInformation
    This works because when you assign the manager attribute of a user, this assigns the user to the directReports attribute of the manager. The directReports atttribute is multi-valued (an array in essence).
    Again, if managers can be groups or some other class of object (not likely), then use Get-ADObect throughout and identify by distinguishedName instead of sAMAccountName (since contacts don't have sAMAccountName).
    Richard Mueller - MVP Directory Services

Maybe you are looking for

  • How To user jstl in jsp 1.2?

    hai all, i can use jstl for each tag in jsp2.0 but i want to use it with weblogic 8.1 and it support servlet 2.3 and jsp 1.2 only. can any body show me how to use forEach tag in jsp 1.2. thanks in advance, Rahul

  • WHEN-NEW-ITEM-INSTANCE TRIGGER NOT FIRING IN FORM PERSONLIZATION(R12 UPGRAD

    We are upgrading to R12, when-new-item-instance trigger written for radio group not firing. using USO-821 Order Administrator Responsibility the function order capture.After clicking on actions push button opening Copy Quote for this Form Personaliza

  • How do I TRULY remove the CRLF (#) from the last field read in CSV dataset?

    Good day, everyone! PLEASE NOTE:  I spent most of yesterday searching SDN and reading all kinds of threads on this topic.  Yes, I know, there ARE other threads out there regarding this topic, but I spent all of yesterday afternoon trying every soluti

  • SQL: which is better IN or OR

    Hi, I have a query which is in the format: select * from ( select col1, col2, col3 from tab1, tab2, tab3 where tab1.col1='aa' AND tab2.col2='BBB' ... AND (tab1.col1='AA' OR tab1.col='BB' OR tab1.col='CC'... OR tab1.col='NN') ORDER BY tab1.col3 DESC )

  • Iweb wont publish picture borders wont show and mp3 in html snippet wont publish.

    Hi all, I'm new to this forum, I'm following www.iweb for musicians.com website design, Roddy the man is ace. I'm trying to publish my site with borders and flection on my first page and also a HTML snip box with a code for a mp3. It all shows up and