Strange problem in ABAP

Hello All,
We are facing a strange problem in simple abap program.
Following is the program .
PROGRAM DEMO_ELEMENTARY_DATA_OBJECTS.
DATA  NCK1(40) type c .
NCK1 =   ‘THE’.
WRITE NCK1.
When we try to check the program system throws error message stating
"Program ZNTEST Field "‘THE’" is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement."
Please let us know the cause of the problem.
Thank you.
Regards
Nimesh

Hi Nimesh,
  Please copy your code into a notpad file and check it. The single quote used in 'the' will look diffrent. Change it in the note pad and copy the code into your ABAP editor. This will sovle your problem. We are also facing the same problem from few days.
Thanks and Regards,
Bharat Kumar Reddy.V
Message was edited by: Bharat Kumar Reddy Vaka

Similar Messages

  • Strange Problem ABAP Prog.

    Hi,
    Very strange problem. I have the program below;
    When I run it , I would expect ls_business_object-Value
    to have the contents of header , but it does not, when I look at it in the debugger. It adds the element, but there is nothing in value.
    Can't really understand why. I've done this with many other programs without any problem. Thanks.
    REPORT test.           
    data:
          ls_business_object     TYPE swcont,
          lt_business_object     TYPE TABLE OF swcont,
          HEADER  type BAPISDHD1,
    HEADER-REFOBJTYPE     = ''.
    HEADER-DOC_TYPE       = 'TA'.
    HEADER-SALES_ORG      = '1000'.
    HEADER-DISTR_CHAN     = '10'.
    *l_ORDER_HEADER_IN-DIVISION       = '00'.
    HEADER-PURCH_NO_C     = '1234567'.
    HEADER-PURCH_DATE     = '20050531'.
    Pack into  swcont
    ls_business_object-element       = 'HEADER'.
    ls_business_object-Value = HEADER.
    APPEND ls_business_object TO lt_business_object.

    Hi,
    In that lt_business_object,it is having 255 char for value.
    So I suggest you to do
    concatenate
    HEADER-REFOBJTYPE
    HEADER-DOC_TYPE
    HEADER-SALES_ORG
    HEADER-DISTR_CHAN
    HEADER-PURCH_NO_C
    HEADER-PURCH_DATE
    into
    ls_business_object-Value.
    instead of
    ls_business_object-Value = HEADER.
    Then
    APPEND ls_business_object TO lt_business_object.

  • Asynchronous XI- RFC and RFC- XI scenario - strange problem

    Hello XI-Xperts,
    I've come to really strange problem, which I would like to share with you and possibly get an explanation.
    I have an asynchronous scenario with ending XI->RFC. The RFC function in R/3 has got an optional parameter called SENDER, which when is filled, the another asynchronous RFC->XI scenario should be started. (via ABAP code <i>CALL FUNCTION 'Z_XI_RETURN' DESTINATION gc_xi_destination</i> ... etc.)
    Now, the direction XI->RFC is configured properly, but the way back NO(!). Anyway I thought that it wouldn't make me a trouble, because those two scenarios are IMHO absolutelly separated. So I'd presume that the the data should come to R/3 without problem, it should be processed, and in case the parameter SENDER is filled the R/3 would establish the RFC connection and the "return data" should go back in different XI thread.
    Well I would think like that but the situation is different:
    When the parameter SENDER is empty, all goes OK and I can see in Runtime Workbench Message Monitoring - Adapter engine - Detail - Audit log only "successes". But when SENDER is filled with a value and R/3 does CALL FUNCTION with DESTINATION to a <i>non-existing Sender agreement</i>, the R/3 apparently doesn't send a acknowledgement to Adapter Engine of first thread XI->RFC. Intstead of that there are three messages in audit log:
    <i>MP: exception caught with cause com.sap.aii.af.ra.ms.api.RecoverableException: error while processing message to remote system:com.sap.aii.af.rfc.core.client.RfcClientException: JCO.Exception while calling Z_FIDATA_INPUT in remote system (RfcClient[IS2RFC_SAP_BG]):com.sap.mw.jco.JCO$Exception: (104) RFC_ERROR_SYSTEM_FAILURE: senderAgreement not found: lookup of binding via CPA-cache failed for AdapterType RFC, AdapterNS http://sap.com/xi/XI/System, di: com.sap.aii.af.rfc.afcommunication.RfcAFWException: error while processing message to remote system:com.sap.aii.af.rfc.core.client.RfcClientException: JCO.Exception w
    </i>
    Basically I understand what is happening on the background, but I really can't go over my persuation that in case of the ASYNCHRONOUS SCENARIO this should not happen.
    Or is the RFC call (I mean XI->RFC) "pseudo-synchronous" even in asynchronous scenario ? I mean that Adapter engine waits for the result of RFC everytime ... ?!
    Thank you
    Tomas

    Hello again guys,
    so I've understood it on the end. My ABAP code didn't contain EXCEPTION part of CALL FUNCTION statement.
    <i>CALL FUNCTION 'Z_XI_RETURN'
        DESTINATION gc_xi_destination
        EXPORTING
          <PARS>
        <b>EXCEPTIONS
          communication_failure = 1
          system_failure        = 2.</b></i>
    Without it the RFC short-dumped and AE correctly tried to call it 1+3 times. The thing, that the problem was connected to XI related topic, tricked me. Well it's smart, I must admit on the end
    Reward points for interest.
    THX Tomas

  • VA01-STRANGE PROBLEM

    Hello everyone..
    I am facing a very strange problem..
    while using VA01, a mail is sent to receivers when SO is created..
    what is happening is that in development server it is working absolutely fine..
    but when we transport it to production server then half times it works and half times it doesnt..
    there is no particular case for which it is working or not working..
    a team of 4 abapers have worked on this problem but nobody has been able to find the solution..
    Can anyone of you help me out Plz....
    Regards
    Shilpa

    >
    Shilpa Bansal wrote:
    > Actually I am an ABAPer so I just wanted to confirm whether the problem is technical or functional...
    As far as your replies in this thread, It looks to me this is not an ABAP problem. Since same user is able to send the mails sometime and sometimes not! It probably a Basis problem to see whether TCP/IP,SMTP Mail server connection is available (UP) always without any interruption?
    Cheers

  • Strange Problem with Code Groups / Codes

    Hey all, have a strange problem with Code Groups and Codes.
    Our data migration team accidentally loaded an early version of our catalog (code groups and codes) in to our 'Gold' configuration client. They then proceed to delete them all via transaction qs41. However, the code groups have been deleted, but not the codes.
    So, basically, no codes groups exist in table QPGR or QPGT but all the entries remain in QPCD with the assigment to code groups. The usage indicator is not set on the codes so why they did not get deleted with the codes groups is unknown.
    The issue that this is now causing us is that we can't recreate the codes groups with these codes assigned as the system thinks they already exist (via a check on table QPCD i would expect).
    Also, i have been unable to recreate what happened did in other clients... seems very strange.
    Any help appreciated.
    Cheers

    Ben,
    You could try SE11, and see if you can delete the records from there.. but I'm not hopeful...
    Otherwise you may need to write a quick ABAP program to delete the data base entries.
    PeteA

  • Strange problem when copying standard program SAPF100 (transaction F.05)

    Hi there ABAP'ers,
    I've got a very strange problem I can't figure out :/
    I'm doing a copy of a standard program - SAPF100, which stands for F.05 transaction.
    I copy it to ZSAPF100 and after launching it, filling a selection-screen with data and F8 I'm receiving a dump
    GETWA_NOT_ASSIGNED
    Field symbol has not yet been assigned.
    The termination occurred in the ABAP program "SAPF100" in "DO_SKC1C".      
    The main program was "ZSAPF100 ".                                                                               
    The termination occurred in line 253 of the source code of the (Include)   
    program "SAPF100_SBEW"                                                    
    of the source code of program "SAPF100_SBEW" (when calling the editor 2530).
    and when debugging the place in Zcode where error occurs - really a fs is not assigned, whilst in standard code is assigned.
    Why such situation appeared? I just copied the standard program and launched a copy :/ How to deal with that problem?
    I will be very very very thankful for a help.
    Regards. P.

    I'm doing the copy:
    Components:
    Source       
    Text elements
    Documentation
    Variants     
    User interface
    Screens      
    INCLUDEs     
    Includes:
    FROM            ->              TO
    <ICON>                         Z<ICON>     
    <LINE>                          Z<LINE>                 
    FIUUMS40                        ZFIUUMS40               
    RKASMAWF                        ZRKASMAWF               
    SAPF100_I1                      ZSAPF100_I1             
    SAPF100_POSTINGS                ZSAPF100_POSTINGS       
    SAPF100_SBEW                    ZSAPF100_SBEW           
    SAPF100_SLDATA                  ZSAPF100_SLDATA         
    SCHEDMAN_EVENTS                 ZSCHEDMAN_EVENTS        
    And still DUMP

  • I am facing a strange problem on new iphone 5 that I bought last week. The maps app and the places in photo gallery shows the pin and my location, however there is no information of locations. Tried to close the apps, phone restart, reset etc. Please help

    I am facing a strange problem on new iphone 5 that I bought last week. The maps app and the places in photo gallery shows the pin and my location, however there is no information of locations. Tried to close the apps, phone restart, reset etc. I am accessing it via strong wireless connection and it works fine on other devices. Please help.

    zapgrap wrote:
    there is no information of locations.
    Then no information exists.  Use the Report a Problem button within the app to report it.

  • I am having a strange problems on the Data entry Forms

    A form that has been used since 2005 in an old version of HFM 3.51 was migrated to SYstem 11.1.2.1 in January of 2012 and has been working since then. Suddenly we start having some strange problems. Our response time has been very slow and I am wondering if there were some problems in any of the services. Maybe a service did not start properly related to the WEB forms.
    We entered a number in one of the cell to be: 348336349 as soon as we hit enter, the number was formatted to 348,336,349 but when I submit the number it came back as 3. I tried it several times and it did not work, I checked the scaling and that was set blank. One of my user tried it and it did not work. I tried looking into the Preferences and my screen froze. In the meantime one of my user was able to enter the number and was able to refresh it as well. Then she enter another number on a different cell and the same problem occurred it seemed as if it truncated all the digits except for the left most digit, we are unable to figure out how to resolve this issue. The number entereed in the cell is 826,251,218 it stores 8 and loses the rest of the 8 digits. I right click and checlk the properties and it says that it has stored 8 instead of 826,251,218.
    Following is the DEF script. Does anyone has any ideas, I am wondering if I have to restart the services..
    ReportType=WebForm
    ReportLabel=Aging_Receivables
    ReportDescription=Aging Receivables
    Instructions=Please make sure you set up your point of view (POV) appropriately. Business Unit (BU): AG, CE and Other_BU. Brand: Case, NH and Other_Brand.
    BackgroundPOV=S#Actual.Y#2011.P#Jan.w#YTD.V#<Entity Currency>.I#[ICP None].C2#SERVICED.C3#GL_INPUT.C4#Input
    SelectablePOVList=S{[Hierarchy]}.Y{[Hierarchy]}.P{[Third Generation]}.E{[Hierarchy]}.C1{[Base]}.C2{[Hierarchy]}.C3{[Base]}.C4{GL.[Hierarchy]}
    C1=A#Current
    C2=A#0_To_30
    C3=A#Total_Current
    C4=A#31_To_60
    C5=A#61_To_90
    C6=A#91_To_120
    C7=A#121 Plus
    C8=A#Total_Past_Due
    C9=A#Total_Aging_Rec
    C10=A#Current_OffBook
    C11=A#Past_Due_OffBook
    C12=A#T_Aging_Rec_OffBook
    C13=A#Total_MP_Aging_Rec
    C14=A#Aging_Rec_Diff
    R1=C1#_Retail
    R2=C1#_Wholesale_Tot
    R3=C1#_Wholesale
    R4=C1#_Wholesale_Natl
    R5=C1#_Wholesale_Othr
    R6=C1#_Credit_Card
    R7=C1#_Specialized_Lending
    R8=C1#_Marine
    R9=C1#_Soris
    R10=C1#_Other
    R11=C1#_Material
    R12=C1#Sup_Product
    FormInputBoxLength=23
    PrintNumRowsPerPage=33
    PrintNumDataColsPerPage=8
    ShowLabels=False
    ShowDescriptions=True
    SuppressColHeaderRepeats=False
    Edited by: user8267293 on Aug 8, 2012 12:41 PM
    Edited by: user8267293 on Aug 8, 2012 12:43 PM

    Hi,
    Did you find a way to solve your problem ? We have exactly the same for one application and we are using the same version of HFM : 11.1.2.1.
    This problem is only about webforms. We can correctly input data through Data Grids or Client 32.
    Thank you in advance for your answer.

  • Computer slower and a few other strange problems since upgrading to SL

    Hi all,
    About a month ago, I upgraded my mid-2009 MBP to SL. I'm now on 10.6.1. Ever since the upgrade, my computer's been somewhat slower than it was when I ran Leopard (although many people I know say their machines are faster). I did restart several times at one point, and that seemed to speed it up, although it still experiences delays I didn't have before. I've also had a bunch of strange issues:
    1) Safari is most noticeably slow, especially when using something like Top Sites on Safari 4. I alleviated this problem somewhat by setting new tabs to open a blank window rather than Top Sites, but even so, Safari is generally slower, gives me 'pinwheels' often, and also is less stable.
    2) The other day, I restarted to find that all fonts except system fonts had been mysteriously deactivated. As a designer, I rely heavily on my many fonts, which I manage using Linotype FontExplorer.
    3) Today, I opened my computer up after having it sleeping in a backpack, and it had turned off. It was not out of battery; it had just turned off for no apparent reason.
    4) Judging by Activity Monitor, RAM is being used somewhat more heavily by the system, contrary to the advertisements of a 'lighter' footprint for SL as compared to Leopard. However, according to Activity Monitor (which I check frequently), the processor does not appear to be getting taxed any more heavily than under Leopard, which makes the sluggishness more inexplicable.
    5) Yesterday, I could not get my computer to recognize my Time Machine backup disc. After restarting, it worked, but this is a pain.
    I appreciate any advice I can get. Does anyone else have similar problems or solutions? Or is the general consensus that these are SL bugs that Apple will work out by about 10.6.4 or so?
    Thanks,
    Nathan
    Message was edited by: nateeanes

    I began this thread awhile ago, but the essence of it is that I had a number of strange problems, although mostly my computer was just slower, when upgrading from Leo to SL.
    I've now wiped my HD and re-installed SL. It seems faster, although there are still a few issues:
    1) iWork (Pages, Numbers) has very weird coloring. All the text looks light blue and/or cyan, and I can't fix it.
    2) Although initially Safari worked great, lately it's been going back to its habits of being slow and showing strange things like chopping up the 'Top Sites' view, i.e. rendering it in an off way.
    3) Adobe CS3 will not install properly. I get them loaded up, but when I try to launch a program, I get an error that says "licensing for this product has stopped working". I cannot get to the 'activate' page, even though I uninstalled and deactivated CS3.
    In the interest of full disclosure, I did restore my home account after clean installing SL-- maybe I should have brought the files over folder by folder rather than bringing back my whole home folder with its settings? I wonder if I accidentally brought over Adobe's FLEXnet folder too.
    Also, does anyone know if Adobe CS3 can cause these problems with Safari and other programs? It just seems that the whole machine was slower after installing CS3, even though I wasn't running the programs.
    Any help is appreciated.
    Nate

  • Problem with ABAP proxies - HTTP connection to R/3 is not working

    Hi guys!
    I'm setting up a connection from XI to R/3 , because I'm using proxy objects. Our DEV is working fine. Now I have moved the objects to QA and since the HTTP connection is not there, I need to set it up.
    I have created a service user on R/3, activated ICF service on R/3 and created a HTTP to abap type connection in XI. When I test the connection I get a new logon screen. Why? I have provided information about logon user, client, ....
    Thank you! Olian

    Hi,
    this logon screen populated when the RFC User ID is locaked. ask your basis team to release it.
    also refer below links if in case of any other problem
    Actiave ABAP Proxies -- /people/vijaya.kumari2/blog/2006/01/26/how-do-you-activate-abap-proxies
    Setting Up Point-to-Point Connections with proxy
    http://help.sap.com/saphelp_nw04s/helpdata/en/85/78af1bf407434796aaf8dbd6d4e7b7/frameset.htm
    Thanks
    Swarup

  • Submitting a form with enter key causing strange problems

    I am having a very strange problem with a webapp I am currently developing. I am using JSF 1.2 along with Facelets and RichFaces. I have coded a workflow/wizard 4-step process, and on some pages I have 4 submit buttons that all call different actions on the page. The users thought it would be useful to have the enter key submit the form, so I followed some online resources to trap a keypress using javascript, looking for the enter keycode and calling document.getElementById("elementName").click(). This works fine most of the time. Sometimes, though, it seems as if an entire new session is being created, and odd behavior starts happening. For example, my page will only include 2 of the 4 facelets on the screen -or- I will get NullPointerExceptions for objects that I know have been created in the session bean I am currently using -or- I will get a duplicate form Id after trying to re-submit the page. Could the javascript click simulation not be submitting all of the form elements or is the enter key also acting like its default action (the form submission) in addition to the "click"? I'm really at my wit's end here (plus it's nearly 3 AM, that never helps things). All of the buttons being clicked are standard h:commandButtons. There is some setTimeout logic included to disable the buttons on the page to prevent double clicks (I cannot disable them onsubmit because disabled buttons don't pass the right values, perhaps that's causing it, but if so, clicking the buttons with the mouse would cause that issue too, right?)
    I am not posting the code (yet), but if anyone wants to take a look see and see if I am doing something really abhorrently wrong, I'm more than willing to, I'm just curious if anyone has had problems regarding javascript submission of forms via the click() method. Clicking the button does not exhibit this type of behavior. Just as a side note: I am doing different things with the enter key depending if a modal window is open (the enter key closes the modal if it's up, and if not, it submits the form via a button click).
    Any help is much appreciated, if anyone has any inkling about where I should start looking for answers it would be really helpful.
    Thank you.

    edfrost wrote:
    Could the javascript click simulation not be submitting all of the form elements or is the enter key also acting like its default action (the form submission) in addition to the "click"?My guess is the second of these. You need to suppress the event handling after programmatically clicking the button.

  • Strange problems on Macbook Pro over past year...

    I'm about to do an erase and install after having numerous strange problems on my mid 2009 17" Macbook Pro (Leopard) over the past year, some of which I have opened threads for on these forums.
    They are listed bellow to see if anyone wants to give their final two cents as to what is causing them. They may or might not be related.
    1) I recently found the "Unknown" user classifications at second from top in the user priveleges for the main Macintosh HD folder and "Local Work" – which is my main folder for work.
    http://discussions.apple.com/thread.jspa?threadID=2741617&tstart=0
    2) Last Summer I had some very strange login problems which were well documented in this very long winding thread here:
    http://discussions.apple.com/thread.jspa?threadID=2485199&tstart=0
    3) Can't access iTunes store due to this error code -54. Thread opened here:
    http://discussions.apple.com/thread.jspa?threadID=2653733&tstart=0
    4) Some proceses I've seen in the activity monitor that are possibly a little sketchy are as follows:
    - "netsessionmac1" ... Akamai playing about?
    - "TaskManagerDaemo" ... with "Root" user, ... sounds a bit vague and possible malware according to google?
    5) In Skype I get constant warnings of other computers trying to connect from Little Snitch and Virus Barrier. I get so many of them one after they other pausing skype that I can only use Skype with Little Snitch off. I can only use it late at night also as there seems to be more attempts being blocked in virus barrier during the day that I can't even get past the login:
    Some examples in screen grabs:
    http://oi56.tinypic.com/xkwwtf.jpg
    http://oi55.tinypic.com/2v2w941.jpg
    And other examples of the hundreds of different IP addresses I've had asking to access computer on some obscure 4 digit port:
    http://whatismyipaddress.com/ip/86.178.52.58
    http://whatismyipaddress.com/ip/94.168.76.16
    http://whatismyipaddress.com/ip/94.171.116.123
    http://whatismyipaddress.com/ip/92.235.196.125
    http://whatismyipaddress.com/ip/92.239.25.70
    http://whatismyipaddress.com/ip/192.168.0.1
    http://whatismyipaddress.com/ip/92.235.208.101
    http://whatismyipaddress.com/ip/92.236.252.132
    http://whatismyipaddress.com/ip/85.15.190.49
    ... etc
    6) I have to constantly open and close Mail after it hangs on sending. Says there is a connection problem on port 110 or whatever, but words fine as soon as I open again. This problem happens particularly when I want to send from my 2nd or 3rd POP or IMAP other than my normal one.
    7) Slow Safari/Firefox and internet.
    8) I got this strange warning about my IP changing recently when downloading a file:
    http://oi53.tinypic.com/2z4b77o.jpg
    9) My internet cuts out for large periods of time while the other PC desktop in my house works perfectly fine.
    Well, any last suggestions much appreciated. Many thanks.
    Message was edited by: Scottishengineer

    I suppose your expanding battery problem could have caused some or all of these problems, but most of them sound like software issues.
    If I were you I'd try a few things:
    1. boot from your snow leopard install disk and repair your startup disk with disk utility.
    2. repeat the repairs until no repairs are reported (the toilet paper principle).
    3. repair permissions again.
    4. if the problems persist, trash the preferences files for the misbehaving apps.
    5. if the problems persist, delete the misbehaving apps and reinstall them.
    6. it the shutoffs persist, try a PMU reset.
    7. a PRAM reset would probably be a good idea too.
    8. if none of that works, archive and reinstall.
    there is a freeware utility called applejack that will also do most of this.
    Details on all of these will be readily available with a google search.

  • Creative zen : vision M 30gb strange problem

    ,Creative zen : vision M 30gb strange problem. Hi people,
    My mp3 player is 2 and a half years old. A few months ago he didn't charge anymore. ?I thought i could repair it by buying a new battery and install him in my mp3.
    Afther a few ours of ?assembling it was ready for charging a thought..
    I used the usb charger and de sync adapter...
    the morning after, my mp3 is not charged and only showing me a little red stripe in de battery (right top) i can listen music but only for a few minutes...
    Also my PC does noet see my MP3
    tested on :
    windows xp service pack 3?
    vista?
    windows 7?
    please help me
    Stijn van Vilsteren?
    DUTCH?
    i am sorry for my pore english !

    Squipy wrote:
    Hi, I stopped using this MP3 for about 2 or so years because I bought a new one. I decided to start using it again and downloaded all the required software but as soon as I unplugged the MP3 from the power outlet, the player died. I can't get it to start up without plugging it into a power outlet. I think it has rechargable battery? Why didn't it recharge itself?
    My second enquiry is about the capacity of the player. When my player was empty, I went into "Information" and it said Total Space: 28GB and Free Space: 2GB. Why is free space only 2GB? Shouldn't it be 28 as well?
    Thanks in advance!
    The battery will only last about 3yrs regardless of use.You will need to change it. Did you scroll down to see the album,picture,track counts? Did you partition part of the dri've for removable storage. You can find instructions to open here ? http://www.youtube.com/watch?v=_Drkr...e=channel_page & ? the battery here(very easy to do) http://cgi.ebay.com/Original-Creative-ZEN-Vision-M-30gb-Battery-LPCS285385_W0QQitemZ400028645679QQcmdZViewItemQQpt ZOther_MP3_Player_Accessories?hash=item40002864567 9&_trksid=p39.c0.m4&_trkparms=72%3A205|66%3A4|65%3 A2|39%3A|240%3A38|30%3A0|293%3A|294%3A200

  • Short code causes a strange problem - About the list again -- please read!

    Hi again people. Maybe you remember my project - has a list, that you can search thru using a text field. During the work I got stuck on a strange problem ( Again :-( ) My app has one text field, one combo box, one list and a text field once more. The code should do the following ->
    *1. Load the list, no problem with that.*
    *2. Show the elements of the list, that match the selected group in the combo box,no problem.*
    *3. Search thru the list using the text field,no problem.*
    4. When the user selects an element from the list, it should display its info in the second text field. This also works fine, but when after looking at info of one of the elements the things on numbers 2 and 3 ( look up! ) stop working. I must say that everything works fine until user selects an element from the list. I couldnt understand this kind of behavior so I am asking you to help me please.
    The code is very simple:
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    class the_window extends JFrame implements DocumentListener, ItemListener, ListSelectionListener {
        FileReader reader;
        String data_base[][];
        String first_pass[];
        int number_of_elements;
        DefaultListModel dflm = new DefaultListModel();
        JList list;
        JTextField text_field = new JTextField();
        JTextField info_field = new JTextField();
        String groups[] = {"1. group" , "2. group"};
        JComboBox groups_cmbx = new JComboBox(groups);
        the_window(){
            super("the Window!");
            JPanel panel = new JPanel(null);
            Container c = this.getContentPane();
            c.add(panel);
            text_field.setBounds(10,10,170,25);
            text_field.getDocument().addDocumentListener(this);
            panel.add(text_field);
            groups_cmbx.setBounds(10,45,170,25);
            groups_cmbx.addItemListener(this);
            panel.add(groups_cmbx);
            list = new JList(dflm);
            list.setBounds(10,90,170,190);
            list.setFixedCellHeight(20);
            list.addListSelectionListener(this);
            panel.add(list);
            info_field.setBounds(10,280,170,25);
            panel.add(info_field);
            load_the_base();
            refresh();
            this.setSize(190,350);
            this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            this.setResizable(false);
            this.setVisible(true);
        public void itemStateChanged(ItemEvent e){
            refresh();
        public void valueChanged(ListSelectionEvent e){
            String str = (String) dflm.getElementAt(list.getSelectedIndex());
            int index = 0;
            for(int i = 0; i < number_of_elements; i++){
                if(str.equals(data_base[0])){
    index = i;
    break;
    info_field.setText(data_base[index][1]);
    private void load_the_base(){
    String data = "";
    try{
    reader = new FileReader("data.txt";);
    int r = 0;
    while((r = reader.read()) != -1){
    char c = (char) r;
    data += c;
    reader.close();
    }catch(IOException e){}
    first_pass = data.split(";");
    number_of_elements = first_pass.length;
    data_base = new String[number_of_elements][];
    for(int i = 0; i<number_of_elements; i++){
    data_base[i] = first_pass[i].split("#");
    private void refresh(){
    String search_str = text_field.getText();
    int selektovano = groups_cmbx.getSelectedIndex();
    dflm.clear();
    for(int i = 0; i < number_of_elements; i++){
    int grupa = Integer.parseInt(data_base[i][2]);
    if(grupa == selektovano){
    String at_the_moment = data_base[i][0]; // if you change this to String at_the_moment = data_base[i][1]; it works perfectly
    if(at_the_moment.startsWith(search_str)){
    dflm.addElement(at_the_moment);
    public void changedUpdate(DocumentEvent e){
    refresh();
    public void removeUpdate(DocumentEvent e){
    refresh();
    public void insertUpdate(DocumentEvent e){
    refresh();
    public class Main {
    public static void main(String[] args) {
    JFrame f = new the_window();
    Now, can you please tell me whats wrong with this?
    For the "data.txt" make a new text file using *notepad* and copy the following line into the document:
    _1. element#1. info#0;2. element#2. info#0;3. element#3. info#1;4. element#4. info#1;5. element#5. info#1;_                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Darryl.Burke wrote:
    Keith, thanks for making that readable. So here's the diagnosis -
    In the refresh() method, calling defaultListModel.clear() results in a valueChanged(...) event in which this method calldefaultListModel.getElementAt(list.getSelectedIndex())results in the exception noted, as getSelectedIndex returns -1, the list being empty... you can't getElementAt(-1).
    I haven't analyzed all the code nor checked whether is now works as desired, but this small change to valueChanged counters the exception being thrown.   public void valueChanged(ListSelectionEvent e) {
    infoField.setText(""); // do this unconditionally
    if (list.getSelectedIndex() != -1) {
    String value = (String)defaultListModel.getElementAt(list.getSelectedIndex());
    for(int i = 0; i < numFields; i++){
    if(value.equals(matrix[0])){
    infoField.setText(matrix[i][1]);
    break;
    db
    Yea! You were right! I didnt think that calling *list_model.clear();* will result in calling *valueChanged()* ........
    That was some *clear()* thinking :-) Thank you!
    corlettk wrote:
    I cleaned up some variable & method names (tut tut), imports (very naighty), and some thread stuff... but it remains fundamentally the same codeIs it so important to "clean" the imports? How much does it slow down the loading time? Should I do this on all my projects, because they are all "very naighty"?
    ps. Thanks to all that gave some help to answering this strange question :-)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Strange Problem in dynamically list population with record group

    Hello Room,
    I am dynamically populating a single list with 2 record groups. I am having a strange problem. All the code are written in 2 seperate buttons. The code of every button is given below.
    Button 1 code:-
    DECLARE
    rg_reports RECORDGROUP;
    rg_name VARCHAR2(40) := 'REPORTS';
    vTemp NUMBER;
    BEGIN
    -- Pls make sure Group doesn't already exist
    rg_reports := FIND_GROUP(rg_name);
    -- If it doesn't exist then create it and add ur query to it
    IF Id_Null (rg_reports) THEN
    rg_reports:=CREATE_GROUP_FROM_QUERY(rg_name , 'SELECT companyname,to_char(co) from companymaster order by companyname');
    end if;
    --Populate the Record Group
    vTemp:=POPULATE_GROUP(rg_reports);
    POPULATE_LIST('REPORTS.EXAMPLELIST', rg_name);
    Delete_Group( rg_reports );
    END;
    Button 2 Code:-
    DECLARE
    rg_reports RECORDGROUP;
    rg_name VARCHAR2(40) := 'REPORTS';
    vTemp NUMBER;
    BEGIN
    -- Pls make sure Group doesn't already exist
    rg_reports := FIND_GROUP(rg_name);
    -- If it doesn't exist then create it and add ur query to it
    IF Id_Null (rg_reports) THEN
    rg_reports:=CREATE_GROUP_FROM_QUERY(rg_name , 'SELECT accountname,to_char(co) from accountmaster order by accountname');
    end if;
    --Populate the Record Group
    vTemp:=POPULATE_GROUP(rg_reports);
    POPULATE_LIST('REPORTS.EXAMPLELIST', rg_name);
    Delete_Group( rg_reports );
    END;
    The code is same here only the sql is different in these 2 buttons. Now the problem point.
    when i press button 1, I get the list populated ok. when i try to click on the list item and keep the button pressed the list gets scrolled properly.
    when i press button 2 after that i get account names well populated in the same list item as well, but this time, when i keep the button pressed the list does not scroll below as in button 1. It does not even allow to select different item from the list of button 2 code.
    I tried to clear cache, cookies, exit browser everything and try to run the button 2 first, but still the problem in button 2 code.
    Following are my system details.
    windows 7 professional edition.
    Oracle database 11g on windows 7
    Oracle forms 10g patchset 10.1.2.0.2 on windows 7
    Browser Netscape Navigator with oracle jinitiator 1.3.1.22
    But this form is run by a client side html file where oracle forms 10g is not installed on windows xp. html file is just referring server url to run the module. The file is run on Netscape navigator browser with oracle jinitiator 1.3.1.22
    My question is that is this a bug ? if button 1 gets the list item scrolled, why is the problem with button 2 even though i press it first. Here I am deleting the record group also. after the code is over. Initially I thought this may be the character length problem so I took the maximum character length for that list item as given by the 2 columns in database.
    Why is the list scrolling not happening in button 2 but in button 1 with same codes on both ?
    Anybody please help me.

    The problem is the second query. I would guess that the TO_CHAR(co) is not unique for each account, but is the same for the accounts. And as the second item in the select-list is the listitems values, all your listitem-entries have the same value. therefore, of you select any entry, the list will always go the the first entry again.
    Adjust your query.

Maybe you are looking for