Import hangs Urgent help!!

Hi DBAs,
Urgent help!!
I am doing full db import with below parameter, it haged for 30 min,
please suggest
imp "'/ as sysdba' " file=TF3_SINTSTFAPPU1_R1_2007_UAT_260807.dmp log=TF3_SINTSTFAPPU1_R1_2007_UAT_260807_imp.log full=y grants=y commit=y ignore=y skip_unusable_indexes=y buffer=5000000000 feedback=25000 statistics=none
Import: Release 9.2.0.6.0 - Production on Wed Aug 29 12:42:34 2007
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to: Oracle9i Enterprise Edition Release 9.2.0.8.0 - Production
With the Partitioning option
JServer Release 9.2.0.8.0 - Production
Export file created by EXPORT:V09.02.00 via conventional path
import done in US7ASCII character set and AL16UTF16 NCHAR character set
. importing SYSTEM's objects into SYSTEM

Your archiver is still running?
No ora-00275 errors?
Nothing in alert<sid>.log?
feedback=25000 is a bad idea as that will slow down the import. Also the buffer parameter looks ridiculously high. 8 Mb is usually sufficent.
Does imp show=y log=<any filename> work at all?
Could you find out what imp is waiting for
Connect to the database
select sid, serial#
from v$session
where program like 'imp%'
select * from v$session_wait
where sid = <sid found using previous command>
Sybrand Bakker
Senior Oracle DBA
Sybrand Bakker
Senior Oracle DBA

