Urgent help on select

Hi there,
This may be simple but I am a novice in CF...so please help.
I am trying to get frequesntly asked questions from a
database and display them on a cf page and once the user clicks on
the question, it takes them to the answer section...and probably
add a link back to top .
Could someone help? Thanks
I am able to do a select query from the database!!
Thanks

<a name="#TOP">FAQS</a>
<cfoutput query="FAQS">
<a href="###answerID#">#Question#</a><br>
</cfoutput>
<Cfoutput query="FAQS">
<a name="#answerID#">#Answer#<br>
<a href="##TOP">Back to
Questions</a><br><br>
</cfoutput>
Not tested, but close.

Similar Messages

  • I moved from an old macbook to a new one.  I copied all my files onto a hard drive.  On trying to setup my mail, i went into documents, microsoft user identities, office 2011 and it shows the database but wont let me select it.  Urgent help pls

    I moved from an old macbook to a new one.  I have installed Office for Mac 2011. I copied all my files from my old notebook onto a hard drive.  On trying to setup my mail, i went into my hard drive and accessed microsoft user identities, office 2011 and it shows the database but wont let me select it.  Its almost as if the file is there but not accessable.  I desperately need to access my old mail.  How do I do this?  I am fairly confident that I copied all files off my old notebook.  Is there a way for me to search for the Database file?  Maybe I copied it to a different location?  Urgent help please.

    Hello mafrerichs and welcome to Apple Support Communities,
    Simplest way is to use Target Disk mode:
    How to use and troubleshoot FireWire target disk mode - Apple Support
    and hook to another Mac and use CCC or SuperDuper and clone your HD to another drive.
    You could also pull the drive out of your MBP and use an external USB case or SATA - USB dongle to hook it to another Mac.
    "MacBook Pro (15-inch Late 2011),... have a 15" 2012 Macbook pro with 2gb of ram, i7 processor"
    That's a little confusing?

  • Restricting values F4 help in selection screen-Urgent

    Hi,
    can anyone pls tell how can I ristrict the values for search help in any field in selection screen.
    please tell me the way to hide some values in F4 help in selection screen so that user can not see those data for selection.
    Regards

    i think u can not hide the data.........
    create own f4 help............restrict the data and then pass it the f4 internal table....
    fro exp;;;;;
    types : begin of ty_tab,
              post_code1 like adrc-post_code1,
             end of ty_tab.
      data : it_tab type ty_tab occurs 0.
      data : lt_field type table of dfies,
             lw_field type dfies.
      select post_code1 from adrc into corresponding fields of table it_tab.
      call function 'F4IF_INT_TABLE_VALUE_REQUEST'
          exporting
            retfield        = 'POST_CODE1'
            dynpprog        = sy-repid
            dynpnr          = sy-dynnr
            dynprofield     = 'LI_LIST1'
            value_org       = 'S'
          tables
            value_tab       = it_tab
         field_tab       = lt_field
          exceptions
            parameter_error = 1
            no_values_found = 2
            others          = 3.
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
    Regards
    Anbu

  • How to get calender in f4 help for select options in module pool (URGENT)

    Hi All,
    how to get calender in f4 help for select options in module pool
    Please help .
    Thanx in advance,
    amruta

    Hi Amruta,
    First of all, you can not create select-options directly in module pool.
    For creating <b>select-option is dialog prog</b> follow these steps:
    1. create your selection screen model as subscreen by:
    SELECTION-SCREEN BEGIN OF SCREEN 2000 AS SUBSCREEN.
    PARAMETRS: P_MATNR LIKE MARA-MATNR.
    SELECT-OPTIONS: S_BISMAT FOR MARA-BISMAT.
    SELECTION-SCREEN END OF SCREEN 2000.
    2. create a screen ( example 100 ) in your module-pool dedicated for selection-screen. on this screen layout sketch a sub-screen name like subscree_2000.
    3. write this bit of code in PBO and PAI of the screen 100;
    CALL SUBSCREEN SUBSCREEN_2000.
    4. include this code in PBO:
    INCLUDING SY-REPID '2000'
    6. write user_command of PAI, call screen which is going to executable after selection-screen.
    5. create a transcation for this dialog module pool with screen 100.
    6. execute this transaction and you can see it's behaving like cool with select-options.
    After that in [bprocee on value-request]</b>, use F4_DATE for both from and to option field.
    Hope it will solve the problem.
    Regards
    Krishnendu

  • Hi its urgent...help on selection screen parameters

    Hi all,
    I need help on selection screen parameters.
    requirement is that,
    i am having input fields for material, plant ,start date and end date and a check box and an input field for getting the txt file.
    when i select the checkbox, it should ignore the mandatory fileds in the selection screen.
    and when i get the file input, it should take  the input data material, plant, start date and end date from the flat file and populate the corresponding input fields in selection screen.
    How to do this..
    thanks in advance.

    Hi ..
    While declare the Matnr, Plant etc dont use the OBLIGATORY addition.
    instead of the based on the value of check box validate them .
    AT SELECTION-SCREEN.
      IF c_box = ' '.
       << validate for mandatory fields>>
    endif.
    <b>REWARD IF HELPFUL.</b>

  • Urgent Help In ABAP

    Hi Gurus,
    Please i need an urgent help from you guys. There is a demand file which consits of (Siteno(plant), Item No ,Item Description, Delivery due date) will be placed in a unix system or windows system. I need to write an interface which shows a radiobutton for unix & windows and fileupload button & download button.When user clicks should be able to select only one radiobutton (unix or windows) to upload or download.When the user clicks the fileupload / download button,it should pick up the file or drop the file at particular unix or windows system.
    Please help me or give me sample code where in i can select the radiobutton and i can upload / download from unix or windows path. and during upload process (for both unix/windows) ,i should be able to persist into a custom table (ztable,if iam not wrong) and while downloading read the records from custome table and create an excel file to be placedon unix/windows based on the radio button.
    Thanks in advance, i need ur help please.
    Regards
    Bruno

    Hi Bruno,
    Please checkout this code sample
    ABAP code for uploading a TAB delimited file into an internal table.
    The code is base on uploading a simple txt file.
    <b>
    http://www.sapdevelopment.co.uk/file/file_uptabpc.htm</b>
    Thanks,
    Aby

  • Urgent help needed... PL/SQL Insert statement

    Hi...
    I need some urgent help on this project. I have a 2 column table with values that need to be inserted into another existing table which has a sequence.
    This is the 2 column table:
    FUND YEAR
    29587 05
    29587 07
    Existing table:
    Name Null? Type
    LIST_ID NOT NULL NUMBER(6) -- This is a sequence
    WEB_USER_ID NOT NULL VARCHAR2(10)
    RESOURCE_TYPE NOT NULL VARCHAR2(8)
    LIST_TYPE NOT NULL VARCHAR2(10)
    LIST_NAME NOT NULL VARCHAR2(50)
    LIST_CODE_1 NOT NULL VARCHAR2(6) -- FUND from table above
    LIST_CODE_2 NOT NULL VARCHAR2(6) -- YEAR from table above
    LIST_CODE_3 NOT NULL VARCHAR2(6)
    LAST_UPDATED_DT NOT NULL DATE
    LAST_UPDATED_BY NOT NULL VARCHAR2(10)
    LIST_CODE_4 NOT NULL VARCHAR2(20)
    The columns from table 1 (FUND, YEAR) correspond to columns (LIST_CODE_1, LIST_CODE_2) in table 2. The column LIST_ID is a sequence. I can put in sysdate for LAST_UPDATED_DT and my initials SN for LAST_UPDATED_BY. This is going to be for 2 unique WEB_USER_IDs which would be in the WHERE clause. I will be inserting 2200 rows for each id. A single insert statement would look like this -
    INSERT INTO EXISTING_TBL (list_id,web_user_id,resource_type,list_type,list_name,list_code_1,list_code_2,list_code_3,list_code_4,last_updated_dt,last_updated_by) VALUES ('470027','WEBUSER','GL','FUNDFYF',' FUND BALANCE SUM','12010','01',' ',' ',{ts '2010-5-19 10:16:9'},'SN')
    How would I do this to insert the 2200 values from my 2 column table to the existing table?
    All help is greatly appreciated!!
    SN

    Hello ,
    I think this will work
    INSERT INTO TABLE2
         LIST_ID,
         WEB_USER_ID,
         RESOURCE_TYPE,
         LIST_TYPE,
         LIST_NAME,
         LIST_CODE_1,
         LIST_CODE_2,
         LIST_CODE_3,
         LIST_CODE_4,
         LAST_UPDATED_DT,
         LAST_UPDATED_BY
    SELECT
         SEQ.NEXTVAL,
         FUND,
         YEAR,
         <VALUE FOR RESOURCE_TYPE>,
         <VALUE FOR LIST_TYPE>,
         <VALUE FOR LIST_NAME>,
         <VALUE FOR LIST_CODE_1>,
         <VALUE FOR LIST_CODE_2>,
         <VALUE FOR LIST_CODE_3>,
         <VALUE FOR LIST_CODE_4>,
         SYSDATE,
         'SN'
    FROM
         TABLE1
    REGARDS
    Rahul Sharma

  • Urgent help needed for XML Tags using XMLForest()

    Folks
    I need some urgent help regarding getting use defined tag in your
    XML output.
    For this I am using XMLElement and XMLForest which seems to work fine
    when used at the SQL prompt but when used in a procedure throws and error
    SQL> Select SYS_XMLAGG(XMLElement("SDI",
                                       XMLForest(sdi_num)))
         From sdi
         where sdi_num = 22261;- WORKS FINE
    But when used in a procedure,doesnt seem to work
    Declare
        queryCtx  DBMS_XMLQuery.ctxType;
        v_xml     VARCHAR2(32767);
        v_xmlClob CLOB;
        BEGIN
        v_xml:='Select SYS_XMLAGG(XMLElement("SDI",
                                             XMLFOREST(sdi_num)))
        From sdi
        where sdi_num = 22261';
        queryCtx :=DBMS_XMLQuery.newContext(v_xml);
        v_xmlClob :=DBMS_XMLQuery.getXML(queryCtx);
        display_xml(v_xmlClob);
    End;
    CREATE OR REPLACE PROCEDURE  display_xml(result IN OUT NOCOPY CLOB)
    AS
         xmlstr varchar2(32767);
         line varchar2(2000);
    BEGIN
         xmlstr:=dbms_lob.SUBSTR(result,32767);
         LOOP
         EXIT WHEN xmlstr is null;
         line :=substr(xmlstr,1,instr(xmlstr,chr(10))-1);
         dbms_output.put_line('.'||line);
         xmlstr := substr(xmlstr,instr(xmlstr,chr(10))+1);
         END LOOP;
    end;
    SQL> /
    .<?xml version = '1.0'?>
    .<ERROR>oracle.xml.sql.OracleXMLSQLException: Character ')' is not allowed in an
    XML tag name.</ERROR>
    PL/SQL procedure successfully completed.
    SQL>HELP is appreciated as to where I am going wrong?

    Hi,
    if you want to transform something to something else, you should declare, what is your source.
    I would prefer to use plain XSL-Transformations, because you have a lot more options to transform your source and you can even better determine, how your output should looks like.
    Kind regards,
    Hendrik

  • Urgent help needed! How do I use Time Machine to restore my System disc?

    I need urgent help. First I discovered that my Library folder was empty. When I tried to restore the library to an earlier version via Timemachine it would not let me because it said the system was in use. Trying to start-up from another system on another internal drive and using various disc repairs resulted in the whole volume to disappear.
    Question is how do I get the earlier system from my Timemachine backup drive? I have another Mac where I can attach the TIme machine HD to. Can I restore it from there and then copy the files over to my corrupted disc? All my programs are on there as well, which would take me days to re-install and then there are the other bits, emails, photos etc. Can anyone help?

    lightandmagic wrote:
    Thanks for your sympathy Pondini and the encouragement. You just reminded me that I will lose a whole working day restoring !!! Do you happen to know where the emails are kept on the system and the address book? I better nick those as well as my other life sustaining bits before its too late. I don't trust anything any more.
    I don't know what you mean by "nick those." Time Machine will put everything back the way it was at the time of the backup (unless you'd excluded things).
    Do you mean you want to restore things from the period after the backup you selected?
    For Address Book or Apple Mail, start the application, then +Enter Time Machine,+ navigate to your latest backup, and you'll have a prompt to restore. For Mail, you can restore an entire mailbox. When you exit from TM, you'll see a new folder in your Mail sidebar with the restored items, so you can sift through them and move, delete, or leave them as you wish.
    Other items, you'll have to locate and restore via the Finder > Time Machine.

  • Urgent help needed in achieving below ADF 11g flow

    Hi, I am using JDEV 11.1.1.2.0 with ADF 11g.
    I have a below requirement.
    Say in below eg. I am getting col1, col2, col3 from a single tbl in screen 1. On clicking col1's row I should go to screen 2
    Screen1
    Col1     Col2     Col3
    Nm1     Code1     10
    Nm1     Code1     30
    Nm2     Code1     30
    Nm1     Code2     20
    Here in screen 2 I will have a calculated field as shown below. Besides this In the same screen I will have a list showing distinct of col2 for the value cliked in col1. So here in this eg. it will be for Nm1 I will have 2 values in the list Code1 and Code2.      
    Screen 2          
    Col1     Nm1     
    Col2     Code1     
    Tot     *40*     
    Col2     Select     
    Code1     X     
    Code2          
    Now here if user selects the radio of 'Code2' Then my above data should change as below
    Col1     Nm1     
    Col2     Code2     
    Tot     *20*
    Col2     Select     
    Code1          
    Code2     X
    I do this by passing the col1 value as a param to a query VO.
    I have tried this using different VOs like a VO with query, VO with user defined column... nothing helps.
    I am just unable to reach to screen 2. I am either getting invalid column OR missing in out parameters.
    Can any one help on how and what should be done? This is not even master-details stuff. master-details seems easier than this.
    Urgent help is needed.
    Thanks in advance

    I have resolved your problem and build a sample application.
    You have to create 2 views and use master detail.
    First view will be a simple view for the page 1 and second view will be readonly using group by. Then create a view link between them.
    Let me know your email id. I will email you the sample application.
    SID
    Edited by: manieshsailoz on Apr 26, 2010 5:12 PM

  • Urgent help needed with un-removable junk mail that froze Mail!!

    Urgent help needed with un-removable junk mail that froze Mail?
    I had 7 junk mails come in this morning, 5 went straight to junk and 2 more I junked.
    When I clicked on the Junk folder to empty it, it froze Mail and I can't click on anything, I had to force quit Mail and re-open it. When it re-opens the Junk folder is selected and it is froze, I can't do anything.
    I repaired permissions, it did nothing.
    I re-booted my computer, on opening Mail the In folder was selected, when I selected Junk, again, it locks up Mail and I can't select them to delete them?
    Anyone know how I can delete these Junk mails from my Junk folder without having to open Mail to do it as it would appear this will be the only solution to the problem.

    Hi Nigel
    If you hold the Shift key when opening the mail app, it will start up without any folders selected & no emails showing. Hopefully this will enable you to start Mail ok.
    Then from the Mail menus - choose Mailbox-Erase Junk Mail . The problem mail should now be in the trash. If there's nothing you want to retain from the Trash, you should now choose Mailbox- Erase Deleted Messages....
    If you need to double-check the Trash for anything you might want to retain, then view the Trash folder first, before using Erase Junk Mail & move anything you wish to keep to another folder.
    The shift key starts Mail in a sort of Safe mode.

  • Urgent HELP required on forming the Matrix of data using PL/SQL

    Hi All,
    I'm new to this thread and require your urgent help in this regard.
    I've got a requirement for building a 5000 X 5000 matrix using PL/SQL. My original data tables have 5000 rows each and I need to do a correlation analysis using this data and need to store in a physical table and not in-memory. Is this feat achievable using mere PL/SQL? I understand that Oracle DB has a limitation of 1000 columns(but not sure) and hence I'd like to know whether there is any work-around for such scenarios. If not, what are the other alternative method(s) to achieve this feat? Do I need to use any 3rd party tools to get this done? An early reply from the experts is highly appreciated.
    Thanking you all Gurus in advance.
    Rgds
    Sai

    Welcome to OTN!
    I'll get to your quesiton in a moment, but first some welcome information. Many OTN posters consider it impolite to mark threads as "urgent". We are volunteers and have jobs of our own to do without people we don't know making demands. You are brand new and deserve some patience but please understand this. It is very likely before I finish this post someone will complain about the word "urgent" in your subject.
    On to more interesting things :)
    You can do the matrix, but are out of luck with a 5000 x 5000 table because Oracle only allows 1000 columns per table. There are ways to work around this.
    How do do the matrix depends on what you want to do. You can do this different ways. You can create a table beforehand and use PL/SQL or simple SQL to populate it, or use the CREATE TABLE AS syntax to create and populate it in one step if you can get the underlying SQL to work the way you want, something like
    create table my_table as
      select a.*, b.*
        from table1 a, table2 bcan populate a matrix from 2 tables with an intentional cartesian join (the WHERE clause was left out intentionally, provided your data is already in the data base.
    If not you can use a PL/SQL routine to populate the data.
    There are a couple of ways to solve the 1000 column limit. The easiest way might be to have 5 collections of 1000 columns each. A more complicated but more elegant soltion would be to have nested collections, allowing 2 colliections that you can loop through - a collection of collections. Nested collections can be hard to work with. A third way would be to use nested tables in the database but I personally do not like them and the insert, update, and delete statements for nested tables are hard to use.
    I'm not going to give a code example because I am not sure which solution is best for you. If you have further questions post them.

  • 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

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

Maybe you are looking for