I need billing plan detaisl from FPLT TABLE.

I have sales order no VBAK-VBELN.
I need billing plan item detaisl from FPLT TABLE.
HOW TO LINK THESE 2 TABLES to get these billing [plan item details records
Edited by: abap_friends on Jul 8, 2010 8:17 AM

Hi,
  try with this fm
        CALL FUNCTION 'SD_SALES_BILLINGPLAN_READ'
          EXPORTING
            i_vbeln                      = ip_docnum
            i_posnr                      = ip_posnr
          TABLES
            e_fplt                       = it_fplt
          EXCEPTIONS
            no_billingplan_allowed       = 1
            no_billingplan_found         = 2
            OTHERS                       = 3
or
  SELECT posnr fplnr INTO TABLE i_fplnr
    FROM vbkd
    WHERE vbeln EQ ip_docnum.
  IF NOT i_fplnr[] IS INITIAL.
    SELECT fplnr mlstn fkdat INTO TABLE i_mlstn FROM fplt
      FOR ALL ENTRIES IN i_fplnr
      WHERE fplnr EQ i_fplnr-fplnr.
  Endif.
Regards,
Carlos

Similar Messages

  • I need to copy data from a table in one database (db1) to another table in

    Hi
    I need to copy data from a table in one database (db1) to another table in another database (db2).
    I am not sure if the table exists in db2,,,if it doesnot it needs to be created as well data also needs to be inserted...
    How am I supposed to this using sql statements..?
    I shall be happy if it is explained SQL also...
    Thanking in advance

    How many rows does the table contains? There are manyway you can achieve this.
    1. export and import.
    2. create a dblink between two databases and use create table as select, if structure doesnot exists in other database, if structure exists, use, insert into table select command.
    example:
    create a dblink in db2 database for db1 database.
    create table table1 as select * from table1@db1 -- when there is no structure present
    -- you need to add constraints manually, if any exists.
    insert into table1 select * from table1@db1 -- when there is structure present.
    If the table contains large volume of data, I would suggest you to use export and import.
    Jaffar

  • Copy billing plan lines from one sales document to another

    HI,
    we want to copy the open billing plan lines from one sales document to another, which routine should we use in the copy control in configuration?
    we tried to use,401 and 402 but with no success..
    it's should'nt be a standard process with out any development?
    Best Regards
    Yehudit

    Hi,
    Check where you entering this routine
    If your billing plan at header then enter it at header in copy control, if billing plan is item level then maintain at Item level in copy control
    Kapil

  • Need to fetch value from a table based on data range

    Hello there,
    I was hoping that the community could give me a hand with this little puzzle I got.
    I am currently creating a Time Dimension for a data wharehouse, and I have the requirement to populate a column named SEASON (e.g: Summer, Winter, Spring, Autumn) for each date row. So for the 20/Dec/2013, the Season column must say Winter.
    Here is now my Time Dimension table looks like, without the Season information (which I yet have to load):
    DimTime Table
    TIMEID
    FULLDATE
    YEAR
    SEASON
    MONTH
    MONTHDAY
    WEEK
    WEEKDAY
    274
    02-MAR-10
    2010
    3
    2
    9
    2
    275
    03-MAR-10
    2010
    3
    3
    9
    3
    276
    04-MAR-10
    2010
    3
    4
    9
    4
    277
    05-MAR-10
    2010
    3
    5
    9
    5
    278
    06-MAR-10
    2010
    3
    6
    9
    6
    279
    07-MAR-10
    2010
    3
    7
    9
    7
    This entire table is being populated using Oracle functions to manipulate a date field from another table, named PDATE:
    My ETL Code
    INSERT INTO DimTime(timeid, fulldate, year, month, monthday, week, weekday)
    SELECT tim_seq.NEXTVAL, pdate, year, month, monthday, week, weekday
    FROM (SELECT DISTINCT pdate, EXTRACT(year from pdate) year, EXTRACT(month from pdate) month,
    EXTRACT(day FROM pdate) monthday, to_number(to_char(to_date(pdate,'DD/MM/YY'),'IW')) week,
    TO_CHAR(pdate, 'D') weekday
    FROM Performance PER
    ORDER BY pdate);
    NOTE: Code considers the table DimTime to be truncated every time it loads (i.e.: I don't need to consider additional loads).
    As you can see, Season wasn't populated. Since the solstices and equinoxes vary for each year, I can't just say that Summer start at a given date (e.g: 21 of June) because one year it could be the 19/Jun, another the 22/Jun, etc. So in order to solve this problem, I have a table named Season which defines the START and END dates for the seasons:
    Season Table
    SEASON#
    SEASONNAME
    YEAR
    DATEFROM
    DATETO
    1
    Spring
    2010
    01-MAR-10
    30-MAY-10
    2
    Summer
    2010
    31-MAY-10
    29-AUG-10
    3
    Autumn
    2010
    30-AUG-10
    28-NOV-10
    4
    Winter
    2010
    29-NOV-10
    27-FEB-11
    5
    Spring
    2011
    28-FEB-11
    29-MAY-11
    6
    Summer
    2011
    30-MAY-11
    28-AUG-11
    7
    Autumn
    2011
    29-AUG-11
    27-NOV-11
    8
    Winter
    2011
    28-NOV-11
    26-FEB-12
    9
    Winter
    2009
    30-NOV-09
    28-FEB-10
    This is the bit I don't know how to do. How can I make sure that I populate the correct Season in my DimTime table based on the season specified in the Season table?
    Thanks in advance for your help!
    Regards,
    P.

    Just join to table Season:
    INSERT
      INTO DimTime(
                   timeid,
                   fulldate,
                   year,
                   month,
                   monthday,
                   week,
                   weekday,
                   seasonname
      SELECT  tim_seq.NEXTVAL,
              pdate,
              year,
              month,
              monthday,
              week,
              weekday
        FROM  (
               SELECT  DISTINCT pdate,
                                EXTRACT(year from pdate) year,
                                EXTRACT(month from pdate) month,
                                EXTRACT(day FROM pdate) monthday,
                                to_number(to_char(to_date(pdate,'DD/MM/YY'),'IW')) week,
                                TO_CHAR(pdate,'D') weekday,
                                seasonname
                 FROM  Performance PER,
                       season
                 WHERE pdate between datefrom and dateto
    SY.

  • Need assistance searching records from multiple tables - Please Help!

    Hi, I've been trying to solve this problem for several weeks now, and I have exhausted all of my knowledge and experience.  I need help, and I hope someone here can give me some direction.
    I am using VB 2008, and the CR that comes bundled with VS 2008 Pro.  My database is a SQL Server 2005 CE v3.5 (a *.sdf file).  I am connecting to the database through a dataset, and I am displaying the report in a CrystalReportViewer.
    My dataset consistes of two tables:
    1) tblCustomers which has a primary key "CustID", and contains only customer contact and personal information. 
    2) tblDateVisited which has a primary key of "VisitID", but it also has a column titled "CustID". Basically, every time a customer visits the business, details of that visit are recorded in tblDateVisited, and that record is associated with the customer by their CustID.
    Here's what I'm trying to accomplish:  I want to be able to display only Customer records when the customer has visited and that visit matches certain criteria.  Right now, I am trying to match visits from the "tblVisitDate.PlayerType" column.  If the customer has ever had a visit where they matched a particular player type, I want to see those customer records.
    I don't know what I'm doing wrong, though.  I can search a dataset if I am only querying one table and pulling records from that table.  However, whenever I try to add a second table and perform queries on that table to get records from the first table, I can't return any records. 
    If it helps, I am trying to use one CrystalReportViewer to display multiple reports (user choice) and here's how I'm loading the report into the viewer:
    Me.tblCustomersTableAdapter.Fill(Me.dsPlayerTypeReports.tblCustomers)
    Me.tblDateVisitedTableAdapter.Fill(Me.dsPlayerTypeReports.tblDateVisited)
    Me.ReportFile.SetDataSource(dsPlayerTypeReports.Tables(1))
    I am suspicious that my problem is in the Tables(1) method.  It confuses me that I can only assign one table as a datasource when I obviously need access to two tables to make this selection work. 
    Whatever the case, I'm at the end of my rope with this one.  I'm not prone to giving up, but I'm at a dead end currently. 
    Any attempt to assist me with this will be greatly appreciated, successful or not.
    Thanks in advance!
    -Will

    No, I am connected via ADO.NET.  I don't think SQL CE can connect through ODBC (or if it can, I haven't been able to figure out how, yet).  So this isn't a stored procedure.
    When I examine the link, I can only choose an Inner Join or a Left Outer Join.  Right Outer and Full Outer are not available.  Could this be a problem with the dataset I'm using?
    Could you explain what you mean by display all of the records and then choose the selection criteria?

  • Need to delete data from main table and all child tables ...

    hi all,
    i need to delete rows pertaining to perticular table and all the child
    tables basing on certain code.i need to write a procedure to which i will
    pass the table name and code..
    like del_info(tab_name,code)
    example:
    suppose if i call as del_info(clients,760)
    the procedure should delete all info reg. code 760
    and the table clients and also all the child records of this table
    perting to code 760.
    simply .. i need to delete from the table passed and also
    all the child tables down the heirarchy regarding certain code ...
    help ???
    Ravi Kumar M

    Hi,
    Depends how you defined referential integrity.
    You can use ON DELETE CASCADE, please read the next doc http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/clauses3a.htm#1002692
    Hope this help you,
    Nicolas.

  • Need FDGRV (Planning Group) from LFB1 as attribute

    Hello,
    I am creating freight separation reports and have run into problem.  Initial specs were to differentiate freight vendors by using different vendor party.  Purchasing dept had determined that all freight vendors would we within a set range.  Now in testing, it has been uncovered that sometimes another vendor will be used  which is not within that range.  Users have now confirmed that I could use the planning group field - FDGRV - from table LFB1.
    Data model - multiprovider is in place.  Using 2LIS_06_INV - Invoice Cube and Custom DSO of purchasing budgeted data. 
    I know that I could enhance the 2LIS_06_INV datasource and bring in Planning Group - FDGRV -  from LFB1 table.
    Another consultant suggested the idea of bringing it in as an attribute to the different vendor party field?
    Can anyone help walk me through these steps? I am not experienced with this method.
    Thank you...

    I  figured it out - completed.

  • Help needed on retreving QID from APQI table

    Hi Gurus,
    I am using RBIBGL00 standard batch program in my report to create a batch session and in turn execute it.
    Batch session is getting created and it is getting executed as well.
    Issue:
    Now i need to retreive the batch information (succes/failure msgs) from the log
    so i am writing code as:
    select QID to display session log
    SELECT SINGLE qid                             
        INTO gv_qid
        FROM apqi
        WHERE datatyp = gc_bdc
          AND groupid = p_group    
          AND progid  = sy-repid     
          AND userid  = sy-uname
          AND credate = sy-datum.
    But qid is not getting fetched.
    Please help me to resolve this issue.
    Regards'
    Madan.

    Hi Thomas,
    I am using RFBIBL00 program in my report in 2 modes,
    to Create Batch session and
    in Call Transaction mode as well. ( is my requirement)
    1. In Call Transaction mode, i am passing the option xlog, so that after documents are loaded, a log is displayed.
    2. In Batch Session mode, batch is getting created and to execute that batch, i am calling another program RSBDCSUB.
    Batch is getting executed and result gets exported to memory.
    I am fetching the results from memory using function module
    "LIST_FROM_MEMORY"
    Then converting that to ASCI fromat using function module
    "LIST_TO_ASCI"
    Now i need to display the session log
    so i am retreving session data (QID) from APQI table.
    Please let me know if there are any alternatives.
    Thanks for your time and help.
    Regards'
    Madan.

  • Need billing plan information into formula condition routine

    Hi Experts,
    I am writing a formula condition form routine in VOFM transaction. I need to caluculate a formula according to the business requirement. As part of their business, i need to get the billing plan information like billing plan type and  billing plan rule so that i can get the number of payments
    which i need to use in the formula. Does any of the runtime structures contain this billing information.
    Regards,
    Chitrasen

    Hi Chitrasen,
    When i searched with the *BILLING* in the SE11 data type i have got some relevent structures below
    try to use those.
    FDM_COLL_INVOICE_BILLING_DOC   Billing Document for Invoice
    RVKUSTA1_S_BILLING             Sales Summary: Structure for Billing
    for more you can also search with the same so the you will find most relevent one.
    Thanks!

  • Help needed in  extracting data from PCD tables

    Hi Friends
    I Have a requiremnt for creating custom portal activity report ,even though
    we have  standard report, the extraced data will be used to create bw reports later.
    my part is to find a way to extract the data from PCD tables for creating
    custom portal activity reports
    i have selected the following  tables for the data extraction
    WCR_USERSTAT,WCR_WEBCONTENTSTAT,WCR_USERFIRSTLOGON,
    WCR_USERPAGEUSAGE.
    My questions are
    1.Did i select the Exact PCD tables?
    2.Can i use UME api  for  accessing the data from those tables?
    3.can i use  the data extracted  from PCD tables in JSPdynpage  or
    webdynpro apps?
    4.can i Querry  the  PCD tables from  JSPDynpage or Webdynpro
    Please help me in finding a solution for this
    Thanks
    Ashok Battula

    Hi daniel
    Can u tell  me weather i can develop the following  custom reports from those WCR tables
         Report Type
    1     Logins
          - Unique Count
          - Total Count
          - Most Active Users (by Partner Name)
          - Most Active Users (by Contact Name)
          - Entry Point (by page name)
          - Session Time
          - Hourly Traffic Analysis
    2     Login Failures
          - Total Count
          - Count by error message
          - Credentials Entered (by user name and password)
    3     Content Views (by File Name)
          - Unique Count
          - Total Count
          - Most requested Files
          - Most requested Pages
          - File Not Found
    4     Downloads (by File Name)
          - Unique Count
          - Total Count
          - Most requested Files
          - File Not Found
    5     Portal Administration
          - Site Content (by file name)
          - Site Content (by page name)
          - Latest Content (by file name)
          - Expired Content (by file name)
          - Subscriptions Count (by file name)
    6     Login History (by Partner, Contact Name)
          - No Login
          - First Login
          - Duration between registration and first login
          - Most Recent Login
          - Average Number of Logins
    plz  help me in find ing a way
    thanks
    ashok

  • Footer needs to pull data from main table

    Hi Gurus,
    I need to have a footer which displays the value of a tag from the main table in BI publisher. The main table in the BI Publisher has the customer information and the address information of the customer needs to print on the footer of the page that displays the customer. This address would change for each customer. There must be a way to do this. I searched through the BI Publisher forum but couldnt find any way to do this. Could you pls help.
    Thanks,
    Swarna

    hi Paolyn,
    We can't insert data's from table using publisher desktop
    just double click on the footer part and added the data with the following format
    <?CUSTOMERNAME?>
    <?CUSTOMERNUMBER?>
    The tag value should be in upper case
    then close the footer and try that
    Thanks,

  • Help needed to merge values from two tables -

    We have these three test tables shown, which have a common ID; And amount fields; I want the -------
    test1.val = test2.val + test3.val
    when they have common ids in them;
    I have shown the test data below: And the expected output;
    NOTE: In database with real table values - each of them have millions of rows in them. So effeciency is very important here;
    SQL> desc test1;
    Name Null? Type
    ID NUMBER
    VAL NUMBER
    SQL> desc test2;
    Name Null? Type
    ID NUMBER
    VAL NUMBER
    SQL> desc test3;
    Name Null? Type
    ID NUMBER
    VAL NUMBER
    SQL> select * from test1;
    ID VAL
    1 50
    2 50
    3 55
    4 60
    5 20
    5 rows selected.
    SQL> select * from test2;
    ID VAL
    1 25
    1 25
    2 5
    2 5
    4 75
    5 rows selected.
    SQL> select * from test3;
    ID VAL
    1 25
    1 25
    2 5
    2 25
    2 25
    5 10
    6 rows selected.
    I EXPECT the output to be:
    SQL> select * from test1;
    ID VAL
    1 100
    2 65
    3 20
    4 75
    3 20
    5 10
    6 rows selected.

    Need help with the update queries - joining three tables -

  • Urgent:Logic needed to fetch data from Internal Table

    Here i have an internal table having Emp no,Emp name,Salary fields....
    With unique Emp no.
    My requirement is i want to fetch all the details of the employees(like empno,emp name, emp address..) whose salary is the third highest salary.
    Note: Many employees can have unique salary.
    I need the logic for that,
    helpfull ans ill be rewarded.

    suppose ur table has three fields like
    types : begin of typ_emp,
                 num type i ,
                 name type char20 ,
                 salary type char10 ,
               end of typ_emp.
    data : it_emp type table of typ_emp ,
             it1_emp TYPE TABLE OF typ_emp ,
            wa_emp type typ_emp .
    DATA : count TYPE i ,
               w_salary type i .
    code is
    SORT it_emp BY salary ASCENDING .
    it1_emp = it_emp .
    Take the all data to another table and delete all adjacent duplicates .
    DELETE ADJACENT DUPLICATES FROM it_emp COMPARING salary .
       READ TABLE IT_EMP INTO WA_EMP INDEX 3.
    MOVE  WA_EMP-SALARY TO W_SALARY .
    now the third highest salary will come into w_salary .
    and now again process your internal table and retrieve whose salary is equal to w_salary ...
    thanks
    reward if helpfull..............
    Edited by: sam k on May 27, 2008 12:43 PM
    Edited by: sam k on May 27, 2008 12:55 PM

  • Need to reclaim space from dwh tables.

    We have couple of large tables (> 200G) in one of the DWH schema. I need to reclaim space on the mountpoint.
    I have used ALTER TABLE <> MOVE COMPRESS; command to compress these tables.
    Now in dba_segments it is showing the improvement. 200g table came down to 60G. However I am not able to see any change in datafile and in mountpoint, I beleive due to the HWM.
    I tried shrink for the tables, it did not help.
    Could you please suggest any other approach.

    refer to
    http://jonathanlewis.wordpress.com/2010/01/30/free-space/
    http://jonathanlewis.wordpress.com/2010/02/06/shrink-tablespace/
    Anand

  • Need Help Pulling Data from Oracle Table (Newby)

    Let me start of by saying I'm very new to Java so the code may be messy/poorly coded (I'm trying!). However, I've come a long way already and the code is almost working (it compiles and returns what I expect in one case). What I'm trying to do is prompt the user to enter a type, then a key. I use that type to determine the SQL statement to use then I use the key as part of the SQL statement.
    If I enter 'custnum' as the type, then a string as my key, it finds the record fine.
    If I any of my other valid types (lname, address or phone) and then enter my key, the result set is empty. I've verified that there are matching records for the type/key I'm entering.
    I've tried stepping it through the debugger and looking at various variables along the way both with the working scenario and the not-working scenario, but I can't find anything. I'm sure it's a simple coding mistake, but I don't really know how to track it down.
    Any ideas on what's going wrong would be greatly appreciated. Thanks!
    //Start code
    import java.sql.*;
    import java.util.Scanner;
    public class AccessCustomerTable
    private static final String DEFAULT_DRIVER = "oracle.jdbc.driver.OracleDriver";
    private static final String DEFAULT_URL = "jdbc:oracle:thin:@hostname.com:1521:orap1";
    private static final String DEFAULT_USERNAME = "username";
    private static final String DEFAULT_PASSWORD = "password";
    //Set the SQL statements
    private static final String SQLCUSTOMER_CUSTNUM =
    "select CUSTNUM,CUST_LNAME,CUST_FNAME,CUST_PHONE,EMAIL,STAT_LVL,HH_NUM " +
    "from EME.CUSTOMER " +
    "where CUSTNUM=?";
    private static final String SQLCUSTOMER_CUST_LNAME =
    "select CUSTNUM,CUST_LNAME,CUST_FNAME,CUST_PHONE,EMAIL,STAT_LVL,HH_NUM " +
    "from EME.CUSTOMER " +
    "where CUST_LNAME=?";
    private static final String SQLCUSTOMER_CUST_PHONE =
    "select CUSTNUM,CUST_LNAME,CUST_FNAME,CUST_PHONE,EMAIL,STAT_LVL,HH_NUM " +
    "from EME.CUSTOMER " +
    "where CUST_PHONE=?";
    private static final String SQLCUSTOMER_EMAIL =
    "select CUSTNUM,CUST_LNAME,CUST_FNAME,CUST_PHONE,EMAIL,STAT_LVL,HH_NUM " +
    "from EME.CUSTOMER " +
    "where EMAIL=?";
    private static final String SQLDETAIL =
    "select TRANS_DATE,STORENUM,TERMINAL,TRANSID,OPERATOR,SALES_TOT," +
    "AMOUNT_SPENT,AUTO_CPNS,PTS_EARNED,PTS_REDEEMED,RDMT_CPNS,ADD_CPNS," +
    "USED_CPNS,OFFLINE_ALT_ID,RECON_IND " +
    "from EME.CUSTOMERDETAIL " +
    "where CUSTNUM=?";
    private static final String SQLHOUSEHOLD =
    "select PGM_PTS,PERIOD_PTS,PGM_RDM,PERIOD_RDM,SALES_TOT,AUTO_CPNS," +
    "CARD_UCNT,MESSAGE,DISC_GRP,PT_MULTP,USERFEAT1,USERFEAT2,USERFEAT3,TARG_CPNS " +
    "from EME.HOUSEHOLD " +
    "where HH_NUM=?";
    public static void main(String[] args)
    Connection conn = null;
    PreparedStatement stmt = null;
    ResultSet rset = null;
    //declare all variables
    String custNum = "";
    String custLNm = "";
    String transDt = "";
    String storeNum = "";
    String pgmPtsEarned = "";
    String periodPtsEarned = "";
    try {
    //********** Get Customer Data **********
    householdNum = "";
    Class.forName(DEFAULT_DRIVER);
    conn = DriverManager.getConnection(DEFAULT_URL,DEFAULT_USERNAME,DEFAULT_PASSWORD);
    String lookupType = getUserInput("Lookup Type");
    if (lookupType.toUpperCase().equals("CUSTNUM"))
    stmt=conn.prepareStatement(SQLCUSTOMER_CUSTNUM);
    else if (lookupType.toUpperCase().equals("LNAME"))
    stmt=conn.prepareStatement(SQLCUSTOMER_CUST_LNAME);
    else if (lookupType.toUpperCase().equals("PHONE"))
    stmt=conn.prepareStatement(SQLCUSTOMER_CUST_PHONE);
    else if (lookupType.toUpperCase().equals("ADDRESS"))
    stmt=conn.prepareStatement(SQLCUSTOMER_EMAIL);
    else
    //stop execution with message
    System.out.println("Invalid lookup type entered. Process stopping");
    System.exit(0);
    String lookupKey = getUserInput("Lookup Key");
    System.out.println("Lookup Key is " + lookupKey);
    stmt.setString(1,lookupKey);
    rset = stmt.executeQuery();
    //what if rset returns no records?
    boolean empty=true;
    while (rset.next())
    empty=false;
    custNum = rset.getString(1);
    custLNm = rset.getString(2);
    if (empty)
    System.out.println("No records found for " + lookupKey);
    System.exit(0);
    //********** Get Detail Data **********
    stmt=conn.prepareStatement(SQLDETAIL);
    //stmt.setString(1,customerId);
    stmt.setString(1,custNum);
    rset = stmt.executeQuery();
    empty = true;
    while (rset.next())
    empty = false;
    transDt = rset.getString(1);
    storeNum = rset.getString(2);
    if (empty)
    System.out.println("No detail records found for customer # " + custNum);
    System.exit(0);
    //********** Get Household Data **********
    stmt=conn.prepareStatement(SQLHOUSEHOLD);
    stmt.setString(1,householdNum);
    rset = stmt.executeQuery();
    empty = true;
    while (rset.next())
    empty = false;
    pgmPtsEarned = rset.getString(1);
    periodPtsEarned = rset.getString(2);
    if (empty)
    System.out.println("No household records found for " + householdNum);
    System.exit(0);
    catch(Exception x)
    System.out.println(x.getMessage());
    x.printStackTrace();
    finally
    close(rset);
    close(stmt);
    close(conn);
    private static void close(Connection conn)
    try
    if (conn != null)
    conn.close();
    catch (SQLException e)
    e.printStackTrace();
    private static void close(Statement stmt)
    try
    if (stmt != null)
    stmt.close();
    catch (SQLException e)
    e.printStackTrace();
    private static void close(ResultSet rset)
    try
    if (rset != null)
    rset.close();
    catch (SQLException e)
    e.printStackTrace();
    public static String getUserInput(String getVal)
    Scanner sc = new Scanner(System.in);
    //for now, I'll be expecting "CustNum", "LName", "Phone", "Address"
    System.out.println("Enter " + getVal + ": ");
    String returnStr = sc.nextLine();
    return (String) returnStr;
    }

    You're new to Java, so you can be forgiven. You actually tried to do some good things, like close resources. Good for you.
    Do yourself a favor and start trying to think in terms of objects.
    Let's call that class CustomerTableGateway.
    Let's write separate methods for each kind of SQL statement you have.
    Get the logic out of the main method. It's almost useless there.
    There's a computer science principle called DRY - Don't Repeat Yourself. When you see code being repeated, see if you can find a way to rewrite it so you only do it once.
    I'd recommend that you start with a Customer class. Figure out how to map a row from your CUST table into the Customer object. Have an interface that would look like this:
    public interface CustomerDao
        Customer findById(String id);
        List<Customer> findByLastName(String lastName);
        List<Customer> findByName(String firstName, String lastName);
        List<Customer> findByEmail(String email);
        List<Customer> findByPhone(String phone);
    }Have another interface called RowMapper:
    public interface RowMapper
        Object map(ResultSet rs);
    }An implementation for one of those methods might look like this:
    public Customer findById(String id)
         Customer customer = null;
         PreparedStatement stmt = null;
         ResultSet rs = null;
         try
             stmt = this.connection.prepareStatement(FIND_CUSTOMER_BY_ID);
             stmt.setString(1, id);
             rs = stmt.executeQuery();
             while (rs.next())
                 customer = (Customer)this.customerMapper.map(rs);
        catch (SQLException e)
            e.printStackTrace();
        finally
            DatabaseUtils.close(rs);      // move those nice close methods into a utility class so you can reuse them.
            DatabaseUtils.close(stmt);
        return customer;
    }You did a pretty good job. Just go further.
    %

Maybe you are looking for

  • Want to add number of sales orders in a COPA report or form

    Hi All I created a COPA report that has two columns: sales from sales orders & sales from billing documents. Now I want to add columns which shows number of sales orders that make up sales. Can any one explain me , how can we acheive this  With a use

  • Liquify problem with Adobe Photoshop CC 2014

    I have the new Adobe Photoshop CC 2014 and I don't understand why but i don't have the center point on the middle. Can you help me ? Thanks Jennifer

  • Single not in XML file

    Hi everyone... i have a small problem...i would like to read one node in my xml file.... What is the easyest way to do that...i tried the following code...but i hot null result.. import java.io.*; import javax.xml.*; import javax.xml.parsers.*; impor

  • Link to url using open window

    Hellow to everybody, is it posible to make a get Url action, using a the java script open window, to open this url on a small size, Thanks, David

  • Webi tools within BO Edge R2 Standard

    Hi, We have Business Objects Edge R2 - Standard version with annual support subscription. We want to create and publish Webi documents and the only tool available to us is the web based webi builder, accessible via Infoview. Does BO Edge standard inc