Dump on reading hashed table

Hi,
I am getting a dump with 'time limit exceeded' from our existing program. The internal table was declared as follows:
DATA: it_bseg TYPE HASHED TABLE OF typ_bseg WITH
            UNIQUE KEY bukrs belnr gjahr buzei.
And is being filled as follows:
  SELECT  bukrs belnr gjahr buzei dmbtr
          kunnr mwskz shkzg koart hkont
          hwbas
  FROM bseg INTO TABLE it_bseg
    FOR ALL ENTRIES IN it_bkpf
      WHERE belnr EQ it_bkpf-belnr
        AND gjahr EQ it_bkpf-gjahr
        AND bukrs EQ it_bkpf-bukrs.
And the dump happens in the following line:
    READ TABLE it_bseg WITH TABLE KEY bukrs = wa_bseg-bukrs
                                 belnr = wa_bseg-belnr
                                 gjahr = wa_bseg-gjahr
                                 buzei = 002
               INTO wa_bseg2.
I can't seem to find the problem. Any idea will be very much welcome.

see the coding of  myin for 2  table  bseg & bkpf
TYPES: BEGIN OF t_bkpf,
*  include structure bkpf.
  bukrs LIKE bkpf-bukrs,
  belnr LIKE bkpf-belnr,
  gjahr LIKE bkpf-gjahr,
  bldat LIKE bkpf-bldat,
  monat LIKE bkpf-monat,
  budat LIKE bkpf-budat,
  xblnr LIKE bkpf-xblnr,
  awtyp LIKE bkpf-awtyp,
  awkey LIKE bkpf-awkey,
END OF t_bkpf.
DATA: it_bkpf TYPE STANDARD TABLE OF t_bkpf INITIAL SIZE 0,
      wa_bkpf TYPE t_bkpf.
TYPES: BEGIN OF t_bseg,
*include structure bseg.
  bukrs     LIKE bseg-bukrs,
  belnr     LIKE bseg-belnr,
  gjahr     LIKE bseg-gjahr,
  buzei     LIKE bseg-buzei,
  mwskz     LIKE bseg-mwskz,         "Tax code
  umsks     LIKE bseg-umsks,         "Special G/L transaction type
  prctr     LIKE bseg-prctr,         "Profit Centre
  hkont     LIKE bseg-hkont,         "G/L account
  xauto     LIKE bseg-xauto,
  koart     LIKE bseg-koart,
  dmbtr     LIKE bseg-dmbtr,
  mwart     LIKE bseg-mwart,
  hwbas     LIKE bseg-hwbas,
  aufnr     LIKE bseg-aufnr,
  projk     LIKE bseg-projk,
  shkzg     LIKE bseg-shkzg,
  kokrs     LIKE bseg-kokrs,
END OF t_bseg.
DATA: it_bseg TYPE STANDARD TABLE OF t_bseg INITIAL SIZE 0,
      wa_bseg TYPE t_bseg.
*Select FOR ALL ENTRIES command
SELECT bukrs belnr gjahr bldat monat budat xblnr awtyp awkey
  UP TO 100 ROWS
  FROM bkpf
  INTO TABLE it_bkpf.
IF sy-subrc EQ 0.
* The FOR ALL ENTRIES comand only retrieves data which matches
* entries within a particular internal table.
  SELECT bukrs belnr gjahr buzei mwskz umsks prctr hkont xauto koart
         dmbtr mwart hwbas aufnr projk shkzg kokrs
    FROM bseg
    INTO TABLE it_bseg
    FOR ALL ENTRIES IN it_bkpf
    WHERE bukrs EQ it_bkpf-bukrs AND
          belnr EQ it_bkpf-belnr AND
          gjahr EQ it_bkpf-gjahr.
ENDIF.
reward  points if it is usefull
Girish

