Dynamically create a class based on database tables

I am trying to build a database and tables on the fly, and save to the harddisk(done). Then I need to create a class using the info from the tables on the fly.
For example,
I built a database BANK, and a table Customer,
Customer
ID
Phoneno
Address
Could I create a class named CUSTOMER (table name)
dynamically, and have ID, PHONENO, ADDRESS,as the attributes of the class?
Could anyone help or show the direction?
Cheers.

You could use a HashMap, and use the String keys "Customer", "ID", etc, and if you have primitive values like an int, you just wrap it inside Integer or any of the other wrapper classes, because HashMap only works with objects.
Then you can use an ArrayList to hold all the records (one record is one HashMap as described above).

Similar Messages

  • Tool to create Java Object classes using the Database Tables

    Hi,
    Is their any tools or utility available to create the Java Object Classes using the Database Tables as input.
    Lets Say I am having the Employee, Employee_Salary tables in the Database.The utility has to create the Java Object classes with the relation.
    Please Help...
    Thx..

    Hm, for generating regular Java classes I wouldn't know one from memory. But I suggest you start searching in for example the Eclipse marketspace for a third party plugin that can do it. If all fail, you could always use Hibernate Tools from the Jboss Tools Eclipse plugin set to generate Hibernate/JPA entities and then strip the annotations from them to turn them into regular POJO classes.
    How many tables are we talking about anyway? It might be less effort to just create the classes with properties and then use an IDE to generate getters and setters for them.

  • How to create mass entries in a database table

    Hi,
    I am going to do a program that can help me to charge registers in a database table. The origin of the registers is an excell file, that contains 39000 entries.
    In other programs I use this function: 'ALSM_EXCEL_TO_INTERNAL_TABLE' but this function can only read 9999 registers. So I ask for us if There is another function that can help me. The other possibility that I think is call many times this function but If is possible to find another function, I guess that is better.
    Thanks and regards.

    Please allow me to translate "charge registers" into "create entries".
    This function module works quite simple via the clipboard, you could take the code and create your own version that allows more rows. However there might be a bottleneck at some point due to your local PC power.
    You could also store as CSV or TXT and use GUI_UPLOAD function or the "frontend" classes.
    For more performant processing the data would need to be transferred to the application server and uploaded from there using OPEN DATASET and so on, please search for more information.
    Thomas

  • How to generate the java classes of the database tables

    Hi,
    I am using Sun One 4 update1 CE for generate java classes of tables from an Oracle database. I have got the database schema file. However, when I right clicked on the database schema file, there is no selection for "Generate Java...".
    Besides, when I was trying to use database Schema template from the project tab in the explore window by double click on the project, after following all the procedures of inputing the database url, driver, uername, password, and select the table to generate, the following exception came out:
    Tue Jan 28 16:22:28 PST 2003: java.lang.NullPointerException: Posted StackTrace
    Annotation: Exception occurred in Request Processor
    org.openide.util.RequestProcessor$Holder: Posted StackTrace(task org.netbeans.core.ModuleActions$1@e4b7d3 [-31035, 1, -1])
    at org.openide.util.RequestProcessor$Holder.fillInStackTrace(RequestProcessor.java:300)
    at java.lang.Throwable.<init>(Throwable.java:195)
    at java.lang.Exception.<init>(Exception.java:41)
    at org.openide.util.RequestProcessor$Holder.<init>(RequestProcessor.java:280)
    at org.openide.util.RequestProcessor$Task.createHolder(RequestProcessor.java:333)
    at org.openide.util.RequestProcessor.post(RequestProcessor.java:100)
    at org.openide.util.RequestProcessor.post(RequestProcessor.java:73)
    at org.netbeans.core.ModuleActions.invokeAction(ModuleActions.java:123)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.openide.explorer.view.TreeView.invokeAction(TreeView.java:878)
    at org.openide.explorer.view.TreeView$PopupSupport.mouseClicked(TreeView.java:958)
    at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:208)
    at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:207)
    at java.awt.Component.processMouseEvent(Component.java:5096)
    at java.awt.Component.processEvent(Component.java:4890)
    at java.awt.Container.processEvent(Container.java:1566)
    at java.awt.Component.dispatchEventImpl(Component.java:3598)
    at java.awt.Container.dispatchEventImpl(Container.java:1623)
    at java.awt.Component.dispatchEvent(Component.java:3439)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3450)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3174)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3095)
    at java.awt.Container.dispatchEventImpl(Container.java:1609)
    at java.awt.Window.dispatchEventImpl(Window.java:1585)
    at java.awt.Component.dispatchEvent(Component.java:3439)
    [catch] at java.awt.EventQueue.dispatchEvent(EventQueue.java:450)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:197)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:144)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:136)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)
    Tue Jan 28 16:22:28 PST 2003: java.lang.NullPointerException: <no message>
    java.lang.NullPointerException
    at org.netbeans.modules.projects.ProjectDataObject.add(ProjectDataObject.java:204)
    at org.netbeans.modules.projects.AddNewAction.performAction(AddNewAction.java:88)
    at org.openide.util.actions.NodeAction.actionPerformed(NodeAction.java:167)
    at org.netbeans.core.ModuleActions$1.run(ModuleActions.java:105)
    at org.openide.util.Task.run(Task.java:152)
    [catch] at org.openide.util.RequestProcessor$ProcessorThread.run(RequestProcessor.java:622)
    Any suggestions to the solution of these problems are greatly appreciated. Thanks.
    Yi-Xiong

    you also could use this to generate java beans out of database tables:
         * Convert SQL type code to corresponding Java class.
         * @param sqlType One of java.sql.Types.xxx.
         * @return Class that corresponds to the given type.
        public static Class toClass(int sqlType) {
            Class result = null;
            switch (sqlType) {
            case Types.BIGINT :
            case Types.INTEGER :
            case Types.SMALLINT :
            case Types.TINYINT :
                result = Integer.class;
                break;
            case Types.BIT :
            case Types.BOOLEAN :
                result = Boolean.class;
                break;
            case Types.CHAR :
                result = Character.class;
                break;
            case Types.DATE :
            case Types.TIMESTAMP :
                result = java.util.Date.class;
                break;
            case Types.DECIMAL :
            case Types.DOUBLE :
            case Types.FLOAT :
                result = BigDecimal.class;
                break;
            case Types.NULL :
                result = null;
                break;
            case Types.LONGVARCHAR :
            case Types.VARCHAR :
            default :
                result = String.class;
                break;
            return result;
        }//toClass()
         * Create a Java bean (source file) to map a database table. The class name is the table name, the bean
         * properties are the table columns. Each column will result in a property with a corresponding set() and
         * get() method.
         * @param connection Database connection to load table from.
         * @param tableName Name of table to create the bean for.
         * @param packageName Name of package for Java class.
         * @param className Name of Java class to create.
         * @param superClass Optional name of super class.
         * @return Java source of container class.
         * @throws SQLException, IOException
         * @see <a href="http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html">Data Access Object </a>
        public static String getTableBean(Connection connection, String tableName, String packageName, String className, String superClass)
                throws SQLException, IOException {
            String result = null;
            if (connection != null && tableName != null) {
                //read table columns:
                DatabaseMetaData dmd = connection.getMetaData();
                ResultSet resultSet = dmd.getColumns(null, "%", tableName, null);
                Properties props = new Properties();
                if (resultSet != null) {
                    while (resultSet.next()) { //for each table
                        String name = resultSet.getString("COLUMN_NAME");
                        int type = resultSet.getInt("DATA_TYPE");
                        props.setProperty(name, ""+type);
                    }//next table
                }//else: resultSet unavailable
                Set imports = new HashSet();
                StringBuffer sb1 = new StringBuffer(); //fields
                StringBuffer sb2 = new StringBuffer(); //methods
                StringBuffer sb3 = new StringBuffer(); //toString()
                Enumeration enum = props.keys();
                while (enum.hasMoreElements()) {
                    String columnName = (String) enum.nextElement();
                    //change first character of column name to lower case:
                    String fieldName = columnName.substring(0, 1).toLowerCase() + columnName.substring(1);
                    //datat type:
                    String stype = props.getProperty(columnName, ""+Types.VARCHAR);
                    int type = (new Integer(stype)).intValue();
                    Class javaClass = toClass(type);
                    String typeName = "String"; //default
                    if (javaClass != null) {
                        String javaClassName = javaClass.getName();
                        int lastDot = javaClassName.lastIndexOf('.');
                        if (lastDot >= 0) {
                            typeName = javaClassName.substring(lastDot + 1);
                        if (!javaClassName.startsWith("java.lang.")) {
                            imports.add(javaClassName);
                    //field:
                    sb1.append("    /** ");
                    sb1.append(columnName);
                    sb1.append(" */\n");
                    sb1.append("    private ");
                    sb1.append(typeName);
                    sb1.append(" ");
                    sb1.append(fieldName);
                    sb1.append(" = null;\n");
                    //toString() method:
                    sb3.append("        sb.append(\",");
                    sb3.append(fieldName);
                    sb3.append("=\");\n");
                    sb3.append("        sb.append(");
                    sb3.append(fieldName);
                    sb3.append(");\n");
                    //set method:
                    sb2.append("    /**\n");
                    sb2.append("     * Set ");
                    sb2.append(columnName);
                    sb2.append(".\n     *\n     * @param value ");
                    sb2.append(columnName);
                    sb2.append(" to set.\n");
                    sb2.append("     */\n");
                    sb2.append("    public void set");
                    sb2.append(columnName);
                    sb2.append("(");
                    sb2.append(typeName);
                    sb2.append(" value) {\n        ");
                    sb2.append(fieldName);
                    sb2.append(" = value;\n    }\n\n");
                    //get method:
                    sb2.append("    /**\n");
                    sb2.append("     * Get ");
                    sb2.append(columnName);
                    sb2.append(".\n     *\n     * @return ");
                    sb2.append(columnName);
                    sb2.append(".\n     */\n");
                    sb2.append("    public ");
                    sb2.append(typeName);
                    sb2.append(" get");
                    sb2.append(columnName);
                    sb2.append("() {\n");
                    sb2.append("        return ");
                    sb2.append(fieldName);
                    sb2.append(";\n    }\n\n");
                }//next column
                //build class source code:
                StringBuffer sb = new StringBuffer();
                sb.append("/* $Header: /data/iComps/icf/prg/java/src/de/icomps/sql/JDBCUtils.java 9     24.10.03 14:25 Hilpert $ */\n");
                sb.append("package ");
                sb.append(packageName);
                sb.append(";\n\n");
                //import statements:
                Iterator iterator = imports.iterator();
                while (iterator.hasNext()) {
                    String jcn = (String) iterator.next();
                    sb.append("import ");
                    sb.append(jcn);
                    sb.append(";\n");
                if (imports.size() > 0) {
                    sb.append("\n");
                //class:
                sb.append("/**\n");
                sb.append(" * Container class to store data of one record (row) of table '"+tableName+"'.\n");
                sb.append(" *\n");
                sb.append(" * @version $Revision: 9 $ ($Date: 24.10.03 14:25 $)\n");
                sb.append(" * @author $Author: Hilpert $\n");
                sb.append(" */\n");
                sb.append("public class ");
                sb.append(className);
                if (superClass != null) {
                    sb.append(" extends ");
                    sb.append(superClass);
                sb.append(" {\n\n");
                //fields:
                sb.append(sb1.toString());
                //methods:
                sb.append("\n\n");
                sb.append(sb2.toString()); //methods
                //overwrite toString() method:
                sb.append("    /**\n");
                sb.append("     * Overwrite super.\n");
                sb.append("     *\n     * @return String representation of the object.\n");
                sb.append("     */\n");
                sb.append("    public String toString() {\n");
                sb.append("        StringBuffer sb = new StringBuffer(super.toString());\n\n");
                sb.append(sb3.toString());
                sb.append("\n        return sb.toString();\n");
                sb.append("    }\n\n");
                sb.append("}//"+className);
                result = sb.toString();
            }//else: input unavailable
            return result;
        }//getTableBean()

  • How to create object class for a z table

    Hi All,
    I have a z table and I want to register the changes of fields should be logged to CDHDR and CDPOS table.
    Is this possible?
    If yes how can I creat an object class for a z table. I have already checked the change document option in z data element.
    Please help.
    Regards,
    Jeetu
    Moderator message: standard functionality, please search for available information/documentation before asking.
    locked by: Thomas Zloch on Oct 6, 2010 6:16 PM

    Tcode SCDO. You'll need to create a change document for you Z table and then use the FM created to record the changed data.

  • Create a data source and database tables using WSAD

    Hi, guys:
    the following is from a tutorial:
    http://www-106.ibm.com/developerworks/websphere/techjournal/0306_wosnick/wosnick.html
    "To create the data source and Cloudscape database tables automatically, right click on the HelloWorldServer in the Servers view, and select the Create tables and data sources menu item. A dialog will then display showing that the data source and database tables were created successfully (Figure 5)."
    I am using WSAD 5.0 trial version. I cannot find Create tables and data sources menu item if I right click on the HelloWorldServer in the Servers view. I am wondering if this is because trial version does not have this feature?
    regards

    This question is a little off topic but you may get a reply. Please note this forum is about Sun's J2EE SDK and its related technologies. You may have better luck posting your question to an IBM specific resource.

  • Cannot create dynamic page with cursor based on linked table

    I get the following error when i try to create a dynamic portal page that uses a pl/sql cursor:
    ORA-06550: line 1, column 24:
    PL/SQL: ORA-00980: synonym translation is no longer valid
    ORA-06550: line 1, column 24:
    PL/SQL: SQL Statement ignored (WWV-11230)
    Failed to parse as REPORTS - DECLARE CURSOR C1 IS SELECT * FROM
    [email protected]; BEGIN FOR R1 IN C1 LOOP HTP.P(','||'<BR>');
    END LOOP; END; (WWV-08300)
    Dynamic page:
    <HTML>
    <HEAD>
    <TITLE>Example</TITLE>
    </HEAD>
    <BODY>
    <H2>Example of A Dynamic Page</H2>
    <ORACLE>
    declare
    cursor c1 is
    select * from [email protected];
    begin
    for r1 in c1 loop
    htp.p('hello<br>');
    end loop;
    end;
    </ORACLE>
    </BODY>
    </HTML>
    When i use the sql query from the cursor in the page below, i get no errors:
    <HTML>
    <HEAD>
    <TITLE>Example</TITLE>
    </HEAD>
    <BODY>
    <H2>Example of A Dynamic Page</H2>
    <ORACLE>select * from [email protected]</ORACLE>
    </BODY>
    </HTML>
    I tried a dynamic page with a cursor on session_roles and had no problems. I assume that there is an issue with the database link or the privileges. The queries seem to get executed under portal_public;
    Oracle Portal Version: 9.0.4.0.99

    I get the following error when i try to create a dynamic portal page that uses a pl/sql cursor:
    ORA-06550: line 1, column 24:
    PL/SQL: ORA-00980: synonym translation is no longer valid
    ORA-06550: line 1, column 24:
    PL/SQL: SQL Statement ignored (WWV-11230)
    Failed to parse as REPORTS - DECLARE CURSOR C1 IS SELECT * FROM
    [email protected]; BEGIN FOR R1 IN C1 LOOP HTP.P(','||'<BR>');
    END LOOP; END; (WWV-08300)
    Dynamic page:
    <HTML>
    <HEAD>
    <TITLE>Example</TITLE>
    </HEAD>
    <BODY>
    <H2>Example of A Dynamic Page</H2>
    <ORACLE>
    declare
    cursor c1 is
    select * from [email protected];
    begin
    for r1 in c1 loop
    htp.p('hello<br>');
    end loop;
    end;
    </ORACLE>
    </BODY>
    </HTML>
    When i use the sql query from the cursor in the page below, i get no errors:
    <HTML>
    <HEAD>
    <TITLE>Example</TITLE>
    </HEAD>
    <BODY>
    <H2>Example of A Dynamic Page</H2>
    <ORACLE>select * from [email protected]</ORACLE>
    </BODY>
    </HTML>
    I tried a dynamic page with a cursor on session_roles and had no problems. I assume that there is an issue with the database link or the privileges. The queries seem to get executed under portal_public;
    Oracle Portal Version: 9.0.4.0.99

  • How to create a user in SQL database table for FBA in SharePoint 2013

    Hi,
    I am trying to configure Form Based Authentication on my SharePoint Dev machine. The purpose is to add an external user to a table (using a registration page).The provider used is SQLMembershipProvider.The dev machine is also configured as domain controller
    so all users created locally are AD users.
    Reference articles that i checked are
    Either adding users to the database as a windows user (i.e. under users section in the database). But on my machine, windows user would be same as adding a AD user.
    Or by creating a dedicated IIS site for .Net users (after creating a FBA DB using aspnet_sql tool). Right now i have implemented FBA using this method.
    Is it possible to add user details in a table of choice and then access that user using people picker? (without any third party tools).
    Thanks,
    Thomas

    Hi,
    We can use CreateUserWizard control to achieve it.
    Here is a blog for your reference:
    Adding Users With SharePoint Forms Based Authentication
    http://psterpe.wordpress.com/2009/05/24/adding-users-with-sharepoint-forms-based-authentication/
    Best Regards
    Dennis Guo
    TechNet Community Support

  • Create generic extractor based on 2 tables

    hey BI gurus,
    I have to create a generic extractor based on these 3 tables:
    eban - i need all fields
    vttk - i need only 4 fields i.e
                                         route,
                                         tknum,
                                         datbg,
                                         daten
    ekbe - budat.
    now the problem is thr is no common field between vttk & eban AND vttk & ekbe. but thr is a common field between eban & ekbe.so i can create a view only on these 2 tables but i want 3 tables
    how do i proceed???

    Hi,
    Sometimes, if your application or requirement makes it necessary, you have to create your own function module to extract the data from whatever sap system to bw.
    Therefore you normally make a copy of the standard fm 'RSAX_BIW_GET_DATA_SIMPLE'. To make this new function work for you, you have to realize the following.
    1.) the fm gets called by the extraction api for at least 2 times. First time is for initialization and from the 2nd time on it is for data extraction.
    2.) right after the last data package (somehow you need to make sure that it is the last one) you have to raise the exception no_more_data.
    Refer this links for more Info
    SAP BI Generic Extraction Using a Function Module
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a0f46157-e1c4-2910-27aa-e3f4a9c8df33
    SAP Network Blog: Generic Extraction via Function Module
    /people/siegfried.szameitat/blog/2005/09/29/generic-extraction-via-function-module
    Take the help of an ABAPer if your are new to this process
    Regards
    Karthik
    Assigning points is the way to say thanks

  • Can I create a view based on two tables that have the same column name?

    I have two tables A and B. Each table has 50+ columns.
    I want to create a view that includes all the columns in A and all the columns in B. I created a view with a select statement that says
    Select A.*, B.*
    From A, B
    where A.id = B.id
    It returns an error because in each table I have a column that keeps track if a record has been changed called Modified_By. That's where it chokes up on I figure. I would like to write the view without explicitly writing each column name from A and B as part of the select statement. The actual select statement works fine and only bombs when trying to turn the select statement into a view.

    You will have to type the full column list at least once. You can save a few keystrokes (i.e. alias. on every column) by providing the column names to the CREATE part instead of in the SELECT part. Something like:
    SQL> desc t
    Name                                      Null?    Type
    ID                                                 NUMBER
    NAME                                               VARCHAR2(10)
    SQL> desc t1
    Name                                      Null?    Type
    T_ID                                               NUMBER
    LOC_ID                                             NUMBER
    NAME                                               VARCHAR2(15)
    SQL> CREATE VIEW t_v (id, t_name, t_id, loc_id, t1_name) AS
      2  SELECT t.*, t1.*
      3  FROM t, t1
      4  WHERE t.id = t1.t_id;
    View created.HTH
    John

  • How to create af:tree from single database Table

    Hi,
    i want to create tree Like this: and also we can add node anywhere.
    Parent01
    ----|parent01-child01
    --------|parent01-child01-child01
    --------|parent01-child01-child02
    -------------|parent01-child01-child02-child01
    Parent02
    ----|parent02-child01
    ----|parent02-child02
    --------|parent02-child02-child01
    and for this i have created Table like this :
    Table name Treetable
    NODEID     NUMBER(38,0) --> Primary Key
    NODENAME     VARCHAR2(50 BYTE) --> This is the name will display as a node
    DESCRIPTION     VARCHAR2(255 BYTE)     
    ROOTIND     CHAR(1 BYTE) --> to decide root node
    SEQUENCENO     NUMBER(38,0)     --> order to display node
    PARENTKEY     NUMBER(38,0) -->FK (refering to NODEID(PK) of this table)
    But when i am creating tree, its showing root node for each row in the table. but my requirement is: The Row marked as ROOTIND='Y' , show that row only as Root (Example in above tree:Parent01 & Parent02 )
    any help highly appreciated :)
    Thanks
    Pratap Rudra
    Edited by: 995114 on Apr 30, 2013 2:50 PM

    Hi,
    check this http://www.oracle.com/technetwork/developer-tools/adf/learnmore/32-tree-table-from-single-vo-169174.pdf
    Frank

  • APEX  How do I create a Form based on a Database Table from other schema

    My APEX schema is WISEXP. I have a database table that resides in WISDW schema on the same database. I want to create Tabular form based on this table.
    I am not able to create a FORM based on the table from WISDW schema. I am able to create a FORM based on SQL though from this table in WISDW schema - but it does not do any action on Update/Insert rows.
    Appropriate Synonyms and grants are created. Is there a limitation or am I missing something? Please advise.
    thanks
    Rupen

    If Rupen is using 2.2 or 2.2.1, it is likely he is running into the bug described here: Re: Workspace to Schema Assignments
    In that case, it may be a necessary and sufficient workaround to assign the foreign schema to the workspace.
    Scott
    Message was edited by:
    sspadafo

  • Dynamic Selection Screen based on database seletion

    Hi, Gurus:
    I just have simple selection screen with a few radio buttons
    However, I would like the radio button show up based on database table criterias:
    e.g. if there is no data in table1, the radio button 1 will not showing up.
    I have used "SELECT * from table..." and check the return value sy-subrc, if it is not equals 4 (4 means no data in the table), then I put the radio button clause there.
    however, it does not work this way.
    Thanks in advance
    Liang

    Hi,
    This is a duplicate thread, similar kind of thread is already available .....
    with the subject    :    Dynamic calling of radiobuttons
    anyways,
    possibly you can think of two ways,
    say at the maximum the entry in the database table goes to 20 records and you know that it will not go more than that,
    then you can create 20 radiobuttons and using at selection-screen output events hide radiobuttons based on the records present.
    say only 4 records are present.
    so hide 16 radiobuttons and display only 4 of them.
    the other way.
    say if there can be n number of records and you dont know the maximum number it can reach then
    in the initialization event.
    create a report at runtime with the parameter statement as radiobutton .
    and then call that report in initialization event itself. this will display the dynamically created radiobutton.
    Regards,
    Siddarth

  • Dynamically creating a Record Group based on Previously entered Record Grou

    Forms [32 Bit] Version 10.1.2.3.0 (Production)
    Hi,
    I know how to dynamically create a record group based on a query and putting the code in When new form instance.
    My query is. I have a form which has multiple Record Groups and the user wants to dynamically create subsequent groups based on previous groups.
    For example
    I have a record group with selects a Location,
    when the user selects the Location from a list of values
    the 2nd record group called 'Cost Centres' will have to filter out only those with the locations selected above.
    How can I populate the 2nd record group at run-time when I do not know what site the user will select?
    If I simply populate in when new form instance as in location and just select everything, the list of values populates.
    CC field is a LIST ITEM and the list style is a POP LIST, it is not required.
    I have put the code in the Location field in the when-list-changed trigger.
    I am getting this error:
    frm-41337: cannot populate the list from the record group
    here is the code:
    DECLARE
    v_recsql Varchar2(1000); -- The SQL for creating the Record Group.
    v_recgrp RecordGroup; -- Record Group
    v_status Number; -- Return Value of Populate_Group function.
    c_where VARCHAR2(1000);
    BEGIN
         IF :location = '1' THEN
              c_where := ' substr(cost_centre,1,2) in (''01'',''02'')';
         ELSIF :location  = '2' THEN
              c_where := ' substr(cost_centre,1,2) in (''02'',''03'')';
         ELSIF :location   = '3' THEN
              c_where := ' substr(cost_centre,1,2) in (''01'',''11'',''07'')';
                   ELSE
              c_where :=  ' 1=1'; --EVERYTHING
         END IF;
    v_recsql := 'SELECT cost_centre, description  FROM   cost_centres  where '||c_where;
    -- Create the Record Group
    v_recgrp := CREATE_GROUP_FROM_QUERY('v_recgrp', v_recsql);
    IF NOT ID_NULL(v_recgrp)
    THEN -- No Error, record group has been successfully created.
    -- Populate Record Group
    v_status := POPULATE_GROUP('v_recgrp');
    IF v_status = 0
    THEN -- No Error. Record Group has been Populated.
    POPULATE_LIST('block.CC', 'v_recgrp');
    END IF; -- IF v_status = 0
    -- Delete the Record Group as it is no longer needed.
    DELETE_GROUP('v_recgrp');
    END IF; -- IF NOT ID_NULL(v_recgrp)
    END;thanks for your assistance.

    Hi,
    Once record status gets change for block you can not populate/repopulate the list item. Keep those list items as non-database item with different names and create different items as database orignal items. Than assign the values in WHEN-LIST-CHANGE trigger to the actual database items.
    -Ammad

  • How to create a new field in predefined database table

    Hi friends,
    now i am working on scripts. In script form i have got a new field(vehicle number in goods receipt against purchase order) which is not available in any table.  i think we have to create a new field in database table.how to create  field in a pre defined data base table.

    Hi,
    To add new field to table, there are two option.
    1.Include structure and
    2. append struct..
    the best way is append structure.
    goto se11>give your table name>there is append structure button, when you will click on it, it will create a 'append  structure',
    after activating it, it will add fields to your table.

Maybe you are looking for

  • Creation of Control Problem: List of application EJB is empty

    Hello ! Could anybody assist me to solve this problem ? When I try to create EJB Control I can't receive list of application EJB. I'm receiving message no resources found in corresponding dialog for ejb's list. I can't understand what happened with a

  • How to display today's date in a textfield?

    Hi all, I have a textfield and it is a page item P18_DOJ.By defalut I want to display today's date in that textfield and it is should be readonly.How do i do that?

  • ITunes library not arranging songs in order

    Hi, I was wondering, on my PC, iTunes is not arranging the songs in one particular album in the correct order. (ie. like in the track order on my actual CD.) I have tried adding them to the library again, I checked that all of the tracks have a numbe

  • How to use an existing WD view in an External Window

    Hello !!! Is there a solution to the below problem. Say "view1", "view2" are embeded in "window1". Now create a new window "window2" and embed the existing view "view1" into "window2". Now show the "window2" as a popup when a button in "view2" is pre

  • Correlation editor.

    Hi Experts,            I was thrying to see the posibilities of the correlation editor In IR- integration Process- view - corelation editor. I would like to know what is the capability of this editor. say 2 incoming files, File 1 and File 2  are comi