Similar Messages

  • Error while running Process Order API to import orders - URGENT HELP NEEDED

    Hi all,
    I'm stuck with order import using OE_ORDER_PUB.PROCESS_ORDER api. Wanted to import a simple order in Vision database using the process order api. Figured out the right data to use, inserted into Headers and Lines Iface All tables. When calling the OE_ORDER_PUB.PROCESS_ORDER api, it is throwing this error:
    "Header ID does not exist on this record or does not match ID specified on header record. You require a valid header ID if the operation is Create."
    But when I validate the same record using the CORRECTIONS form in Order Import GUI, the order is successfully validated. Also the order is imported when I click the IMPORT button.
    I understand that HEADER_ID column is not required for creating a new order, but not sure why it is erroring. Here is the data I'm using:
    Insert into oe_headers_iface_all
    (org_id, order_type_id, order_source_id, orig_sys_document_ref, ordered_date, request_date,
    sold_from_org_id, sold_to_org_id, ship_from_org_id, ship_to_org_id, invoice_to_org_id,
    CREATED_BY,CREATION_DATE,LAST_UPDATED_BY,LAST_UPDATE_DATE,LAST_UPDATE_LOGIN,OPERATION_CODE)
    values (204, 1430, 1046, '101040', sysdate, sysdate, 204, 1004, 606, 1018, 1017, 0, sysdate, 0, sysdate, 0, 'CREATE');
    Insert into oe_lines_iface_all
    ("ORDER_SOURCE_ID","ORIG_SYS_DOCUMENT_REF","ORIG_SYS_LINE_REF","ORIG_SYS_SHIPMENT_REF","ORG_ID","INVENTORY_ITEM","LINE_TYPE_ID",request_date,"SCHEDULE_DATE","DELIVERY_LEAD_TIME","ORDERED_QUANTITY","ORDER_QUANTITY_UOM",sold_from_org_id, sold_to_org_id, ship_from_org_id, ship_to_org_id, invoice_to_org_id,"UNIT_SELLING_PRICE","CREATED_BY","CREATION_DATE","LAST_UPDATED_BY","LAST_UPDATE_DATE","LAST_UPDATE_LOGIN","OPERATION_CODE")
    values
    (1046,'101040', '1', '1', 204, 'AS72111', 1427, sysdate, sysdate+1, 0, 10, 'Ea' ,204, 1004, 606, 1018, 1017,100,0,sysdate,0,sysdate,0,'CREATE');
    Any help is appreciated.
    FYI - this is a 11.5.10.2 version installed on Windows 2003 server.
    Thanks in advance.
    Jags

    I might be late in replying, but hope it might help.
    From your query it seems you are inserting records into interface tables and then calling process order API( probably from some PL/SQL block).
    This is where I am confused, because I hope you understand, that interface tables are for use with Order Import concurrent Program, and for Process ORder API, you need to provide the data as parameter. The api has, header record type and line table type as parameters. So you need to assign correct data to these variables and pass them as parameter when you are calling Process Order API.
    If you are doing the same thing, then post the exact pl/SQL code and error message from the API. That might help diagnose the issue.
    Regards,
    Nitin Darji

  • URGENT HELP PLEASE - drop index hangs on SAP

    Hi all,
    OS = Linux
    DBVersion = Oracle10.2.0.2
    Need some urgent help advise please on how to get around this problem.
    On a SAP system, am trying to drop six indexes, largest is 300MB and smallest is 50MB.
    I tried running drop index sapusername.index_name on the 50MB index via SQL*Plus and it seems to be taking forever. Can anyone please suggest if there is anything I can check on the database on why it is taking such a long time?
    I can leave it to run overnight but worried that when I come back the next day, it will still be hanged. Is there any quick way of dropping the index, .i.e. drop immediate ... :-)
    Am not using SAP's BRTOOLs as it is also hanging from there and the SAP-ADMIN had approved for the DBA to drop it from our end instead.
    Any response and advise on this will be very much appreciated.
    From Google'ing, I found some that mentioned that the fault could be because of the existence of the constraints on the table that I am dropping the index of.
    Checking the table, it has 17 SYS_ named constraints. None of these constraints have INDEX_NAME that refers to the indexes that am dropping.
    Should I disable the constraints and then run the drop index again?
    Thanks in advance.
    Edited by: user649596 on Apr 13, 2010 11:49 PM

    Should I disable the constraints and then run the drop index again?NO, certainly not !!
    Ask SAP Support on what methods you should use to diagnose the "hang" and what your next step(s) should be.
    Hemant K Chitale

  • Cannot allocate new log importing hanging

    Hai All,
    When I imort a 1.59 Gb data into a database after some time
    a mesaage in alertlog file and import hanging
    message
    ======
    Thread 1 cannot allocate new log, sequence 7
    Checkpoint not complete
    ======
    I have 3 redo log groups with 2 members with the size of 300MB
    How to resolve this? pleas help its an urgent.. please..
    Shiju

    Firstly the database in archive mode but I changed to noarchive mode before imorting the data
    my sql screen
    ==========
    SQL> archive log list
    Database log mode No Archive Mode
    Automatic archival Enabled
    Archive destination /archive
    Oldest online log sequence 7
    Current log sequence 11
    SQL>
    Please help
    Shiju

  • [URGENT HELP NEEDED] Premiere Pro CS6 failed rendering

    Hello!
    I`ll try to make this quick because I need help asap. I`ve been starting to make YouTube gaming videos 3 weeks ago and my channel is growing up pretty fast. I promised I would make a video everyday but it`s been a full week since I couldn`t upload because I was busy and when I tried to render it failed.
    Anyway here`s how it goes.I`ve recorded with fraps some gameplay footage with the resolution of 1360x706. One of my friends reccommanded me Adobe Premiere Pro for editing so I`m using the trial version of CS6. I create a new project and choose a format of 720 25 (cant really remember the exact name). I then import my recorded files and when I place them in the sequence it tells me the resolution is different and asks me if I want to change the sequence settings according to the files. Usually, I ignore it and when I export the Media I just tick the option: "Scale to Fill" and that usually works just fine, quality HD on YT...
    But this week it has driven me crazy, I really don`t want to explain how much stress and dissapointment this has caused to me because I think I`ll end up raging...I`ll just tell you I`ve been trying for a couple of days more than 7 time to render the project(each time it takes about an hour and a bit more, so let`s just call it 7 hours wasted). The problem actually is that when I check the output file after exporting the media, the file size is ONLY 24 bytes!!! Other times the file size gets to like half of the one that should be or less, but mainly the render even so takes up a normal length of time of processing but in the end the file is only 24 bytes..Thing is I don`t encounter any error whatsoever...
    I really need some urgent help!
    Thanks!

    1st, some FRAPS information
    These are for Premiere Elements, but may help with PPro
    Fraps & Elements http://forums.adobe.com/thread/871095
    -and more Elements http://forums.adobe.com/thread/943772
    -and yet more Elements http://forums.adobe.com/thread/967201
    2nd, it is REALLY better to have your project sequence match your video
    Please NOTE that the PPro CS6 screen may look a bit different (I use CS5)
    For CS5 and later, the easy way to insure that your video and your project match
    See 2nd post for picture of NEW ITEM process http://forums.adobe.com/thread/872666
    -and a FAQ on sequence setting http://forums.adobe.com/message/3804341

  • URGENT HELP NEEDED!!! (Almost a matter of life and death)

    Well, it's more of a matter of failing a course or not...
    Anyway, my Java professor gave us some labs to do. I know Java front and back, at least, whatever version I learned a few years back. This is my first tenure with the Scanner object, and it's messing me up.
    I'm using Eclipse for my project. I have three files in the source folder, ABC_Manufacturing.java, mseast.dat and mswest.dat. Now, when I try to instanciate a new Scanner object, it won't find the files:
    Scanner east = new Scanner(new FileReader("mseast.dat"));
    Scanner west = new Scanner(new File("mswest.dat"));
    I'm trying two seperate ways to do this. Neither are working, this is the error I get:
    Exception in thread "main" java.lang.Error: Unresolved compilation problems:
         Unhandled exception type FileNotFoundException
         Unhandled exception type FileNotFoundException
         at ABC_Manufacturing.main(ABC_Manufacturing.java:38)
    Now, I added these files OVER and OVER again. I added them. I created new files and pasted the contents in there. I used .txt files. All the same error. It's like it just won't take the time out to look for the files that are RIGHT IN THE DAMN PROJECT! Then I tried using a complete path, using C:\Java\whatever. SAME ERROR!!!!
    Please, I need urgent help. This is due tomorrow at noon, and I have no idea what to do at this point. I can't really continue, because at this point its just looking at what prints out and formatting it, and I don't want to do that without testing to see if my code to convert the file data into arrays work. You dig? Thanks for any and all help, and I'm going to kill my professor...she spent a week going over parallel arrays but did nothing to show us how to import files into projects or use the scanner class. Also it doesn't help that at uni we have to use emacs, which I don't use at home.

    d00erino wrote:
    This is the the main class, so far:
    public static void main(String[] args)throws IOException
              Scanner west = new Scanner(new File("mswest.dat"));
              int [] eastParts = new int[13];
              int [] eastQuant = new int[13];
              int [] westParts = new int[17];
              int [] westQuant = new int[17];
              System.out.print(west.nextInt());
    And I didn't ignore that one guy (sorry, don't remember your username) I tried you and the other guy's responce. Both didn't work. I dunno how to get around errors. Figures, you don't learn that in the course but she'll spend a week on parallel arrays...Ok, well that can't possibly be complaining with the same error message you got before, so now you need to be (more) specific about what "didn't work" means.

  • Urgent  help needed(java frames)

    Hi,
    I need urgent help for correcting a piece of code.
    I have written a piece of code for building a gui with some buttons, drawing some geometric shapes.The code consists of two files called Graph and Frame.
    The problem I suppose in the last part of the Graph file, which Rectangle and Circle are called together, the only shape that the program draws is rectangle.Here is the code:
    //Graph
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.io.*;
    import java.util.*;
    public class Graph extends JPanel {
    LinkedList color;
    LinkedList figures;
    public Graph() {
    setBackground(Color.white);
    figures = new LinkedList();
    color = new LinkedList();
    int z;
    class Point {
    int x;
    int y;
    public Point(int x, int y) {
    this.x = x;
    this.y = y;
    public Point(Point p) {
    x = p.x;
    y = p.y;
    public String toString() {
    return "(" + x + ", " + y + ")";
    public void move(Point dist) {
    x += dist.x;
    y += dist.y;
    abstract class GeomFigur {
    public abstract void move(Point p);
    class Line extends GeomFigur {
    Point p1, p2;
    public Line(Point p1, Point p2) {
    this.p1 = new Point(p1);
    this.p2 = new Point(p2);
    public String toString() { return "Line from " + p1 + " to " + p2;  }
    public void move(Point dist) {
    p1.move(dist);
    p2.move(dist);
    class Rectangle extends Line {
    public Rectangle(Point p1, Point p2) {
    super(p1, p2);
    public String toString() { return "Rectangle from " + p1 + " to " + p2; }
    class Circle extends GeomFigur{
    Point centre;
    int radius;
    public Circle(Point centre, int radius) {
    this.centre = new Point(centre);
    this.radius = radius;
    public String toString() {
    return "Circle, centre " + centre + ", radius " + radius;
    public void move(Point dist) { centre.move(dist); }
    public void addRectangle(int x, int y, Color col) {
    Rectangle r =new Rectangle(new Point(x,y),new Point(x+20,y+20));
    figures.addLast(r);
    color.addLast(col);
    repaint();
    public void addCircle(int x, int y, Color col) {
    Circle c =new Circle(new Point(x,y), 1 );
    figures.addLast(c);
    color.addLast(col);
    repaint();
    public void paintComponent(Graphics g) {
    super.paintComponent(g);
    for (int i=0;i < figures.size();i++) {
    Rectangle rect = (Rectangle)figures.get(i);
    //Circle circ = (Circle)figures.get(i);
    g.setColor(Color.black);
    g.drawRect(rect.p1.x,rect.p1.y,20,20);
    g.setColor((Color)color.get(i));
    g.fillRect(rect.p1.x,rect.p1.y,20,20);
    //g.setColor(Color.black);
    // g.drawOval(circ.centre.x,circ.centre.y,20,20);
    // g.setColor((Color)color.get(i));
    // g.fillOval(circ.centre.x, circ.centre.y, 20, 20);
    //Frame
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    public class Frame extends JFrame implements ActionListener {
    JButton button1, button2, button3, button4, button5 ;
    Graph gr;
    JComboBox cbx;
    JComboBox cby;
    JComboBox col;
    JMenu filemenu;
    JMenuItem quit;
    JMenuBar menubar;
    int x=10;
    int y=10;
    Color color=Color.red;
    public Frame() {
    menubar = new JMenuBar();
    filemenu = new JMenu("File");
    filemenu.setMnemonic('F');
    quit = new JMenuItem("Quit");
    quit.addActionListener(this);
    quit.setMnemonic('Q');
    quit.setAccelerator(KeyStroke.getKeyStroke('Q',Event.CTRL_MASK,false));
    filemenu.add(quit);
    menubar.add(filemenu);
    setJMenuBar(menubar);
    button1 = new JButton("Rectangle");
    button1.addActionListener(this);
    button2 = new JButton("Circle");
    button2.addActionListener(this);
    button4 = new JButton("Ellipse");
    button4.addActionListener(this);
    button5 = new JButton("Triangle");
    button5.addActionListener(this);
    button3 = new JButton("Reset");
    button3.addActionListener(this);
    String[] elements_x= {"10","20","30","40","50","60","70"};
    cbx = new JComboBox(elements_x);
    cbx.addActionListener(this);
    cbx.setActionCommand("cbx");
    String[] elements_y= {"10","20","30","40","50","60","70"};
    cby = new JComboBox(elements_y);
    cby.addActionListener(this);
    cby.setActionCommand("cby");
    String[] elements_color = {"Red","Blue","Green","Orange","Yellow" };
    col = new JComboBox(elements_color);
    col.addActionListener(this);
    col.setActionCommand("col");
    gr = new Graph();
    JPanel top = new JPanel(new BorderLayout());
    JPanel inputs = new JPanel(new GridLayout(6,1));
    inputs.add(button1);
    inputs.add(button2);
    inputs.add(button3);
    inputs.add(button4);
    inputs.add(button5);
    inputs.add(cbx);
    inputs.add(cby);
    inputs.add(col);
    top.add(gr,BorderLayout.CENTER);
    top.add(inputs,BorderLayout.WEST);
    getContentPane().add(BorderLayout.CENTER, top);
    setSize(500,300);//set window size
    //take care of actions
    public void actionPerformed(ActionEvent e) {
    String command = e.getActionCommand();
    if (command.equals("Quit")){
    System.exit(0);//terminate program
    else if (command.equals("Rectangle")){
    //add Rectangle to graph at
    //position x,y and with certain color
    gr.addRectangle(x,y,color);
    else if (command.equals("Circle")){
    gr.addCircle(x,y,color);
    else if (command.equals("Reset")){
    else if (command.equals("Triangle")){
    else if (command.equals("Ellipse")){
    else if (command.equals("cbx")){
    x=Integer.valueOf((String)((JComboBox)e.getSource()).getSelectedItem()).intValue();
    else if (command.equals("cby")){
    y=Integer.valueOf((String)((JComboBox)e.getSource()).getSelectedItem()).intValue();
    else if (command.equals("col")){
    String temp=(String)((JComboBox)e.getSource()).getSelectedItem();
    if (temp=="Red") color=Color.red;
    else if (temp=="Blue") color=Color.blue;
    else if (temp=="Green") color=Color.green;
    else if (temp=="pink") color=Color.pink;
    else if (temp=="lightGray") color=Color.lightGray;
    //main program
    public static void main(String [] args) {
    Frame appl = new Frame();
    appl.setVisible(true);
    Thanks in advance
    Marina

    Hi,
    You are very lucky that I'm currently boored. You should never tag a question as urgent. It might be urgent to you, but not to us who answer. And you should also use code formatting when you post code (see the formatting tips, or use the code-button).
    I made some changes to your Graph class. The most important thing is the abstract draw method that I added to the GeomFigur class.
    import java.awt.*;
    import javax.swing.*;
    import java.util.*;
    public class Graph extends JPanel {
        LinkedList figures;
        public Graph() {
            setBackground(Color.white);
            figures = new LinkedList();
        int z;
        abstract class GeomFigur {
            protected Color color;
            public GeomFigur(Color color) {
                this.color = color;
            public abstract void move(Point p);
            public abstract void draw(Graphics g);
        abstract class Line extends GeomFigur {
            Point p1, p2;
            public Line(Color c, Point p1, Point p2) {
                super(c);
                this.p1 = new Point(p1);
                this.p2 = new Point(p2);
            public String toString() {
                return "Line from " + p1 + " to " + p2;
            public void move(Point dist) {
                p1.move(dist.x, dist.y);
                p2.move(dist.x, dist.y);
        class Rectangle extends Line {
            public Rectangle(Color c, Point p1, Point p2) {
                super(c, p1, p2);
            public String toString() {
                return "Rectangle from " + p1 + " to " + p2;
            public void draw(Graphics g) {
                System.out.println("Draw rectangle at " + p1 + " with color " + color);
                g.setColor(Color.black);
                g.drawRect(p1.x, p1.y, 20, 20);
                g.setColor(color);
                g.fillRect(p1.x, p1.y, 20, 20);
        class Circle extends GeomFigur {
            Point centre;
            int radius;
            public Circle(Color c, Point centre, int radius) {
                super(c);
                this.centre = new Point(centre);
                this.radius = radius;
            public String toString() {
                return "Circle, centre " + centre + ", radius " + radius;
            public void move(Point dist) {
                centre.move(dist.x, dist.y);
            public void draw(Graphics g) {
                System.out.println("Draw circle at " + centre + " with color " + color);
                g.setColor(Color.black);
                g.drawOval(centre.x, centre.y, 20, 20);
                g.setColor(color);
                g.fillOval(centre.x, centre.y, 20, 20);
        public void addRectangle(int x, int y, Color col) {
            System.out.println("x,y,col " + x + ":" + y + ":" + col);
            Rectangle r = new Rectangle(col, new Point(x, y), new Point(x + 20, y + 20));
            figures.addLast(r);
            repaint();
        public void addCircle(int x, int y, Color col) {
            System.out.println("x,y,col" + x + ":" + y + ":" + col);
            Circle c = new Circle(col, new Point(x, y), 1);
            figures.addLast(c);
            repaint();
        public void paintComponent(Graphics g) {
            super.paintComponent(g);
            for (int i = 0; i < figures.size(); i++) {
                GeomFigur drawable = (GeomFigur)figures.get(i);
                drawable.draw(g);
    }/Kaj

  • URGENT HELP REQUIRED!

    I am having problems implementing a username validaion bean for my login system. Every time I click my login icon on my main JSP page the login JSP page does not appear except one of the error JSP pages.
    How can I correct this problem?
    Does the code below look correct?
    Below is the codes for the Username Validation Bean :
    LOGIN.JSP
    <%@ page import="java.io.*"%>
    <%@ page import="java.util.*"%>
    <%@ page import="java.sql.*"%>
    <%@ page import="com.mysql.jdbc.*"%>
    <%@ page errorPage="badLogin.jsp"%>
    <%@ page import="gcd.UserNameValidationBean"%>
    <%
    Class.forName("com.mysql.jdbc.Driver");
    java.sql.Connection connection=java.sql.DriverManager.getConnection("jdbc:mysql://localhost/gcdBB_db");
    java.sql.Statement statement = connection.createStatement();
    Enumeration parameters = request.getParameterNames();
    if(parameters.hasMoreElements())
    String usernameValue = request.getParameter("username");
    String passwordValue = request.getParameter("password");
    statement.executeUpdate("INSERT INTO users (username,password) VALUES ('"+usernameValue+"','"+passwordValue+"')");
    %>
    GOODLOGIN.JSP
    <%@ page errorPage="badLogin.jsp"%>
    <%@ page import="gcd.UserNameValidationBean"%>
    <% UserNameValidationBean validationBean = new UserNameValidationBean();
    if(request.getParameter("username")!=null)
    validationBean.validateUserNameBean(request.getParameter("username"));
    %>
    <%=request.getParameter("username")%>
    USERNAMEVALIDATIONBEAN.JAVA
    package gcd;
    public class UserNameValidationBean
    public UserNameValidationBean(){}
    public boolean validateUserName(String userName) throws InvalidUserNameException
    if(userName.length() < 32)
    throw new InvalidUserNameException("User Name Invalid: " + userName);
    return true;
    INVALIDUSERNAMEEXCEPTION.JAVA
    package gcd;
    public class InvalidUserNameException extends Exception
    public InvalidUserNameException(String message)
    super(message);
    I need urgent help to get this working!

    Here is code for badLogin.jsp and badLoginWithExceptonObject:
    BADLOGIN.JSP
    <HTML><HEAD><TITLE>Login Failure</TITLE></HEAD>
    <BODY bgcolor="#FF9900">
    <H1></H1>
    <font face="Arial" size="3">Sorry but you either entered an incorrect username
    or password </font>
    <P><font face="Arial" size="3">Try Again</font>
    </BODY></HTML>
    BADLOGINWITHEXCEPTIONOBJECT.JSP
    <HTML><HEAD><TITLE>Check User Login Against Parameters</TITLE></HEAD>
    <BODY bgcolor="#FF9900">
    <%@ page isErrorPage = "true"%>
    <P><font face="Arial" size="3">Error =</font> <%= exception.getMessage()%> <% PrintWriter writer = new PrintWriter(out); %>
    <P><font face="Arial" size="3">Stack =</font> <% exception.printStackTrace(writer); %>
    <P><font face="Arial" size="3">Try Again</font>
    </BODY></HTML>

  • Urgent help required in migration

    Hello,
    I am stuck on 77% of r3load process my all 15/16 processes are finished successfully only one process has failed I have cut paste the log (SAPAPPL1.log) below of the same. Request your urgent help.
    DbSl Trace: Connecting via TNS_ADMIN=/oracle/F01/920_64/network/admin, tnsname=F01
    DbSl Trace: Got NLS_LANG=AMERICAN_AMERICA.US7ASCII from environment
    DbSl Trace: Now I'm connected to ORACLE
    DbSl Trace: Database instance F01 is running on e027pae0 with ORACLE version 9.2.0.7.0
    trying to restart import ###
    (RIM) INFO: table "BKPF" truncated
    restart finished ###
    #START: 20070530101004
    TAB: BKPF
    (RD) ERROR: missing last block number for table "BKPF" in directory file "/sapcd/EXPDIR/DATA/SAPAPPL1.TOC"
    #STOP: 20070530101004
    Thanks & Regards,
    Bhushan

    Did you split the files?
    It seems that export file for this table got corrupt.
    Unfortunately, you ahve to start again. I had a similar problem and had to do it again.

  • Urgent Help Required for Connect Four Game

    Hi all,
    I am a student and I have a project due 20th of this month, I mean May 20, 2007 after 8 days. The project is about creating a Connect Four Game. I have found some code examples on the internet which helped me little bit. But there are lot of problems I am facing developing the whole game. I have drawn the Board and the two players can play. The players numbers can fill the board, but I have problem implementing the winner for the game. I need to implement the hasWon() method for Horizontal win, Vertical win and Diagonal win. I also found some code examples on the net but I was unable to make it working. I have 5 classes and one interface which I m implementing. The main problem is how to implement the hasWon() method in the PlayGame class below with Horizontal, vertical and diagonal moves.
    Sorry there is so much code.
    This the interface I must implement, but now I am only implementing the int move() of this interface. I will implement the rest later after solving the winner problem with your help.
    Interface code..............
    interface Player {
    void init (Boolean color);
    String name ();
    int move ();
    void inform (int i);
    Player1 class......................
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    public class Player1 implements Player
    public Player1()
    public int move()
    Scanner scan = new Scanner(System.in);
    // BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in));
    int player1;
    System.out.println ("What is your Number, player 1?");
    player1 = scan.nextInt();
    System.out.println ("Hey number"+player1+" are you prepared to CONNECT FOUR");
    System.out.println();
    return player1;
    //Player.move();
    //return player1;
    }//end move method
    public void init (Boolean color)
    public void inform (int i)
    public String name()
    return "Koonda";
    }//end player1 class
    Player2 class...........................
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    public class Player2 implements Player
    public int move()
    //int cup0,cup1,cup2,cup3,cup4,cup5,cup6;
    // cup0=5;cup1=5;cup2=5;cup3=5;cup4=5;cup5=5;cup6=5;
    //int num1, num2;
    Scanner scan = new Scanner(System.in);
    // BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in));
    int player2;
    System.out.println ("What is your Number, player 2?");
    player2 = scan.nextInt();
    System.out.println ("Hey "+player2+" are you prepared to CONNECT FOUR");
    System.out.println();
    //return player1;
    return player2;
    }//end move method
    public void init (Boolean color)
    public void inform (int i)
    public String name()
    return "malook";
    }//end player1 class
    PlayGame class which contains all the functionality.........................................................
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    public class PlayGame
    //Player player1;
    //Player player2;
    int [][]ConnectFourArray;
    boolean status;
    int winner;
         int player1;
         int player2;
         public PlayGame()
              //this.player1 = player1;
              //this.player2 = player2;
         public void StartGame()
         try{
         // int X = 0, Y = 0;
         //int value;
         int cup0,cup1,cup2,cup3,cup4,cup5,cup6;
    cup0=5;cup1=5;cup2=5;cup3=5;cup4=5;cup5=5;cup6=5;
         int[][] ConnectFourArray = new int[6][7];
         int num1, num2;
         for(int limit=21;limit!=0;limit--)
    BufferedReader selecter = new BufferedReader (new InputStreamReader(System.in));
    String column1;
    System.out.println();
    for ( int row=0; row < ConnectFourArray.length; row++ ){
    System.out.print("Row " + row + ": ");
    for ( int col=0; col < ConnectFourArray[row].length; col++ )
    System.out.print( ConnectFourArray[row][col] + " ");
    System.out.println();
    System.out.println();
    System.out.println ("Please Select a column of 0 through 6 ");
    column1 = selecter.readLine();
    num1= Integer.parseInt(column1);
    System.out.println();
    if (num1==0){
    ConnectFourArray[cup0][0]=1;
    cup0=cup0-1;
    else if (num1==1){
    ConnectFourArray[cup1][1]=1;
    cup1=cup1-1;
    else if (num1==2){
    ConnectFourArray[cup2][2]=1;
    cup2=cup2-1;
    else if (num1==3){
    ConnectFourArray[cup3][3]=1;
    cup3=cup3-1;
    else if (num1==4){
    ConnectFourArray[cup4][4]=1;
    cup4=cup4-1;
    else if (num1==5){
    ConnectFourArray[cup5][5]=1;
    cup5=cup5-1;
    else if (num1==6){
    ConnectFourArray[cup6][6]=1;
    cup6=cup6-1;
    System.out.println();
    BufferedReader selecter2 = new BufferedReader (new InputStreamReader(System.in));
    String column2;
    System.out.println();
    for ( int row=0; row < ConnectFourArray.length; row++ ){
    System.out.print("Row " + row + ": ");
    for ( int col=0; col < ConnectFourArray[row].length; col++ )
    System.out.print( ConnectFourArray[row][col] + " ");
    System.out.println();
    System.out.println();
    System.out.println ("Please Select a column of 0 through 6 ");
    column1 = selecter.readLine();
    num1= Integer.parseInt(column1);
    System.out.println();
    if (num1==0){
    ConnectFourArray[cup0][0]=2;
    cup0=cup0-1;
    else if (num1==1){
    ConnectFourArray[cup1][1]=2;
    cup1=cup1-1;
    else if (num1==2){
    ConnectFourArray[cup2][2]=2;
    cup2=cup2-1;
    else if (num1==3){
    ConnectFourArray[cup3][3]=2;
    cup3=cup3-1;
    else if (num1==4){
    ConnectFourArray[cup4][4]=2;
    cup4=cup4-1;
    else if (num1==5){
    ConnectFourArray[cup5][5]=2;
    cup5=cup5-1;
    else if (num1==6){
    ConnectFourArray[cup6][6]=2;
    cup6=cup6-1;
    System.out.println();
    System.out.println();
    catch (Exception E){
    System.out.println("Error with input");
    System.out.println("Would you like to play again");
    try{
    String value;
    BufferedReader reader = new BufferedReader (new InputStreamReader(System.in));
    // Scanner scan = new Scanner(System.in);
    System.out.println("Enter yes to play or no to quit");
    // value = scan.nextLine();
    // String value2;
    value = reader.readLine();
    //value2 = reader.readLine();
    if (value.equals("yes"))
    System.out.println("Start again");
    StartGame(); // calling the StartGame method to play a game once more
    else if (value.equals("no"))
    System.out.println("No more games to play");
    // System.exit(0);
    else
    System.exit(0);
    System.out.println();
    catch (Exception e){
    System.out.println("Error with input");
    finally
    System.out.println(" playing done");
    //StartGame();
    //check for horizontal win
    public int hasWon()
    int status = 0;
    for (int row=0; row<6; row++)
    for (int col=0; col<4; col++)
    if (ConnectFourArray[col][row] != 0 &&
    ConnectFourArray[col][row] == ConnectFourArray[col+1][row] &&
    ConnectFourArray[col][row] == ConnectFourArray[col+2][row] &&
    ConnectFourArray[col][row] == ConnectFourArray[col+3][row])
    //status = true;//int winner;
    if(status == player1)
    System.out.println("Player 1 is the winner");
    else if(status == player2)
    System.out.println("Player 2 is the winner" );
    }//end inner for loop
    }// end outer for loop
    } // end method Winner
    return status;
    }//end class
    ClassConnectFour which designs the board........................
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    public class ClassConnectFour
         //Player player1;
         //Player player2;
         public ClassConnectFour()
              //this.player1 = player1;
    public void DrawBoard()
    int[][] ConnectFourArray = new int[6][7] ;
    for ( int row=0; row < ConnectFourArray.length; row++ ){
    System.out.print("Row " + row + ": ");
    for ( int col=0; col < ConnectFourArray[row].length; col++ )
    System.out.print( ConnectFourArray[row][col] + " ");
    System.out.println();
    System.out.println();
    }//end class
    TestConnetFour class which uses most of the above class..................
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    public class TestConnectFour
    public static void main(String[] args)
    ClassConnectFour cf = new ClassConnectFour();
    cf.DrawBoard();
    Player1 player1 = new Player1();
    Player2 player2 = new Player2();
    player1.move();
    player2.move();
    System.out.println("Number 1 belongs to player " + player1.name());
    System.out.println("Number 2 belongs to player " + player2.name());
    PlayGame pg = new PlayGame();
    pg.StartGame();
    pg.hasWon();
    //pg.Play();
    //System.out.println(player.name());
    //System.out.println(player2.name());
    }// end main
    }//end class
    I am sorry for all this junk code but I only understand it this way. Your urgent help is required. Looking forward to your reply.
    Thanks in advance.
    Koonda
    //

    Hi,
    Thanks for your help but I really don't understand the table lookup algorithm. Could you please send me some code to implement that.
    I will send you the formatted code as well
    Thanks for your help.
    looking forward to your reply.
    Koonda
    Hi all,
    I am a student and I have a project due 20th of this month, I mean May 20, 2007 after 8 days. The project is about creating a Connect Four Game. I have found some code examples on the internet which helped me little bit. But there are lot of problems I am facing developing the whole game. I have drawn the Board and the two players can play. The players numbers can fill the board, but I have problem implementing the winner for the game. I need to implement the hasWon() method for Horizontal win, Vertical win and Diagonal win. I also found some code examples on the net but I was unable to make it working. I have 5 classes and one interface which I m implementing. The main problem is how to implement the hasWon() method in the PlayGame class below with Horizontal, vertical and diagonal moves.
    Sorry there is so much code.
    This the interface I must implement, but now I am only implementing the int move() of this interface. I will implement the rest later after solving the winner problem with your help.
    Interface code..............
    interface Player {
    void init (Boolean color);
    String name ();
    int move ();
    void inform (int i);
    Player1 class......................
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    public class Player1 implements Player
    public Player1()
    public int move()
    Scanner scan = new Scanner(System.in);
    // BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in));
    int player1;
    System.out.println ("What is your Number, player 1?");
    player1 = scan.nextInt();
    System.out.println ("Hey number"+player1+" are you prepared to CONNECT FOUR");
    System.out.println();
    return player1;
    //Player.move();
    //return player1;
    }//end move method
    public void init (Boolean color)
    public void inform (int i)
    public String name()
    return "Koonda";
    }//end player1 class
    Player2 class...........................
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    public class Player2 implements Player
    public int move()
    //int cup0,cup1,cup2,cup3,cup4,cup5,cup6;
    // cup0=5;cup1=5;cup2=5;cup3=5;cup4=5;cup5=5;cup6=5;
    //int num1, num2;
    Scanner scan = new Scanner(System.in);
    // BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in));
    int player2;
    System.out.println ("What is your Number, player 2?");
    player2 = scan.nextInt();
    System.out.println ("Hey "+player2+" are you prepared to CONNECT FOUR");
    System.out.println();
    //return player1;
    return player2;
    }//end move method
    public void init (Boolean color)
    public void inform (int i)
    public String name()
    return "malook";
    }//end player1 class
    PlayGame class which contains all the functionality.........................................................
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    public class PlayGame
    //Player player1;
    //Player player2;
    int [][]ConnectFourArray;
    boolean status;
    int winner;
    int player1;
    int player2;
    public PlayGame()
    //this.player1 = player1;
    //this.player2 = player2;
    public void StartGame()
    try{
    // int X = 0, Y = 0;
    //int value;
    int cup0,cup1,cup2,cup3,cup4,cup5,cup6;
    cup0=5;cup1=5;cup2=5;cup3=5;cup4=5;cup5=5;cup6=5;
    int[][] ConnectFourArray = new int[6][7];
    int num1, num2;
    for(int limit=21;limit!=0;limit--)
    BufferedReader selecter = new BufferedReader (new InputStreamReader(System.in));
    String column1;
    System.out.println();
    for ( int row=0; row < ConnectFourArray.length; row++ ){
    System.out.print("Row " + row + ": ");
    for ( int col=0; col < ConnectFourArray[row].length; col++ )
    System.out.print( ConnectFourArray[row][col] + " ");
    System.out.println();
    System.out.println();
    System.out.println ("Please Select a column of 0 through 6 ");
    column1 = selecter.readLine();
    num1= Integer.parseInt(column1);
    System.out.println();
    if (num1==0){
    ConnectFourArray[cup0][0]=1;
    cup0=cup0-1;
    else if (num1==1){
    ConnectFourArray[cup1][1]=1;
    cup1=cup1-1;
    else if (num1==2){
    ConnectFourArray[cup2][2]=1;
    cup2=cup2-1;
    else if (num1==3){
    ConnectFourArray[cup3][3]=1;
    cup3=cup3-1;
    else if (num1==4){
    ConnectFourArray[cup4][4]=1;
    cup4=cup4-1;
    else if (num1==5){
    ConnectFourArray[cup5][5]=1;
    cup5=cup5-1;
    else if (num1==6){
    ConnectFourArray[cup6][6]=1;
    cup6=cup6-1;
    System.out.println();
    BufferedReader selecter2 = new BufferedReader (new InputStreamReader(System.in));
    String column2;
    System.out.println();
    for ( int row=0; row < ConnectFourArray.length; row++ ){
    System.out.print("Row " + row + ": ");
    for ( int col=0; col < ConnectFourArray[row].length; col++ )
    System.out.print( ConnectFourArray[row][col] + " ");
    System.out.println();
    System.out.println();
    System.out.println ("Please Select a column of 0 through 6 ");
    column1 = selecter.readLine();
    num1= Integer.parseInt(column1);
    System.out.println();
    if (num1==0){
    ConnectFourArray[cup0][0]=2;
    cup0=cup0-1;
    else if (num1==1){
    ConnectFourArray[cup1][1]=2;
    cup1=cup1-1;
    else if (num1==2){
    ConnectFourArray[cup2][2]=2;
    cup2=cup2-1;
    else if (num1==3){
    ConnectFourArray[cup3][3]=2;
    cup3=cup3-1;
    else if (num1==4){
    ConnectFourArray[cup4][4]=2;
    cup4=cup4-1;
    else if (num1==5){
    ConnectFourArray[cup5][5]=2;
    cup5=cup5-1;
    else if (num1==6){
    ConnectFourArray[cup6][6]=2;
    cup6=cup6-1;
    System.out.println();
    System.out.println();
    catch (Exception E){
    System.out.println("Error with input");
    System.out.println("Would you like to play again");
    try{
    String value;
    BufferedReader reader = new BufferedReader (new InputStreamReader(System.in));
    // Scanner scan = new Scanner(System.in);
    System.out.println("Enter yes to play or no to quit");
    // value = scan.nextLine();
    // String value2;
    value = reader.readLine();
    //value2 = reader.readLine();
    if (value.equals("yes"))
    System.out.println("Start again");
    StartGame(); // calling the StartGame method to play a game once more
    else if (value.equals("no"))
    System.out.println("No more games to play");
    // System.exit(0);
    else
    System.exit(0);
    System.out.println();
    catch (Exception e){
    System.out.println("Error with input");
    finally
    System.out.println(" playing done");
    //StartGame();
    //check for horizontal win
    public int hasWon()
    int status = 0;
    for (int row=0; row<6; row++)
    for (int col=0; col<4; col++)
    if (ConnectFourArray[col][row] != 0 &&
    ConnectFourArray[col][row] == ConnectFourArray[col+1][row] &&
    ConnectFourArray[col][row] == ConnectFourArray[col+2][row] &&
    ConnectFourArray[col][row] == ConnectFourArray[col+3][row])
    //status = true;//int winner;
    if(status == player1)
    System.out.println("Player 1 is the winner");
    else if(status == player2)
    System.out.println("Player 2 is the winner" );
    }//end inner for loop
    }// end outer for loop
    } // end method Winner
    return status;
    }//end class
    ClassConnectFour which designs the board........................
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    public class ClassConnectFour
    //Player player1;
    //Player player2;
    public ClassConnectFour()
    //this.player1 = player1;
    public void DrawBoard()
    int[][] ConnectFourArray = new int[6][7] ;
    for ( int row=0; row < ConnectFourArray.length; row++ ){
    System.out.print("Row " + row + ": ");
    for ( int col=0; col < ConnectFourArray[row].length; col++ )
    System.out.print( ConnectFourArray[row][col] + " ");
    System.out.println();
    System.out.println();
    }//end class
    TestConnetFour class which uses most of the above class..................
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    public class TestConnectFour
    public static void main(String[] args)
    ClassConnectFour cf = new ClassConnectFour();
    cf.DrawBoard();
    Player1 player1 = new Player1();
    Player2 player2 = new Player2();
    player1.move();
    player2.move();
    System.out.println("Number 1 belongs to player " + player1.name());
    System.out.println("Number 2 belongs to player " + player2.name());
    PlayGame pg = new PlayGame();
    pg.StartGame();
    pg.hasWon();
    //pg.Play();
    //System.out.println(player.name());
    //System.out.println(player2.name());
    }// end main
    }//end classI am sorry for all this junk code but I only understand it this way. Your urgent help is required. Looking forward to your reply.
    Thanks in advance.
    Koonda

  • Urgent help need

    hi friends,
      Help me how to do this
    REPORT  ZINTERFACE_SAMPLE.
    type-pools:SLIS.
    TABLES:knb1, "Customer Master (Company Code)
           kna1,
           knvp. "Customer Master Partner Functions
    TYPES:BEGIN OF T_knb1,
          kunnr like knb1-kunnr,
          bukrs like knb1-bukrs,
          akont like knb1-akont,
          END OF T_knb1.
    TYPES:BEGIN OF T_kna1,
          kunnr like kna1-kunnr, "customer number
          NAME1 like KNA1-NAME1, "customer name
          stras like KNA1-STRAS, "Customer address
          ort01 like KNA1-ORT01, "Customer city
          stcd1 like KNA1-STCD1, "Tax id
          pstlz like KNA1-PSTLZ, "Postal code
          END OF   T_kna1.
    TYPES:BEGIN OF T_knvp,
          kunnr like knvp-kunnr, "customer number
          parvw like knvp-parvw,
          kunn2 like knvp-kunn2, "Customer number of business partner
          END OF T_KNVP.
    TYPES:BEGIN OF T_final,
          Record_type      TYPE c,
          Sold_to_cust(10) TYPE c,
          Payer(10)        TYPE c,
          Sequence(5)      TYPE n,
          Cust_name(35)    TYPE c,
          Cust_adreess(35) TYPE c,
          Cust_city(35)    TYPE c,
          Tax_id(16)       TYPE c,
          Postal_code(5)   TYPE c,
          Branch           TYPE c,
          Delivery(3)      TYPE c,
          END OF T_final.
    *Internal table declaration
    DATA:I_knb1  TYPE STANDARD TABLE OF t_knb1  initial size 0,
         i_kna1  TYPE STANDARD TABLE OF t_kna1  initial size 0,
         i_knvp  TYPE STANDARD TABLE OF t_knvp  initial size 0,
         i_final TYPE STANDARD TABLE OF t_final initial size 0.
    DATA: t_fieldcat_tab TYPE slis_t_fieldcat_alv WITH HEADER LINE.
    *Work area declaration
    DATA:wa_knb1  TYPE t_knb1,
         wa_kna1  TYPE t_kna1,
         wa_knvp  TYPE t_knvp,
         wa_final TYPE t_final.
               *variable declaration
    data:sequence TYPe n,
         g_line TYPE i.
                    selection screen                        *
    SELECTION-screen begin of block b1 with frame title text-001.
    parameters:p_bukrs like knb1-bukrs, "Company code
               p_akont like knb1-akont .
    selection-screen end of block b1.
    SELECTION-screen begin of block b2 with frame title text-002.
    PARAMETERS:R1 RADIOBUTTON GROUP G1,
               R2 RADIOBUTTON GROUP G1.
    Parameters:p_file like rlgrap-filename.
                                       "Recon Account in General Ledger
    selection-screen end of block b2.
    *AT selection-screen ON VALUE-REQUEST FOR P_FILE.
    CALL FUNCTION 'F4_FILENAME'
       IMPORTING
         FILE_NAME = P_FILE.
    START-OF-selection.
    PERFORM f_fetchdata.
    PERFORM f_prepare_fieldcat.
    PERFORM f_display_report.
    *END-OF-SELECTION.
    *IF R1 EQ 'X'.
    *perform F_DOWNLOAD.
    *ENDIF.
    *IF R2 EQ 'X'.
    *OPEN DATASET P_FILE FOR OUTPUT IN text mode ENCODING DEFAULT.
    *LOOP AT i_final INTO WA_final.
    *TRANSFER WA_final TO P_FILE.
    *ENDLOOP.
    *CLOSE DATASET P_FILE.
    *ENDIF.
    *&      Form  f_fetchdata
    FORM f_fetchdata .
    select kunnr
           bukrs
           akont
           from knb1
           into table i_knb1
           where bukrs = p_bukrs
           AND   akont = p_akont.
    DESCRIBE TABLE i_knb1 LINES g_line.
    LOOP AT i_knb1 INTO wa_knb1.
    SELECT single KUNNR
                  NAME1
                  STRAS
                  ORT01
                  STCD1
                  PSTLZ
                  FROM kna1
                  INTO wa_kna1
                  where kunnr = wa_knb1-kunnr.
    if sy-subrc <> 0.
    *Error KNA1 record not found.
    endif.
    SELECT single kunnr
                  parvw
                  kunn2
                  FROM KNVP
                  INTO wa_knvp
                  where kunnr = wa_knb1-kunnr
                  AND parvw = 'RG'.
    if sy-subrc <> 0.
    *Error KNA1 record not found.
    endif.
    sequence = sequence + 1.
    MOVE: 'c'              TO    wa_final-Record_type,
          wa_knvp-kunnr    TO    wa_final-Sold_to_cust,
          sequence         TO    wa_final-Sequence,
          wa_KNA1-NAME1    TO    wa_final-Cust_name,
          wa_kna1-STRAS    TO    wa_final-Cust_adreess ,
          wa_kna1-ort01    TO    wa_final-Cust_city,
          wa_kna1-STCD1    TO    wa_final-Tax_id,
          wa_kna1-PSTLZ    TO    wa_final-Postal_code,
          '1'              TO    wa_final-branch,
          'abc'            TO    wa_final-Delivery.
    INSERT wa_final INTO TABLE i_final.
    endloop.
    ENDFORM.                    " f_fetchdata
    FORM f_prepare_fieldcat.
      t_fieldcat_tab-col_pos = 1.
      t_fieldcat_tab-tabname  = 'i_final'.
      t_fieldcat_tab-fieldname  = 'Record_type'.
      t_fieldcat_tab-seltext_l = 'Record type'.
      APPEND t_fieldcat_tab.
      t_fieldcat_tab-col_pos = 2.
      t_fieldcat_tab-tabname  = 'i_final'.
      t_fieldcat_tab-fieldname  = 'Sold_to_cust'.
      t_fieldcat_tab-seltext_l = 'Sold to cust'.
      APPEND t_fieldcat_tab.
      t_fieldcat_tab-col_pos = 3.
      t_fieldcat_tab-tabname  = 'i_final'.
      t_fieldcat_tab-fieldname  = 'payer'.
      t_fieldcat_tab-seltext_l = 'Payer'.
      APPEND t_fieldcat_tab.
      t_fieldcat_tab-col_pos = 4.
      t_fieldcat_tab-tabname  = 'i_final'.
      t_fieldcat_tab-fieldname  = 'Sequence'.
      t_fieldcat_tab-seltext_l = 'sequence'.
      APPEND t_fieldcat_tab.
      t_fieldcat_tab-col_pos = 5.
      t_fieldcat_tab-tabname  = 'i_final'.
      t_fieldcat_tab-fieldname  = 'Cust_name'.
      t_fieldcat_tab-seltext_l = 'Cust name'.
      APPEND t_fieldcat_tab.
      t_fieldcat_tab-col_pos = 6.
      t_fieldcat_tab-tabname  = 'i_final'.
      t_fieldcat_tab-fieldname  = 'Cust_adreess'.
      t_fieldcat_tab-seltext_l = 'Cust adreess'.
      APPEND t_fieldcat_tab.
      t_fieldcat_tab-col_pos = 7.
      t_fieldcat_tab-tabname  = 'i_final'.
      t_fieldcat_tab-fieldname  = 'Cust_city'.
      t_fieldcat_tab-seltext_l = 'Cust city'.
      APPEND t_fieldcat_tab.
      t_fieldcat_tab-col_pos = 8.
      t_fieldcat_tab-tabname  = 'i_final'.
      t_fieldcat_tab-fieldname  = 'Tax_id'.
      t_fieldcat_tab-seltext_l = 'Tax id'.
      APPEND t_fieldcat_tab.
      t_fieldcat_tab-col_pos = 9.
      t_fieldcat_tab-tabname  = 'i_final'.
      t_fieldcat_tab-fieldname  = 'Postal_code'.
      t_fieldcat_tab-seltext_l = 'Postal code'.
      APPEND t_fieldcat_tab.
      t_fieldcat_tab-col_pos = 10.
      t_fieldcat_tab-tabname  = 'i_final'.
      t_fieldcat_tab-fieldname  = 'Branch'.
      t_fieldcat_tab-seltext_l = 'Branch'.
      APPEND t_fieldcat_tab.
      t_fieldcat_tab-col_pos = 11.
      t_fieldcat_tab-tabname  = 'i_final'.
      t_fieldcat_tab-fieldname  = 'KWMENG'.
      t_fieldcat_tab-seltext_l = 'Order Qty'.
      APPEND t_fieldcat_tab.
      t_fieldcat_tab-col_pos = 12.
      t_fieldcat_tab-tabname  = 'i_final'.
      t_fieldcat_tab-fieldname  = 'Delivery'.
      t_fieldcat_tab-seltext_l = 'Delivery'.
      APPEND t_fieldcat_tab.
      ENDFORM.                    " f_prepare_fieldcat
    *&      Form  f_display_report
    *To display the ALV Report
    FORM f_display_report.
      DATA: l_repid LIKE sy-repid.
      l_repid = sy-repid.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
           EXPORTING
                   I_CALLBACK_PROGRAM  = l_repid
                   i_buffer_active     = 'X'
                   IT_FIELDCAT         = t_fieldcat_tab[]
                   I_DEFAULT           = 'X'
                   I_SAVE              = 'A'
             TABLES
                   T_OUTTAB            = i_final[].
            EXCEPTIONS
                  PROGRAM_ERROR                  = 1
                  OTHERS                         = 2
              IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
             ENDIF.
              ENDFORM." f_display_report
    *&      Form  F_DOWNLOAD
          text
    -->  p1        text
    <--  p2        text
    FORM F_DOWNLOAD .
    *CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
      FILENAME                      = p_file
      FILETYPE                      = 'ASC'
      MODE                          = ' '
      WK1_N_FORMAT                  = ' '
      WK1_N_SIZE                    = ' '
      WK1_T_FORMAT                  = ' '
      WK1_T_SIZE                    = ' '
      COL_SELECT                    = ' '
      COL_SELECTMASK                = ' '
      NO_AUTH_CHECK                 = ' '
    IMPORTING
      FILELENGTH                    =
    TABLES
       DATA_TAB                      = i_final
    EXCEPTIONS
      FILE_OPEN_ERROR               = 1
      FILE_WRITE_ERROR              = 2
      INVALID_FILESIZE              = 3
      INVALID_TYPE                  = 4
      NO_BATCH                      = 5
      UNKNOWN_ERROR                 = 6
      INVALID_TABLE_WIDTH           = 7
      GUI_REFUSE_FILETRANSFER       = 8
      CUSTOMER_ERROR                = 9
      NO_AUTHORITY                  = 10
      OTHERS                        = 11
    *IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    *ENDIF.
    ENDFORM.                    " F_DOWNLOAD
    for this one when i given the proper input
    it showing the Runtime error.
    Could u please tell me what mistake i have done
    Urgent help
    Regards
    harshavi N.

    HI,
    Run this program..
    REPORT ZINTERFACE_SAMPLE.
    type-pools:SLIS.
    TABLES:knb1, "Customer Master (Company Code)
    kna1,
    knvp. "Customer Master Partner Functions
    TYPES:BEGIN OF T_knb1,
    kunnr like knb1-kunnr,
    bukrs like knb1-bukrs,
    akont like knb1-akont,
    END OF T_knb1.
    TYPES:BEGIN OF T_kna1,
    kunnr like kna1-kunnr, "customer number
    NAME1 like KNA1-NAME1, "customer name
    stras like KNA1-STRAS, "Customer address
    ort01 like KNA1-ORT01, "Customer city
    stcd1 like KNA1-STCD1, "Tax id
    pstlz like KNA1-PSTLZ, "Postal code
    END OF T_kna1.
    TYPES:BEGIN OF T_knvp,
    kunnr like knvp-kunnr, "customer number
    parvw like knvp-parvw,
    kunn2 like knvp-kunn2, "Customer number of business partner
    END OF T_KNVP.
    TYPES:BEGIN OF T_final,
    Record_type TYPE c,
    Sold_to_cust(10) TYPE c,
    Payer(10) TYPE c,
    Sequence(5) TYPE n,
    Cust_name(35) TYPE c,
    Cust_adreess(35) TYPE c,
    Cust_city(35) TYPE c,
    Tax_id(16) TYPE c,
    Postal_code(5) TYPE c,
    Branch TYPE c,
    Delivery(3) TYPE c,
    END OF T_final.
    *Internal table declaration
    DATA:I_knb1 TYPE STANDARD TABLE OF t_knb1 initial size 0,
    i_kna1 TYPE STANDARD TABLE OF t_kna1 initial size 0,
    i_knvp TYPE STANDARD TABLE OF t_knvp initial size 0,
    i_final TYPE STANDARD TABLE OF t_final initial size 0.
    DATA: t_fieldcat_tab TYPE slis_t_fieldcat_alv WITH HEADER LINE.
    *Work area declaration
    DATA:wa_knb1 TYPE t_knb1,
    wa_kna1 TYPE t_kna1,
    wa_knvp TYPE t_knvp,
    wa_final TYPE t_final.
    *variable declaration
    data:sequence TYPe n,
    g_line TYPE i.
    selection screen *
    SELECTION-screen begin of block b1 with frame title text-001.
    parameters:p_bukrs like knb1-bukrs, "Company code
    p_akont like knb1-akont .
    selection-screen end of block b1.
    SELECTION-screen begin of block b2 with frame title text-002.
    PARAMETERS:R1 RADIOBUTTON GROUP G1,
    R2 RADIOBUTTON GROUP G1.
    Parameters:p_file like rlgrap-filename.
    "Recon Account in General Ledger
    selection-screen end of block b2.
    *AT selection-screen ON VALUE-REQUEST FOR P_FILE.
    CALL FUNCTION 'F4_FILENAME'
    IMPORTING
    FILE_NAME = P_FILE.
    START-OF-selection.
    PERFORM f_fetchdata.
    PERFORM f_prepare_fieldcat.
    PERFORM f_display_report.
    *END-OF-SELECTION.
    *IF R1 EQ 'X'.
    *perform F_DOWNLOAD.
    *ENDIF.
    *IF R2 EQ 'X'.
    *OPEN DATASET P_FILE FOR OUTPUT IN text mode ENCODING DEFAULT.
    *LOOP AT i_final INTO WA_final.
    *TRANSFER WA_final TO P_FILE.
    *ENDLOOP.
    *CLOSE DATASET P_FILE.
    *ENDIF.
    *& Form f_fetchdata
    FORM f_fetchdata .
    select kunnr
    bukrs
    akont
    from knb1
    into table i_knb1
    where bukrs = p_bukrs
    AND akont = p_akont.
    DESCRIBE TABLE i_knb1 LINES g_line.
    LOOP AT i_knb1 INTO wa_knb1.
    SELECT single KUNNR
    NAME1
    STRAS
    ORT01
    STCD1
    PSTLZ
    FROM kna1
    INTO wa_kna1
    where kunnr = wa_knb1-kunnr.
    if sy-subrc <> 0.
    *Error KNA1 record not found.
    endif.
    SELECT single kunnr
    parvw
    kunn2
    FROM KNVP
    INTO wa_knvp
    where kunnr = wa_knb1-kunnr
    AND parvw = 'RG'.
    if sy-subrc <> 0.
    *Error KNA1 record not found.
    endif.
    sequence = sequence + 1.
    MOVE: 'c' TO wa_final-Record_type,
    wa_knvp-kunnr TO wa_final-Sold_to_cust,
    sequence TO wa_final-Sequence,
    wa_KNA1-NAME1 TO wa_final-Cust_name,
    wa_kna1-STRAS TO wa_final-Cust_adreess ,
    wa_kna1-ort01 TO wa_final-Cust_city,
    wa_kna1-STCD1 TO wa_final-Tax_id,
    wa_kna1-PSTLZ TO wa_final-Postal_code,
    '1' TO wa_final-branch,
    'abc' TO wa_final-Delivery.
    INSERT wa_final INTO TABLE i_final.
    endloop.
    ENDFORM. " f_fetchdata
    FORM f_prepare_fieldcat.
    t_fieldcat_tab-col_pos = 1.
    t_fieldcat_tab-tabname = 'I_FINAL'.
    t_fieldcat_tab-fieldname = 'RECORD_TYPE'.
    t_fieldcat_tab-seltext_l = 'Record type'.
    APPEND t_fieldcat_tab.
    t_fieldcat_tab-col_pos = 2.
    t_fieldcat_tab-tabname = 'I_FINAL'.
    t_fieldcat_tab-fieldname = 'SOLD_TO_CUST'.
    t_fieldcat_tab-seltext_l = 'Sold to cust'.
    APPEND t_fieldcat_tab.
    t_fieldcat_tab-col_pos = 3.
    t_fieldcat_tab-tabname = 'I_FINAL'.
    t_fieldcat_tab-fieldname = 'PAYER'.
    t_fieldcat_tab-seltext_l = 'Payer'.
    APPEND t_fieldcat_tab.
    t_fieldcat_tab-col_pos = 4.
    t_fieldcat_tab-tabname = 'I_FINAL'.
    t_fieldcat_tab-fieldname = 'SEQUENCE'.
    t_fieldcat_tab-seltext_l = 'sequence'.
    APPEND t_fieldcat_tab.
    t_fieldcat_tab-col_pos = 5.
    t_fieldcat_tab-tabname = 'I_FINAL'.
    t_fieldcat_tab-fieldname = 'CUST_NAME'.
    t_fieldcat_tab-seltext_l = 'Cust name'.
    APPEND t_fieldcat_tab.
    t_fieldcat_tab-col_pos = 6.
    t_fieldcat_tab-tabname = 'I_FINAL'.
    t_fieldcat_tab-fieldname = 'CUST_ADREESS'.
    t_fieldcat_tab-seltext_l = 'Cust adreess'.
    APPEND t_fieldcat_tab.
    t_fieldcat_tab-col_pos = 7.
    t_fieldcat_tab-tabname = 'I_FINAL'.
    t_fieldcat_tab-fieldname = 'CUST_CITY'.
    t_fieldcat_tab-seltext_l = 'Cust city'.
    APPEND t_fieldcat_tab.
    t_fieldcat_tab-col_pos = 8.
    t_fieldcat_tab-tabname = 'I_FINAL'.
    t_fieldcat_tab-fieldname = 'TAX_ID'.
    t_fieldcat_tab-seltext_l = 'Tax id'.
    APPEND t_fieldcat_tab.
    t_fieldcat_tab-col_pos = 9.
    t_fieldcat_tab-tabname = 'I_FINAL'.
    t_fieldcat_tab-fieldname = 'POSTAL_CODE'.
    t_fieldcat_tab-seltext_l = 'Postal code'.
    APPEND t_fieldcat_tab.
    t_fieldcat_tab-col_pos = 10.
    t_fieldcat_tab-tabname = 'I_FINAL'.
    t_fieldcat_tab-fieldname = 'BRANCH'.
    t_fieldcat_tab-seltext_l = 'Branch'.
    APPEND t_fieldcat_tab.
    t_fieldcat_tab-col_pos = 11.
    t_fieldcat_tab-tabname = 'I_FINAL'.
    t_fieldcat_tab-fieldname = 'KWMENG'.
    t_fieldcat_tab-seltext_l = 'Order Qty'.
    APPEND t_fieldcat_tab.
    t_fieldcat_tab-col_pos = 12.
    t_fieldcat_tab-tabname = 'I_FINAL'.
    t_fieldcat_tab-fieldname = 'DELIVERY'.
    t_fieldcat_tab-seltext_l = 'Delivery'.
    APPEND t_fieldcat_tab.
    ENDFORM. " f_prepare_fieldcat
    *& Form f_display_report
    *To display the ALV Report
    FORM f_display_report.
    DATA: l_repid LIKE sy-repid.
    l_repid = sy-repid.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = l_repid
    IT_FIELDCAT = t_fieldcat_tab[]
    I_DEFAULT = 'X'
    I_SAVE = 'A'
    TABLES
    T_OUTTAB = I_FINAL[].
    EXCEPTIONS
    PROGRAM_ERROR = 1
    OTHERS = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM." f_display_report
    *& Form F_DOWNLOAD
    text
    --> p1 text
    <-- p2 text
    FORM F_DOWNLOAD .
    *CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
    FILENAME = p_file
    FILETYPE = 'ASC'
    MODE = ' '
    WK1_N_FORMAT = ' '
    WK1_N_SIZE = ' '
    WK1_T_FORMAT = ' '
    WK1_T_SIZE = ' '
    COL_SELECT = ' '
    COL_SELECTMASK = ' '
    NO_AUTH_CHECK = ' '
    IMPORTING
    FILELENGTH =
    TABLES
    DATA_TAB = i_final
    EXCEPTIONS
    FILE_OPEN_ERROR = 1
    FILE_WRITE_ERROR = 2
    INVALID_FILESIZE = 3
    INVALID_TYPE = 4
    NO_BATCH = 5
    UNKNOWN_ERROR = 6
    INVALID_TABLE_WIDTH = 7
    GUI_REFUSE_FILETRANSFER = 8
    CUSTOMER_ERROR = 9
    NO_AUTHORITY = 10
    OTHERS = 11
    *IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    *ENDIF.
    ENDFORM. " F_DOWNLOAD
    It is perfectly working for me..
    I made the field name and table name as CAPs in the field catalog internal table.
    I removed the buffer paramter in the ALV FM.
    Thanks,
    Naren

  • Urgent help in coding of creating New Business partner?

    Hi Friends,
    I need urgent help on this.Please give me the solution.
    This is the coding which i written for creating new BP.
    FUNCTION ZCTS_NEW_CONTACT.
    ""Local interface:
    *"  IMPORTING
    *"     VALUE(BUSINESSPARTNER) LIKE  BAPIBUS1006_HEAD-BPARTNER
    *"     VALUE(CNEWINFO) TYPE  ZCTS_CONTACTS
    *"     VALUE(CDATA) LIKE  BAPIBUS1006_CENTRAL STRUCTURE
    *"        BAPIBUS1006_CENTRAL
    *"     VALUE(BUSPART1) LIKE  BAPIBUS1006_RELHEAD-BUSINESSPARTNER1
    *"     VALUE(BUSPART2) LIKE  BAPIBUS1006_RELHEAD-BUSINESSPARTNER2
    *"     VALUE(RELCAT) LIKE  BAPIBUS1006_RELHEAD-RELATIONSHIPCATEGORY
    *"  EXPORTING
    *"     VALUE(MESG) TYPE  CHAR100
    DATA: lt_return like bapiret2 occurs 0 with Header line.
    DATA: CTPERS  LIKE BAPIBUS1006_CENTRAL_PERSON OCCURS 0 WITH HEADER LINE.
    DATA : PARTN_GRP TYPE BAPIBUS1006_HEAD-PARTN_GRP.
    DATA : PARTN_CAT TYPE BAPIBUS1006_HEAD-PARTN_CAT.
    DATA: BEGIN OF ADADD.
       INCLUDE STRUCTURE BAPIBUS1006_ADDRESS.
      DATA: END OF ADADD.
    DATA: BEGIN OF ADTEL OCCURS 0.
       INCLUDE STRUCTURE BAPIADTEL.
      DATA: END OF ADTEL.
    DATA: BEGIN OF ADSMP OCCURS 0.
       INCLUDE STRUCTURE BAPIADSMTP.
      DATA: END OF ADSMP.
    CTPERS-FIRSTNAME  = CNEWINFO-FNAME.
    CTPERS-LASTNAME   = CNEWINFO-LNAME.
    PARTN_CAT = 1.
    PARTN_GRP = 002.
    ADADD-CITY = CNEWINFO-CITY .
    telephone info **
      ADTEL-TELEPHONE = CNEWINFO-PHONE.
      ADTEL-CONSNUMBER = '001'.
      APPEND ADTEL.
      ADTEL-TELEPHONE = CNEWINFO-MOBILE.
      ADTEL-CONSNUMBER = '002'.
      APPEND ADTEL.
    email information **
      ADSMP-E_MAIL = CNEWINFO-EMAIL .
      APPEND ADSMP.
    CALL FUNCTION 'BAPI_BUPA_CREATE_FROM_DATA'
      EXPORTING
        PARTNERCATEGORY                    = PARTN_CAT
        CENTRALDATA                        = CDATA
        PARTNERGROUP                       = PARTN_GRP
        CENTRALDATAPERSON                  = CTPERS
        ADDRESSDATA                        = ADADD
    IMPORTING
       BUSINESSPARTNER                    = BUsinessPartner
    TABLES
        TELEFONDATA                        = ADTEL
        E_MAILDATA                         = ADSMP
        RETURN                             = lt_return.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
         WAIT = 'X'.
    *PARTN_CAT = 1.
    *PARTN_GRP = 002.
    *ADADD-CITY = CNEWINFO-CITY .
    telephone info **
    ADTEL-TELEPHONE = CNEWINFO-PHONE.
    ADTEL-CONSNUMBER = '001'.
    APPEND ADTEL.
    ADTEL-TELEPHONE = CNEWINFO-MOBILE.
    ADTEL-CONSNUMBER = '002'.
    APPEND ADTEL.
    email information **
    ADSMP-E_MAIL = CNEWINFO-EMAIL .
    APPEND ADSMP.
    CALL FUNCTION 'BAPI_BUPR_PFCT_CREATEFROMDATA'
          EXPORTING
            BUSINESSPARTNER1           = BUSPART1
            BUSINESSPARTNER2           = BUSPART2
            RELATIONSHIPCATEGORY       = RELCAT
         TABLES
           RETURN                     = lt_return.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
         WAIT = 'X'.
    LOOP AT lt_return WHERE TYPE = 'E'.
        MESG = ' NOT CREATED NEW CONTACT'(020).
        EXIT.
      ENDLOOP.
    ENDFUNCTION.
    Early reply is highly appriciable.
    Regards,
    BONA

    Hi,
    Thanks for early reply.
    When i tested created new BP.
    Wheni check wether it is created or not its not created.
    What is the problem.is there modifications i have to do int he coding.
    Thanks,
    BONA.

  • Urgent help need on swing problem

    Dear friends,
    I met a problem and need urgent help from guru here, I am Swing newbie,
    I have following code and hope to draw lines between any two components at RUN-TIME, not at design time
    Please throw some skeleton code, Thanks so much!!
    code:
    package com.swing.test;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class LongguConnectLineCommponent
        public static void main(String[] args)
            JFrame f = new JFrame("Connecting Lines");
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(new ConnectionPanel());
            f.setSize(400,300);
            f.setLocation(200,200);
            f.setVisible(true);
    class ConnectionPanel extends JPanel
        JLabel label1, label2, label3, label4;
        JLabel[] labels;
        JLabel selectedLabel;
        int cx, cy;
        public ConnectionPanel()
            setLayout(null);
            addLabels();
            label1.setBounds( 25,  50, 125, 25);
            label2.setBounds(225,  50, 125, 25);
            label3.setBounds( 25, 175, 125, 25);
            label4.setBounds(225, 175, 125, 25);
            determineCenterOfComponents();
            ComponentMover mover = new ComponentMover();
            addMouseListener(mover);
            addMouseMotionListener(mover);
        public void paintComponent(Graphics g)
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                RenderingHints.VALUE_ANTIALIAS_ON);
            Point[] p;
            for(int i = 0; i < labels.length; i++)
                for(int j = i + 1; j < labels.length; j++)
                    p = getEndPoints(labels, labels[j]);
    //g2.draw(new Line2D.Double(p[0], p[1]));
    private Point[] getEndPoints(Component c1, Component c2)
    Point
    p1 = new Point(),
    p2 = new Point();
    Rectangle
    r1 = c1.getBounds(),
    r2 = c2.getBounds();
    int direction = r1.outcode(r2.x, r2.y);
    switch(direction) // r2 located < direction > of r1
    case (Rectangle.OUT_LEFT): // West
    p1.x = r1.x;
    p1.y = r1.y;
    p2.x = r2.x + r2.width;
    p2.y = r2.y;
    if(r1.y > cy)
    p1.y = r1.y + r1.height;
    p2.y = r2.y + r2.height;
    break;
    case (Rectangle.OUT_TOP): // North
    p1.x = r1.x;
    p1.y = r1.y;
    p2.x = r2.x;
    p2.y = r2.y + r2.height;
    if(r1.x > cx && r2.x > cx)
    p1.x = r1.x + r1.width;
    p2.x = r2.x + r2.width;
    break;
    case (Rectangle.OUT_LEFT + Rectangle.OUT_TOP): // NW
    p1.x = r1.x;
    p1.y = r1.y;
    p2.x = r2.x + r2.width;
    p2.y = r2.y;
    if(r1.y > r2.y + r2.height)
    p2.y = r2.y + r2.height;
    break;
    case (Rectangle.OUT_RIGHT): // East
    p1.x = r1.x + r1.width;
    p1.y = r1.y;
    p2.x = r2.x;
    p2.y = r2.y;
    if(r1.y > cy)
    p1.y = r1.y + r1.height;
    p2.y = r2.y + r2.height;
    break;
    case (Rectangle.OUT_TOP + Rectangle.OUT_RIGHT): // NE
    p1.x = r1.x + r1.width;
    p1.y = r1.y;
    p2.x = r2.x;
    p2.y = r2.y;
    if(r1.y > cy)
    p1.y = r1.y + r1.height;
    p2.y = r2.y + r2.height;
    if(r1.y > r2.y + r2.height)
    p1.y = r1.y;
    else
    if(r1.y > r2.y + r2.height)
    p2.y = r2.y + r2.height;
    break;
    case (Rectangle.OUT_BOTTOM): // South
    p1.x = r1.x;
    p1.y = r1.y + r1.height;
    p2.x = r2.x;
    p2.y = r2.y;
    if(r1.x > cx && r2.x > cx)
    p1.x = r1.x + r1.width;
    p2.x = r2.x + r2.width;
    break;
    case (Rectangle.OUT_RIGHT + Rectangle.OUT_BOTTOM): // SE
    p1.x = r1.x + r1.width;
    p1.y = r1.y + r1.height;
    p2.x = r2.x;
    p2.y = r2.y;
    break;
    case (Rectangle.OUT_BOTTOM + Rectangle.OUT_LEFT): // SW
    p1.x = r1.x;
    p1.y = r1.y + r1.height;
    p2.x = r2.x;
    p2.y = r2.y;
    if(r1.x > r2.x + r2.width)
    p2.x = r2.x + r2.width;
    if(r1.x > cx && r2.x > cx)
    p1.x = r1.x + r1.width;
    p2.x = r2.x + r2.width;
    return new Point[] {p1, p2};
    private void determineCenterOfComponents()
    int
    xMin = Integer.MAX_VALUE,
    yMin = Integer.MAX_VALUE,
    xMax = 0,
    yMax = 0;
    for(int i = 0; i < labels.length; i++)
    Rectangle r = labels[i].getBounds();
    if(r.x < xMin)
    xMin = r.x;
    if(r.y < yMin)
    yMin = r.y;
    if(r.x + r.width > xMax)
    xMax = r.x + r.width;
    if(r.y + r.height > yMax)
    yMax = r.y + r.height;
    cx = xMin + (xMax - xMin)/2;
    cy = yMin + (yMax - yMin)/2;
    private class ComponentMover extends MouseInputAdapter
    Point offsetP = new Point();
    boolean dragging;
    public void mousePressed(MouseEvent e)
    Point p = e.getPoint();
    for(int i = 0; i < labels.length; i++)
    Rectangle r = labels[i].getBounds();
    if(r.contains(p))
    selectedLabel = labels[i];
    offsetP.x = p.x - r.x;
    offsetP.y = p.y - r.y;
    dragging = true;
    break;
    public void mouseReleased(MouseEvent e)
    dragging = false;
    public void mouseDragged(MouseEvent e)
    if(dragging)
    Rectangle r = selectedLabel.getBounds();
    r.x = e.getX() - offsetP.x;
    r.y = e.getY() - offsetP.y;
    selectedLabel.setBounds(r.x, r.y, r.width, r.height);
    determineCenterOfComponents();
    repaint();
    private void addLabels()
    label1 = new JLabel("Label 1");
    label2 = new JLabel("Label 2");
    label3 = new JLabel("Label 3");
    label4 = new JLabel("Label 4");
    labels = new JLabel[] {
    label1, label2, label3, label4
    for(int i = 0; i < labels.length; i++)
    labels[i].setHorizontalAlignment(SwingConstants.CENTER);
    labels[i].setBorder(BorderFactory.createEtchedBorder());
    add(labels[i]);

    If you need some help, be respectful of the forum rules and people will help. By using "urgent" in the title and bumping your message every 2 hours you're just asking to be ignored (which is what you ended up with).

  • Your urgent help will be very much appreciated

    I have a problem whenever I connect my database and need your urgent help. the sample source code is below
    import java.sql.*;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    public class Table extends JFrame
    private Connection con;
    private JTable table;
    public Table()
         String url = "jdbc:odbc:Books";
         String username="";
         String password="";
         try{
         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         con = DriverManager.getConnection(url, username, password);
         catch(ClassNotFoundException cnfex)
         System.err.println("Failed to load JDBC/ODBC driver.");
         cnfex.printStackTrace();
         System.exit(1);
         catch(SQLException sqlex)
         System.err.println("Failed to connect");
         sqlex.printStackTrace();
         getTable();
         setSize(45,150);
         show();
    public void getTable()
         Statement state;
         ResultSet result;
         try{
         String query="Select * from Author";
         state=con.createStatement();
         result=state.executeQuery(query);
         displayResult(result);
         state.close();
         catch(SQLException sqlex)
         sqlex.printStackTrace();
    public void displayResult(ResultSet rs)throws SQLException
    boolean moreRecord=rs.next();
    if (!moreRecord)
    JOptionPane.showMessageDialog(this, "ResultSet contained no record");
    setTitle("No records to display");
    return;
    setTitle("Author table from Books");
    Vector columnHeads=new Vector();
    Vector rows=new Vector();
    try{
    ResultSetMetaData rsmd=rs.getMetaData();
    for (int i=1; i<=rsmd.getColumnCount(); i++)
    columnHeads.addElement(rsmd.getColumnName(i));
    do{
    rows.addElement(getNextRow(rs, rsmd));
    }while(rs.next());
    table=new JTable(rows, columnHeads);
    JScrollPane scroller=new JScrollPane(table);
    getContentPane().add(scroller,BorderLayout.CENTER);
    validate();
    catch(SQLException sqlex)
    sqlex.printStackTrace();
    public Vector getNextRow(ResultSet rs, ResultSetMetaData rsmd)
              throws SQLException
    Vector currentRow=new Vector();
    for (int i=1; i<=rsmd.getColumnCount(); i++)
    switch (rsmd.getColumnType(i))
    case Types.VARCHAR:
         currentRow.addElement(rs.getString(i));
         break;
         case Types.INTEGER:
         currentRow.addElement(new Long(rs.getLong(i)));
         break;
    default:
    System.out.println("Type was: "+rsmd.getColumnTypeName(i));
    return currentRow;
    public void shutDown()
         try{
         con.close();
         catch(SQLException sqlex)
         System.err.println("Unable to disconnect");
         sqlex.printStackTrace();
    public static void main(String args[])
         final Table app=new Table();
         app.addWindowListener( new WindowAdapter()
         public void windowClosing(WindowEvent e)
              app.shutDown();
              System.exit(0);

    Thank you for your help. When I compile it, it is fine, the problem happens when run it.
    Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x6d448d54
    Function name=(N/A)
    Library=C:\Program Files\JavaSoft\JRE\1.3.1_05\bin\hotspot\jvm.dll
    NOTE: We are unable to locate the function name symbol for the error
    just occurred. Please refer to release documentation for possible
    reason and solutions.
    Current Java thread:
    at sun.jdbc.odbc.JdbcOdbc.driverConnect(Native Method)
    at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcConnection.initialize(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcDriver.connect(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at Table.<init>(Table.java:26)
    at Table.main(Table.java:145)
    Dynamic libraries:
    0x00400000 - 0x00405000 C:\WINNT\system32\java.exe
    0x77F80000 - 0x77FFB000 C:\WINNT\System32\ntdll.dll
    0x77D90000 - 0x77DED000 C:\WINNT\system32\ADVAPI32.dll
    0x77E60000 - 0x77F35000 C:\WINNT\system32\KERNEL32.DLL
    0x786F0000 - 0x78761000 C:\WINNT\system32\RPCRT4.DLL
    0x78000000 - 0x78046000 C:\WINNT\system32\MSVCRT.dll
    0x60000000 - 0x6003A000 c:\program files\rising\rav\ApiHook.dll
    0x05000000 - 0x0502E000 c:\program files\rising\rav\MemMon.dll
    0x77DF0000 - 0x77E55000 C:\WINNT\system32\USER32.dll
    0x77F40000 - 0x77F7C000 C:\WINNT\system32\GDI32.DLL
    0x75E00000 - 0x75E1A000 C:\WINNT\System32\IMM32.DLL
    0x6D420000 - 0x6D4F7000 C:\Program Files\JavaSoft\JRE\1.3.1_05\bin\hotsp
    ot\jvm.dll
    0x77530000 - 0x77560000 C:\WINNT\system32\WINMM.dll
    0x6D220000 - 0x6D227000 C:\Program Files\JavaSoft\JRE\1.3.1_05\bin\hpi.d
    ll
    0x6D3B0000 - 0x6D3BD000 C:\Program Files\JavaSoft\JRE\1.3.1_05\bin\verif
    y.dll
    0x6D250000 - 0x6D266000 C:\Program Files\JavaSoft\JRE\1.3.1_05\bin\java.
    dll
    0x6D3C0000 - 0x6D3CD000 C:\Program Files\JavaSoft\JRE\1.3.1_05\bin\zip.d
    ll
    0x6D020000 - 0x6D12A000 C:\Program Files\JavaSoft\JRE\1.3.1_05\bin\awt.d
    ll
    0x777C0000 - 0x777DE000 C:\WINNT\system32\WINSPOOL.DRV
    0x75010000 - 0x75020000 C:\WINNT\system32\MPR.DLL
    0x77A30000 - 0x77B25000 C:\WINNT\system32\ole32.dll
    0x6D1E0000 - 0x6D21B000 C:\Program Files\JavaSoft\JRE\1.3.1_05\bin\fontm
    anager.dll
    0x6DD30000 - 0x6DD36000 C:\WINNT\System32\INDICDLL.dll
    0x37210000 - 0x3723D000 C:\WINNT\DOWNLO~1\CnsMin.dll
    0x77C50000 - 0x77C9A000 C:\WINNT\system32\SHLWAPI.dll
    0x777E0000 - 0x777E7000 C:\WINNT\system32\VERSION.dll
    0x75950000 - 0x75956000 C:\WINNT\system32\LZ32.DLL
    0x6D290000 - 0x6D29A000 C:\Program Files\JavaSoft\JRE\1.3.1_05\bin\JdbcO
    dbc.dll
    0x1F7F0000 - 0x1F825000 C:\WINNT\system32\ODBC32.dll
    0x76AF0000 - 0x76B2D000 C:\WINNT\system32\comdlg32.dll
    0x77B30000 - 0x77BB9000 C:\WINNT\system32\COMCTL32.DLL
    0x78F90000 - 0x791D6000 C:\WINNT\system32\SHELL32.DLL
    0x1F8E0000 - 0x1F8F6000 C:\WINNT\system32\odbcint.dll
    0x77900000 - 0x77923000 C:\WINNT\system32\imagehlp.dll
    0x72960000 - 0x7298D000 C:\WINNT\system32\DBGHELP.dll
    0x687E0000 - 0x687EB000 C:\WINNT\system32\PSAPI.DLL
    Local Time = Tue Feb 25 21:33:38 2003
    Elapsed Time = 7
    # HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION
    # Error ID : 4F530E43505002BD
    # Please report this error at
    # http://java.sun.com/cgi-bin/bugreport.cgi
    # Java VM: Java HotSpot(TM) Client VM (1.3.1_05-b02 mixed mode)
    # An error report file has been saved as hs_err_pid1792.log.
    # Please refer to the file for further information.
    #

  • Urgent help with Pages 5.0 needed

    Hi guys,
    I need urgent help! I deleted Pages 5.0 (as I HATED it) but now can't open a very important document. Can someone please tell me how to reinstall it??
    Thanks
    Kellie

    Downloading again is not as easy as that. you must find the app in the "Purchased" section of the
    app store and I think you then must hold down the option key to reinstall it.
    BTW, I only worked with one document as a trial for Pages 5 and then imported it to Word and saved it. I then deleted Pages 5 (I can't believe anyone who works with software would think that piece of worthless junk would sufice for anyone who uses a word processor professionally), reopened the Word document and saved it in Pages 09.
    I hope this helps

Maybe you are looking for