Similar Messages

  • Short dump while reading a currency field from Flat file into internal tabl

    Hi,
    I am getting a short dump........saying number conversion dump (while reading a currency value into field in internal table from a fixed lenght flat file).........
    Do I need to use a string variable to get the value from flat file or how ??
    Please suggest.

    Santosh,
    Thanks for your inputs,
    But my internal table type is of DEC (5,2) , I am getting that... it needs to be of type 'C'. Can you suggest.
    Ex :
    MOVE wa_temp-infile_string+106(8)  TO wa_item-QT_PERCENT
    This didnt work
    so i tried moving into a seperate variable
    MOVE wa_temp-infile_string+106(8)  TO v_percent.
    and then write to
    WRITE v_percent to  wa_item-QT_PERCENT.

  • Read performance of a generically typed hashed table

    Hi,
        I'm curious to know the how the read performance of a hashed table will be affected in the following scenario. I have a class with many static attributes of hashed table type. All these hashed tables have one thing in common. They have a field "GUID" as unique key. The processing logic is same for all tables and hence I made the code generic. For example, I have an importing parameter with which I can "derive" the name of my class attribute.
    field-symbols: <fs_table> type hashed table,
                           <fs_line> type any.
    lv_class_attr = derive_name( iv_object_name ).
    assign (lv_class_Attr) to <fs_table>.
    read table <fs_table> with table key ('GUID') assigning <fs_line>.
    Will this code block give me the same performance that I would get if I use specifically typed hash tables? The code inspector gives me a low performance warning. But what will actually happen at runtime?
    Regards,
    Arun Prakash

    Hi,
    It is very simple. You defined table without unique key that why?.
    Whenever we define the typed hased table it require the unique key required. In your case it is dynamic hased table. It's don't have any unique key, While build internal hased table it require unique key defination. by in case of non-type table don't know the unique key fields.
    While reading data it will work like the standard table due to non unique key defination and It used the sequention read.

  • Hash Table -Runtime error.

    Hi,
    i am defining internal table as hash table but it is giving runtime error like bolow. some times it is executing properly or giving dump.please give me some suggestions to come out of this problem.
    Ex:
    What happened?
        Error in the ABAP Application Program
        The current ABAP program "SAPLZGIT_MED" had to be terminated because it has
        come across a statement that unfortunately cannot be executed.
    Error analysis
        An entry was to be entered into the table
         "\FUNCTION=ZBAPI_GIT_MED_HD_BOTELLAS_RPT\DATA=T_THERAPY_INFO" (which should
         have
        had a unique table key (UNIQUE KEY)).
        However, there already existed a line with an identical key.
        The insert-operation could have ocurred as a result of an INSERT- or
        MOVE command, or in conjunction with a SELECT ... INTO.
        The statement "INSERT INITIAL LINE ..." cannot be used to insert several
         initial lines into a table with a unique key.
    Code: .....................................
    TYPES: BEGIN OF X_THERAPY_INFO,
                    GIT_THERAPY_ID     TYPE ZGIT_VBELN_GIT,
                    CHO_THERAPY_ID     TYPE VBELN,
                    SERVICE_ID         TYPE MATNR,
                    SERVICE_DESC       TYPE ARKTX,
                    FLOW               TYPE ZGIT_ZFLOW,
                    DURATION           TYPE ZGIT_ZDURATION,
                    GIT_PAT_ID         TYPE ZGIT_KUNNR_GIT,
                    CHORUS_PAT_ID      TYPE KUNNR,
               END OF X_THERAPY_INFO,
    DATA:
    T_THERAPY_INFO           TYPE HASHED TABLE OF X_THERAPY_INFO WITH UNIQUE KEY        GIT_THERAPY_ID,                " Internal table for extracting the therapy Informamtion
    Extract the Therapy Details
      SELECT   VBELN_GIT
               VBELN
               MATNR
               ARKTX
               ZFLOW
               ZDURATION
               KUNNR_GIT
               KUNNR
      INTO     TABLE     T_THERAPY_INFO
      FROM     ZGIT_T_VBAK
      WHERE    KUNNR_GIT   NE SPACE
      AND      KVGR2       IN TR_KVGR2
      AND      ZDOCTOR     IN TR_DOC_SEL_ID
      AND      ZHOSPITAL   IN TR_HOSPITAL_ID
      AND    ( ZSTATUS_ID  NE C_HIDDEN
      AND      ZSTATUS_ID  NE C_DISABLED
      AND      ZSTATUS_ID  NE C_OTHERS )
      AND      VBELN       IN TR_VBELN.
      IF SY-SUBRC NE C_0.
    Thanks in advance,
    Srinivas P

    When you are using hashed tables, you cannot have duplicate records (considering it's key). So DELETE ADJACENT DUPLICATES won't solve it. It will dump before that.
    Find if you are inserting records with the same fields you inserted in the key.
    Example.
    If your key is VBELN, you cannot make it like this:
    SELECT a~vbeln b~matnr
       INTO TABLE hashed_itab
      FROM vbak AS a INNER JOIN vbap as b
       ON a~vbeln = b~vbeln
    WHERE ...
    It will dump if your vbeln has 2 lines in vbap.
    Two solutions:
    1 - expand the itab key to VBELN and POSNR (for example) or
    2
    SELECT DISTINCT a~vbeln b~matnr
       INTO TABLE hashed_itab
      FROM vbak AS a INNER JOIN vbap as b
       ON a~vbeln = b~vbeln
    WHERE ...
    Regards,
    Valter Oliveira.

  • Hashed table

    Hi,
    I've a select query which is selecting data in a hashed internal table ( gt_but100 ).
    The table key is defined as 'Partner'.
    SELECT * FROM but100 INTO TABLE gt_but100
    FOR ALL ENTRIES IN gt_blocked_bp
    WHERE partner EQ gt_blocked_bp-partner
    AND rltyp IN s_parro.
    The query works fine is there is only entry in s_parro.
    But gives a ITAB_DUPLICATE_KEY short dump when it has more then 1 value.
    How could i avoid that?
    Regards,
    Rohit.

    Hi rohit,
    1. Duplicate key
    2. define your internal table gt_but100
       like this
      (and then u won't get any error)
    3.
    <b>data : gt_but100 like  hashed table of but100
         with unique key <b>MANDT PARTNER RLTYP DFVAL</b>
           with header line.</b>
    4. Hashed tables don't take any duplicate record, 
       hence,
       we have to specify all the KEY FIELDS,
       when declaring the table.
    regards,
    amit m.

  • Hash Table copy to Text file : urgent

    HI
    I have a hash Table which cintaine id's and name pair Now i want to copy or dump this whole table into a Text file, But i do not know how to do this .
    This is very urgent for me.
    Please help me .
    Preeti

    HashTable is Serializable
    use ObjectOutputStream to write to the file and use ObjectInputStream to read from the file
    HashTable ht=new HashTable()
    ht.put("key1","value1");
    ht.put("key2","value2");
    FileOutputStream ostream = new FileOutputStream
    ("Hash.txt");
    ObjectOutputStream oos = new ObjectOutputStream(ostream);
    oos.writeObject(ht);
    oos.flush();
    oos.close();//dont forget thisuse ObjectInputStream To read HashTable from file
    use readObject() method

  • Problem using HASH TABLES

    Im trying to use hash table in a program but Im gettin an error I cant understand...
    DATA gt_kna1 TYPE HASHED TABLE OF kna1 WITH UNIQUE KEY kunnr.
    SELECT kunnr INTO TABLE gt_kna1
    FROM kna1.
    Im gettin this error:
    An entry was to be entered into the table "\PROGRAM=ZTABLA_HASH\DATA=GT_KNA1" (which should havehad a unique table key (UNIQUE KEY)).
    However, there already existed a line with an identical key.
    But this is impossible, the field kunnr is key in table kna1.
    Does Anybody know why Im gettin this dump?
    Regards

    Try this way
    TYPES: BEGIN OF TY_KUNNR,
             KUNNR  LIKE KNA1-KUNNR.
    TYPES: END   OF TY_KUNNR.
    DATA:  IT_KUNNR  TYPE  HASHED TABLE OF TY_KUNNR  WITH UNIQUE KEY KUNNR.
    SELECT KUNNR INTO TABLE IT_KUNNR
    FROM KNA1

  • 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");
    }

  • Performance problems due to sequential read on tables WBCROSSGT and CROSS

    Hello all,
    got the SAPNW2004s Sneak Preview ABAP installed. Performance is quite ok. But with certain dictionary operations like creating new attributes for a class I experience exceptional long runtimes and timeout dumps. In SM50 I see a sequential read on table WBCROSSGT. In OSS I can't find anything applicable yet for this release  (SAP_BASIS 700, support level 5).
    Any suggestions appreciated.
    Simon

    Hello,
    i had exactly the same problem after upgrading from MS SQL 2005 to MS SQl 2008 R2.
    Our DEV system was almost completely exhausted and normal operation wasn't possible anymore.
    SAP Note 1479008 solved the issue, even it is only "released" for MaxDB.
    Cheers, Christoph

  • 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.

  • 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

  • Question about comparing an array of names to a hash table

    I'm still learning Powershell but feel like I have the basics now. I have a new project I'm working on and want some input as the best way to do this:
    The Problem:
    Let's say you have a list of several hundred video game titles and the dollar value of each in a text or two column CSV file.
    The example CSV file looks likes this:
    Game, Price
    Metroid, $15.00
    The Legend of Zelda!, $12.00
    Mike Tyson's Punch-Out!, $18.00
    Super Mario Bros., $16.00
    Kung Fu, $7.00
    You have another list of just the video game titles, this most likely is just a text file with each title listed on its own line.
    The example text file looks like this:
    Kung Fu
    Metroid
    Mike Tysons Punch-Out
    Legend of Zelda
    What I think would happen in the Script:
    Use import-csv and create a hash table that will contain a key = Title and the value = the price.
    Use import-csv and create an array for the title names.
    Foreach loop through each Game Title and match the value against the Hash Table, if there's a match found, put that into another array that will later add all prices of each item and give you a total sum.
    The challenge:
    So far when I try and do one line examples of comparing names against the hash table it seems to only work with exact name matches. In the above example I've purposely made the game titles slightly different because in the real world people just write things
    differently.
    With that said, I've tried using the following single line to match things up and it only seems to work if the values match exactly.
    $hash_table.ContainsKey("Game Title")
    Is there a regex I should use to change the input of the game titles before creating the hash table or doing the compare? Is there another matching operator that is better and matching with String values that have slightly different grammar. An example would
    be the game "The Legend of Zelda". Sometimes people just put "Legend of Zelda", that's close but not exact. I think using a regex to remove extra spaces and symbols would work, but what about for matching of words or letters??
    Any ideas would be very helpful and thanks!

    There's no pat answer for this.
    You can create an array from the hash table keys:
    $hashtable = @{"The Legend of Zelda" = 15.00}
    $titles = $hashtable.getenumerator() | select -ExpandProperty Name
    And then test that using a wildcard match:
    $titles -like "*Game Title*"
    and see if it returns just one match.  If it does then use that match to do your lookup in the hash table.  If it returns 0, or more than one match then you need to check the spelling or qualify the title search some more.
    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

  • Hash Table Infrastructure ran out of memory Issue

    I am getting ORA-32690 : Hash Table Infrastructure ran out of memory error, while executing an Informatica mapping using Oracle Database ( Test Environment)
    The partition creation is as shown below.
    TABLESPACE MAIN_LARGE_DATA1
    PARTITION BY LIST (MKTCD)
    PARTITION AAM VALUES ('AAM')
    TABLESPACE MAIN_LARGE_DATA1,
    PARTITION AHT VALUES ('AHT')
    TABLESPACE MAIN_LARGE_DATA1,
    PARTITION GIM VALUES ('GIM')
    TABLESPACE MAIN_LARGE_DATA1,
    PARTITION CNS VALUES ('CNS')
    TABLESPACE MAIN_LARGE_DATA1,
    PARTITION AOBE VALUES ('AOBE')
    TABLESPACE MAIN_LARGE_DATA1,
    PARTITION DBM VALUES ('DBM')
    TABLESPACE MAIN_LARGE_DATA1
    Could you please provide me with a solution to this problem asap?

    SQL statement and execution plan? Is there a server-side trace file created for the session?
    From the brief description, it sounds like bug 6471770. See Metalink for details. The workaround for this particular bug is to either disable hash group-by, by setting +"_gby_hash_aggregation_enabled"+ to FALSE (using an ALTER SESSION statement . Or by using a NO_USE_HASH_AGGREGATION hint.
    Suggest you research this problem on Metalink (aka MyOracleSupport at https://support.oracle.com)

  • 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

  • WPF UI running in seperate runspace - able to set/get controls via synchronized hash table, but referencing the control via the hash table from within an event handler causes both runspaces to hang.

    I am trying to build a proof of concept where a WPF form is hosted in a seperate runspace and updates are handled from the primary shell/runspace. I have had some success thanks to a great article by Boe Prox, but I am having an issue I wanted to open up
    to see if anyone had a suggestion.
    My goals are as follows:
    1.) Set control properties from the primary runspace (Completed)
    2.) Get control properties from the primary runspace (Completed)
    3.) Respond to WPF form events in the UI runspace from the primary runspace (Kind of broken).
    I have the ability to read/write values to the form, but I am having difficulty with events. Specifically, I can fire and handle events, but the minute I try to reference the $SyncHash from within the event it appears to cause a blocking condition hanging both
    runspaces. As a result, I am unable to update the form based on an event being fired by a control.
    In the example below, the form is loaded and the following steps occur:
    1.) Update-Combobox is called and it populates the combobox with a list of service names and selects the first item.
    2.) update-textbox is called and sets the Text property of the textbox.
    3.) The Text value of the textbox is read by the function read-textbox and output using write-host.
    4.) An event handle is registered for the SelectionChanged event for the combobox to call the update-textbox function used earlier.
    5.) If you change the selection on the combobox, the shell and UI hangs as soon as $SyncHash is referenced. I suspect this is causing some sort of blocking condition from multiple threads trying to access the synchronized nature of the hash table, but I am
    unsure as to why / how to work around it. If you comment out the line "$SyncHash.TXT_Output.Dispatcher.Invoke("Send",[action]{$SyncHash.TXT_Output.Text = $Value})" within update-textbox the event handler will execute/complete.
    $UI_JobScript =
    try{
    Function New-Form ([XML]$XAML_Form){
    $XML_Node_Reader=(New-Object System.Xml.XmlNodeReader $XAML_Form)
    [Windows.Markup.XamlReader]::Load($XML_Node_Reader)
    try{
    Add-Type –AssemblyName PresentationFramework
    Add-Type –AssemblyName PresentationCore
    Add-Type –AssemblyName WindowsBase
    catch{
    Throw "Unable to load the requisite Windows Presentation Foundation assemblies. Please verify that the .NET Framework 3.5 Service Pack 1 or later is installed on this system."
    $Form = New-Form -XAML_Form $SyncHash.XAML_Form
    $SyncHash.Form = $Form
    $SyncHash.CMB_Services = $SyncHash.Form.FindName("CMB_Services")
    $SyncHash.TXT_Output = $SyncHash.Form.FindName("TXT_Output")
    $SyncHash.Form.ShowDialog() | Out-Null
    $SyncHash.Error = $Error
    catch{
    write-host $_.Exception.Message
    #End UI_JobScript
    #Begin Main
    add-type -AssemblyName WindowsBase
    [XML]$XAML_Form = @"
    <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Window.Resources>
    <DataTemplate x:Key="DTMPL_Name">
    <TextBlock Text="{Binding Path=Name}" />
    </DataTemplate>
    </Window.Resources>
    <DockPanel LastChildFill="True">
    <StackPanel Orientation="Horizontal" DockPanel.Dock="Top">
    <Label Name="LBL_Services" Content="Services:" />
    <ComboBox Name="CMB_Services" ItemTemplate="{StaticResource DTMPL_Name}"/>
    </StackPanel>
    <TextBox Name="TXT_Output"/>
    </DockPanel>
    </Window>
    $SyncHash = [hashtable]::Synchronized(@{})
    $SyncHash.Add("XAML_Form",$XAML_Form)
    $SyncHash.Add("InitialScript", $InitialScript)
    $Normal = [System.Windows.Threading.DispatcherPriority]::Normal
    $UI_Runspace =[RunspaceFactory]::CreateRunspace()
    $UI_Runspace.ApartmentState = [System.Threading.ApartmentState]::STA
    $UI_Runspace.ThreadOptions = [System.Management.Automation.Runspaces.PSThreadOptions]::ReuseThread
    $UI_Runspace.Open()
    $UI_Runspace.SessionStateProxy.SetVariable("SyncHash",$SyncHash)
    $UI_Pipeline = [PowerShell]::Create()
    $UI_Pipeline.Runspace=$UI_Runspace
    $UI_Pipeline.AddScript($UI_JobScript) | out-Null
    $Job = $UI_Pipeline.BeginInvoke()
    $SyncHash.ServiceList = get-service | select name, status | Sort-Object -Property Name
    Function Update-Combobox{
    write-host "`nBegin Update-Combobox [$(get-date)]"
    $SyncHash.CMB_Services.Dispatcher.Invoke($Normal,[action]{$SyncHash.CMB_Services.ItemsSource = $SyncHash.ServiceList})
    $SyncHash.CMB_Services.Dispatcher.Invoke($Normal,[action]{$SyncHash.CMB_Services.SelectedIndex = 0})
    write-host "`End Update-Combobox [$(get-date)]"
    Function Update-Textbox([string]$Value){
    write-host "`nBegin Update-Textbox [$(get-date)]"
    $SyncHash.TXT_Output.Dispatcher.Invoke("Send",[action]{$SyncHash.TXT_Output.Text = $Value})
    write-host "End Update-Textbox [$(get-date)]"
    Function Read-Textbox(){
    write-host "`nBegin Read-Textbox [$(get-date)]"
    $SyncHash.TXT_Output.Dispatcher.Invoke($Normal,[action]{$Global:Return = $SyncHash.TXT_Output.Text})
    $Global:Return
    remove-variable -Name Return -scope Global
    write-host "End Read-Textbox [$(get-date)]"
    #Give the form some time to load in the other runspace
    $MaxWaitCycles = 5
    while (($SyncHash.Form.IsInitialized -eq $Null)-and ($MaxWaitCycles -gt 0)){
    Start-Sleep -Milliseconds 200
    $MaxWaitCycles--
    Update-ComboBox
    Update-Textbox -Value $("Initial Load: $(get-date)")
    Write-Host "Value Read From Textbox: $(Read-TextBox)"
    Register-ObjectEvent -InputObject $SyncHash.CMB_Services -EventName SelectionChanged -SourceIdentifier "CMB_Services.SelectionChanged" -action {Update-Textbox -Value $("From Selection Changed Event: $(get-date)")}

    Thanks again for the responses. This may not be possible, but I thought I would throw it out there. I appreciate your help in looking into this.
    To clarify the "Respond to control events in the main runspace"... I'm would like to have an event generated by a form object in the UI runspace (ex: combo box selectionchanged event) trigger a delegate within the main runspace and have that delegate in
    the main runspace update the form in the UI runspace.
    ex:
    1.) User changes selection on combo box generating form event
    2.) Event calls delegate (which I have gotten to work)
    3.) Delegate does some basic processing (works)
    4.) Delegate attempts to update form in UI runspace (hangs)
    As to the delegates / which runspace they are running in. I see the $synchash variable if I run get-var within a delegate, but I do not see the $Form variable so I am assuming that they are in the main runspace. Do you agree with that assumption?

Maybe you are looking for