Create table dynamically

I need help creating a table dynamically. i have a view in one database. i would like to create a table in another instance using the view structure of a view which is in another instance. the problem i am having is that some columns in the view are always null so they appear as a varchar2 datatype without lenght.
when i do an insert/select it does not create the table because of this problem. so i would like to know if anybody know how to create a script to handle this case and create my table dynamically.
there was a script in the code tips section in oracle site but i lost that script. please provide code on how to do this. thanks

Hi,
SQL> create or replace view v as
  2    select null a, to_number(null) as b, to_date(null) as c,
  3      to_nchar(null) as d,
  4      11 as e, 1.11 as f,
  5      'fff' as g, to_nchar('cvfgfg') as h, sysdate as i
  6    from dual;
View created.
SQL> DECLARE
  2    vCreate_Sql VARCHAR2(32000);
  3    vFirst_Col BOOLEAN;
  4  BEGIN
  5    vCreate_Sql := 'CREATE TABLE T (';
  6    vFirst_Col := TRUE;
  7    FOR cRec IN (
  8      SELECT Column_Name, Data_Type, Data_Precision, Data_Scale, Char_Col_Decl_Length
  9      FROM User_Tab_Columns
10      WHERE Table_Name = 'V'
11    ) LOOP
12      IF vFirst_Col THEN
13        vFirst_Col := FALSE;
14      ELSE
15        vCreate_Sql := vCreate_Sql || ',';
16      END IF;
17 
18      vCreate_Sql := vCreate_Sql || cRec.Column_Name || ' ' || cRec.Data_Type ||
19        CASE
20          WHEN cRec.Data_Type IN ('CHAR', 'VARCHAR2', 'NCHAR', 'NVARCHAR2') THEN
21            '(' || TO_CHAR(GREATEST(1, cRec.Char_Col_Decl_Length)) || ')'
22          WHEN cRec.Data_Type = 'NUMBER' THEN
23            CASE
24              WHEN cRec.Data_Precision IS NULL THEN ''
25              WHEN cRec.Data_Precision IS NOT NULL AND cRec.Data_Scale IS NULL THEN
26                '(' || TO_CHAR(cRec.Data_Precision) || ')'
27              WHEN cRec.Data_Precision IS NOT NULL AND cRec.Data_Scale IS NOT NULL THEN
28                '(' || TO_CHAR(cRec.Data_Precision) || ', ' || TO_CHAR(cRec.Data_Scale) || ')'
29            END
30            /* ... Possibly other datatypes */
31          ELSE
32            ''
33        END;
34    END LOOP;
35    vCreate_Sql := vCreate_Sql || ')';
36 
37    EXECUTE IMMEDIATE vCreate_Sql;
38  END;
39  /
PL/SQL procedure successfully completed.
SQL> desc v
Name                                      Null?    Type
A                                                  VARCHAR2
B                                                  NUMBER
C                                                  DATE
D                                                  VARCHAR2
E                                                  NUMBER
F                                                  NUMBER
G                                                  CHAR(3)
H                                                  NVARCHAR2(6)
I                                                  DATE
SQL> desc t
Name                                      Null?    Type
A                                                  VARCHAR2(1)
B                                                  NUMBER
C                                                  DATE
D                                                  VARCHAR2(1)
E                                                  NUMBER
F                                                  NUMBER
G                                                  CHAR(3)
H                                                  NVARCHAR2(6)
I                                                  DATERegards,
Dima

Similar Messages

  • Error While creating Table dynamically

    Hello gurus,
    I am trying to create a table dynamically in OA Page. For this I have added an Empty TableLayoutBean called "TestTableLayoutRN" in My PG. and In the controller's process request I have added following Code
    public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    System.out.println("TableBeanCO:ProcessRequest");
    super.processRequest(pageContext, webBean);
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    Serializable[] parameters = null;
    //am.invokeMethod("rollbackSupplier");
    OATableLayoutBean tableLayoutBean = (OATableLayoutBean)webBean.findIndexedChildRecursive("TestTableLayoutRN");
    OARowLayoutBean row = (OARowLayoutBean)createWebBean(pageContext,
    OAWebBeanConstants.ROW_LAYOUT_BEAN,null,"rowHeader");
    tableLayoutBean.addIndexedChild(row);
    OACellFormatBean cell = (OACellFormatBean)createWebBean(pageContext,
    OAWebBeanConstants.CELL_FORMAT_BEAN,null,"cellHeader");
    row.addIndexedChild(cell);
    System.out.println("TableBeanCO:End ProcessRequest");
    But I am getting null pointer exception on the Line tableLayoutBean.addIndexedChild(row);
    when I am trying to add the row to this table..
    Can you please help why I am getting this error?
    Exception Details.
    oracle.apps.fnd.framework.OAException: java.lang.NullPointerException
         at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:888)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:597)
         at oracle.apps.fnd.framework.webui.OAWebBeanTableHelper.processRequest(OAWebBeanTableHelper.java:2084)
         at oracle.apps.fnd.framework.webui.beans.table.OATableBean.processRequest(OATableBean.java:1030)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:932)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:899)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:640)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
         at oracle.apps.fnd.framework.webui.beans.layout.OAStackLayoutBean.processRequest(OAStackLayoutBean.java:350)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:932)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:899)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:640)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
         at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processRequest(OAPageLayoutHelper.java:1095)
         at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processRequest(OAPageLayoutBean.java:1569)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:932)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:899)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:640)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
         at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processRequest(OAFormBean.java:385)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:932)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:899)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:640)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
         at oracle.apps.fnd.framework.webui.beans.OABodyBean.processRequest(OABodyBean.java:353)
         at oracle.apps.fnd.framework.webui.OAPageBean.processRequest(OAPageBean.java:2298)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1711)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:497)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:418)
         at OA.jspService(OA.jsp:40)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
         at java.lang.Thread.run(Thread.java:534)
    ## Detail 0 ##
    java.lang.NullPointerException
         at xx.oracle.apps.fnd.webui.TableBeanCO.processRequest(TableBeanCO.java:79)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:581)
         at oracle.apps.fnd.framework.webui.OAWebBeanTableHelper.processRequest(OAWebBeanTableHelper.java:2084)
         at oracle.apps.fnd.framework.webui.beans.table.OATableBean.processRequest(OATableBean.java:1030)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:932)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:899)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:640)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
         at oracle.apps.fnd.framework.webui.beans.layout.OAStackLayoutBean.processRequest(OAStackLayoutBean.java:350)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:932)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:899)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:640)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
         at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processRequest(OAPageLayoutHelper.java:1095)
         at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processRequest(OAPageLayoutBean.java:1569)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:932)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:899)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:640)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
         at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processRequest(OAFormBean.java:385)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:932)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:899)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:640)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
         at oracle.apps.fnd.framework.webui.beans.OABodyBean.processRequest(OABodyBean.java:353)
         at oracle.apps.fnd.framework.webui.OAPageBean.processRequest(OAPageBean.java:2298)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1711)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:497)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:418)
         at OA.jspService(OA.jsp:40)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
         at java.lang.Thread.run(Thread.java:534)

    I am not very sure - but I seem to remember that you need to call tableBean.prepareForRendering() before you start altering it... well - dont count on my suggestion to work.. I had tried something similar 3 years ago... and speaking from what little i remember from then...

  • Creating Table Dynamically

    Hi,
    Anybodys know how to create a table(Item Layout is "table") dynamically in processRequest.
    Pls help
    regards
    Saju

    Hi Shiv,
    <p>
    My code seems right :D hehehe But please do help me debug.. my codes below... I have already the <b>MyQueryRN</b> in Pagelayout and 1rowlayout with fields. I need to add more rows by clicking add button.
    <br><br>
    <b>processRequest:</b>
    <br>
    <i>
    String searchAction = (String) pageContext.getTransactionValue("searchAction");<br>
    if (searchAction != null && searchAction.equalsIgnoreCase("Add")) {<br>
    // add a rowlayout
    String count = (String) pageContext.getTransactionValue("rowCount");<br>
    OAWebBean table = webBean.findChildRecursive("MyQueryRN");<br>
    OAWebBean row = pageContext.getWebBeanFactory().createWebBean(pageContext,
    ROW_LAYOUT_BEAN, null,
    "row".concat(count));
    table.addIndexedChild(row);<br>
    for (int i=1; i<3; i++) {<br>
    OAWebBean cell = pageContext.getWebBeanFactory().createWebBean(
    pageContext, CELL_FORMAT_BEAN, null,
    "cell".concat(count).concat("_").concat(String.valueOf(i)) );<br>
    row.addIndexedChild(cell);<br>
    if (i==1) {<br>
    OAWebBean msgText = pageContext.getWebBeanFactory().createWebBean(
    pageContext, MESSAGE_TEXT_INPUT_BEAN, null,
    "text".concat(String.valueOf(i)).concat("_").concat(count) );<br>
    cell.addIndexedChild(msgText);<br>
    } else {<br>
    OAWebBean msgChoice = pageContext.getWebBeanFactory().createWebBean(
    pageContext, MESSAGE_CHOICE_BEAN, null,
    "text".concat(String.valueOf(i)).concat("_").concat(count) );<br>
    cell.addIndexedChild(msgChoice);<br>
    }<br>
    }<br>
    }<br>
    </i>
    <br>
    <b>processForm:</b>
    <br>
    <i>
    String event = pageContext.getParameter(OAWebBeanConstants.EVENT_PARAM);<br>
    if (event != null && event.equals("Add")) {
    pageContext.putTransactionValue("searchAction", event);<br>
    String count = (String) pageContext.getTransactionValue("rowCount");<br>
    if (count != null) {<br>
    count = String.valueOf(Integer.parseInt(count) + 1);<br>
    } else {<br>
    count = "2";<br>
    }<br>
    pageContext.putTransactionValue("rowCount", count);<br>
    pageContext.forwardImmediatelyToCurrentPage(null, true,
    OAWebBeanConstants.ADD_BREAD_CRUMB_NO);<br>
    }<br>
    </i>
    </p>

  • URGENT!!!!How to CREATE TABLE dynamically

    HI all
    i want to create a table in a pl/sql procedure
    where requirement is to create a table dynamically.
    can anybody suggest me the solution.

    Why is this urgent? creating a table dynamically ought to be a rare event, required only by certain kinds of rather specialised applications.
    When people ask us how to do it in these forums, it's often because they are coming from an MS SQL background and haven't understood Oracle's concept of global temporary tables.
    Cheers, APC

  • Create table dynamically with concatanated sysdate

    Hello,
    i am trying to create a table dynamically using a sysdate concatanated i am getting an error. could anyone point me where i am doing wrong in scripts.
    here is the script.
    decalre
    x varchar2(200)
    begin
    x:='CREATE table test_'||sysdate (pname varchar2(10), pnum number(9))''';
    execute immediate x;
    end;
    appreciate any help.

    EdStevens wrote:
    Rodriguez wrote:
    Yes, of course .
    But unfortunately it is not good practice in real production systems :)Of course, the OP's entire approach, his entire design, is profoundly flawed, so why stop here?About using "interesting" identifier names in Oracle...
    An interesting problem in doing basic o-o development in PL/SQL is that all classes (object types) need to have properties. So if you want a pure abstract class with static methods, you cannot create that without defining at minimum, a single property.
    Work-around? Define a property that most PL/SQL developers will be unable to call and use even if they tend to abuse o-o classes. Define the property as a single space. E.g.
    create or replace type TSomeAbstractClass is object(
      " " smallint,
      static method function Foo1 ...
    ) not final not instantiable;:-)

  • SQL Synatx error while creating table dynamically

    I am getting error when I am trying to create table on runtime
    Declare @FileName varchar(100)
    Declare @File varchar(100)
    set @FileName='brkrte_121227102828'
    SET @File = SUBSTRING(@FileName,1,CHARINDEX('_',@FileName)-1)
    --=select @File
    Declare @table_name varchar(100)
    Declare @ssql varchar(1000)
    SET @table_name = 'DataStaging.dbo.Staging_'+ @File
    SET @sSQL = 'CREATE TABLE ' + @table_name + ' ( ' +
    ' [COL001] VARCHAR (4000) NOT NULL, ' +
    ' [Id] Int Identity(1,1), ' +
    ' [LoadDate] datetime default getdate() ' +
    Exec @sSQL 
    Error massage:-
    Msg 203, Level 16, State 2, Line 16
    The name 'CREATE TABLE DataStaging.dbo.Staging_brkrte ( [COL001] VARCHAR (4000) NOT NULL, [Id] Int Identity(1,1), [LoadDate]
    datetime default getdate() )' is not a valid identifier.
    Please help me to resolve above error
    Thankx &amp; regards, Vipin jha MCP

    Got the answer
    issue with the Exec (@sSQL) 
    thanks
    Thankx &amp; regards, Vipin jha MCP

  • Problem while creating table dynamically using stored procedure

    Hi all
    When i try to execute the following lines get insufficient privilege error.
    FYI: i m able to create table statically.(i.e without using stored procedure)
    CREATE OR REPLACE PROCEDURE pcalling IS
    str varchar2(60);
    BEGIN
    str:='create table t15(tno number,tname varchar2(5))';
    execute immediate str;
    END;
    Thanks in advance
    Satya

    hi
    SQL> CREATE OR REPLACE PROCEDURE runddl (ddl_in in VARCHAR2)
      2     AUTHID CURRENT_USER
      3  IS
      4  BEGIN
      5     EXECUTE IMMEDIATE ddl_in;
      6  END;
      7  .
    SQL> /
    Procedure created.AUTHID CURRENT_USER clause before the IS keyword which runddl executes, it should run under the authority of the invoker, or current user not the authority of the definer.
    if you omit it then it will no longer will be run if the creator doesnt have privelege to run this ddl regardless invoker has or not.
    i hope you got it
    Khurram Siddiqui
    [email protected]

  • Create tables dynamically

    Hi,
    I need to create a number of tables (with the same number of fields for each table) depending on my data.
    E.g. If I input 6 at the selection screen,
    I need to create GT_1, GT_2.... GT_6 with LINE1 TYPE C and LINE2 TYPE C as the fields.
    How to do that? Thanks.
    Regards,
    Janet

    Hi Lee,
          The following code shoul help the purpose.
    This code explains about the dynamic creation of internal table according to the input database table and displaying it in an ALV Grid. Works with all sort of database tables (even huge number of records).This concept can be expanded to work with tables that have very large number of fields.     
    By: Siva Subramanian Kalaiselvan
    Company: Wipro Technologies
    Date: 21 Jan. 2005
    Code Sample
    REPORT ZC3_DYNITABDISPALV   MESSAGE-ID zmsgdynamic.
    Description           : Dynamic internal table creation and
                            displaying in ALV Grid.
    Technical Contact     : SivaSubramanian Kalaiselvan
    Technical Spec. Number: ZC3_DYNITABDISPALV.
    Created on            : 21/01/05.
    Transport request     : PDCK902348.
    Development Class     : zc3_sivdev.
    TABLES : tadir. " table in which the obj_name field stores all the
                    " database table names
    TYPE-POOLS : slis.
    TYPES ztab LIKE dcobjdef-name .
    DATA : dyntab LIKE dntab OCCURS 0 WITH HEADER LINE,
           dref TYPE REF TO data,
           i_fcat TYPE  lvc_t_fcat ,
           wa_fcat TYPE lvc_s_fcat ,
           w_pgm LIKE sy-repid,
           count TYPE i VALUE 0,
           w_obj_name LIKE tadir-obj_name.
    DATA : wa_fieldcat TYPE slis_fieldcat_alv,  "ALV FIELD CATALOG TABLE
           i_fieldcat TYPE slis_t_fieldcat_alv, "ALV FIELD CATALOG STRUCTURE
           i_event TYPE slis_t_event,            "ALV EVENT HANDLING TABLE
           wa_event TYPE slis_alv_event,         "ALV EVENT HANDLING STRUCT
           i_listheader TYPE slis_t_listheader,  "ALV LIST HEADER TABLE
           wa_listheader TYPE slis_listheader,   "ALV LIST HEADER STRUCT
           i_layout TYPE slis_layout_alv.
    FIELD-SYMBOLS :<newtab> TYPE table.
    INITIALIZATION.
      w_pgm = sy-repid.
    ****************SELECTION-SCREEN 2000
      SELECTION-SCREEN BEGIN OF SCREEN 2000 AS WINDOW.
      SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE tit1.
      PARAMETERS:   tab_name TYPE ztab . " Enter database table name
      SELECTION-SCREEN END OF BLOCK b1.
      SELECTION-SCREEN END OF SCREEN 2000.
    ***************END OF SELECTION-SCREEN 2000
      tit1 = 'Enter Table Name?'.
    START-OF-SELECTION.
      CALL SELECTION-SCREEN 2000 STARTING AT 10 10.
      PERFORM occurcheck.
    *********CHECKING WHETHER THE DATABASE TABLE EXISTS
    FORM occurcheck.
      SELECT obj_name FROM tadir INTO w_obj_name WHERE obj_name = tab_name.
      ENDSELECT.
      IF sy-subrc <> 0.
        MESSAGE i003."Table not found in the database .
        CALL SELECTION-SCREEN 2000 STARTING AT 10 10.
        PERFORM occurcheck.
      ELSE.
        PERFORM startprocess.
        EXIT.
      ENDIF.
    ENDFORM.
    **********GETTING THE FIELD NAMES OF THE INPUT DATABASE TABLE
    FORM startprocess.
      CALL FUNCTION 'NAMETAB_GET'
           EXPORTING
                langu   = sy-langu
                tabname = tab_name
           TABLES
                nametab = dyntab. "dntab now contains the field names
    **********FILLING THE CATALOG OF NEW DYNAMIC INTERNAL TABLE
      LOOP AT dyntab.
        wa_fcat-fieldname = dyntab-fieldname.
        wa_fcat-ref_field = dyntab-fieldname.
        wa_fcat-ref_table = dyntab-tabname.
        APPEND wa_fcat TO i_fcat .
      ENDLOOP.
    ***********CREATING A POINTER (FIELD SYMBOL) TO THE INTERNAL TABLE
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog           = i_fcat
        IMPORTING
          ep_table                  = dref.
      ASSIGN  dref->* TO <newtab>.
      SELECT * FROM (dyntab-tabname) INTO TABLE <newtab>.
    **********CHECKING WHETHER DATA HAS BEEN UPLOADED.
      DESCRIBE TABLE <newtab> LINES sy-tfill.
      DESCRIBE TABLE <newtab> LINES count.
      IF sy-tfill = 0 .
        MESSAGE i001.    "Internal table is not filled
      ELSE.
        MESSAGE i002 WITH count. "Internal table is filled
      ENDIF.
    ****************EVENTS USED IN ALV
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
           EXPORTING
                i_list_type = 0  " 0-simple list, 1-hierarchial list.
           IMPORTING
                et_events   = i_event.
      SORT i_event.
      READ TABLE i_event
      WITH KEY name = slis_ev_top_of_page    "TOP_OF_PAGE event
      INTO wa_event.
      IF sy-subrc = 0.
        MOVE 'IAM_TOP_OF_PAGE' TO wa_event-form.  "IAM_TOP_OF_PAGE will
        "call  subroutine automatically
        MODIFY i_event FROM wa_event INDEX sy-tabix.
      ENDIF.
    ****************DISPLAYING ALV.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                i_callback_program = w_pgm
                i_structure_name   = dyntab-tabname
                it_events          = i_event
           TABLES
                t_outtab           = <newtab>.
    ENDFORM.
    **********FORM TOP_OF-PAGE.
    ******FILLING OF LIST HEADER TABLE
    FORM iam_top_of_page.
      CLEAR wa_listheader.
      wa_listheader-typ = 'H'.     "HEADING
      wa_listheader-info = 'ALV CREATED DYNAMICALLY'.
      APPEND wa_listheader TO i_listheader.
      CLEAR wa_listheader.
      wa_listheader-typ = 'S'.      "SUB-HEADING
      wa_listheader-key = 'PGM NAME:'.
      wa_listheader-info = w_pgm.
      APPEND wa_listheader TO i_listheader.
      CLEAR wa_listheader.
      wa_listheader-typ = 'S'.
      wa_listheader-key = 'USER:'.
      wa_listheader-info = sy-uname.
      APPEND wa_listheader TO i_listheader.
      CLEAR wa_listheader.
      wa_listheader-typ = 'S'.
      wa_listheader-key = 'DATE:'.
      wa_listheader-info = sy-datum.
      APPEND wa_listheader TO i_listheader.
      CLEAR wa_listheader.
      wa_listheader-typ = 'S'.
      wa_listheader-key = 'TABLE NAME:'.
      wa_listheader-info = dyntab-tabname.
      APPEND wa_listheader TO i_listheader.
    ********FUNCTION TO WRITE THE TITLE AND SUB-TITLE OF THE ALV.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
           EXPORTING
                it_list_commentary = i_listheader.
    ENDFORM.
    Reward if found usefull......!
    Regards,
    Ram.

  • CF creating table dynamically

    I am new to CF. I am trying to create a report  using a query to a table containing UserNum, AccountNum and TransactionDate. The report will include Transaction Month/Year and if the transaction Month/Year is the same keep it in one table, if different, place it on another table.
    Something similar to the screenshot below.  Any assistance is highly appreciated.

    I highly recommend that you start reading Ben Forta's ColdFusion books.
    http://www.amazon.com/Adobe-ColdFusion-Application-Construction-Volume/dp/032166034X/ref=s r_1_1?ie=UTF8&qid=1378086464&sr=8-1&keywords=coldfusion+9+book

  • How to create table dynamic

    Is it possible to use dynamically configure the JDO at runtime?

    Do you mean that you would like to synchronize the schema to match your
    mapping information at runtime? If so, then you could probably just invoke
    the MappingTool from your code. See the javadoc for
    kodo.jdbc.meta.MappingTool for details about the API.
    In article <bsri7l$i79$[email protected]>, netsoldier wrote:
    Is it possible to use dynamically configure the JDO at runtime?--
    Marc Prud'hommeaux [email protected]
    SolarMetric Inc. http://www.solarmetric.com

  • Formatting value in the dynamically created table

    Hi,
    I have created table dynamically.
    In that, if the columns going to be number datatype,
    <af:convertNumber pattern="##########"/> , i want to apply this pattern,
    if the column going to be date,
    <af:convertDateTime pattern="DD/mm/yyyy" /> , i want to apply this pattern.
    Code Snippet for dynamically created UI table,
    <af:table rows="#{bindings.DynamicVO.rangeSize}"
    fetchSize="#{bindings.DynamicVO.rangeSize}"
    emptyText="#{bindings.DynamicVO.viewable ? 'No data to display.' : 'Access Denied.'}"
    var="row" rowBandingInterval="0"
    value="#{bindings.DynamicVO.collectionModel}"
    selectedRowKeys="#{bindings.DynamicVO.collectionModel.selectedRow}"
    selectionListener="#{bindings.DynamicVO.collectionModel.makeCurrent}"
    rowSelection="single" id="t1">
    <af:forEach items="#{bindings.DynamicVOIterator.attributeDefs}" var="def">
    <af:column headerText="#{def.name}" sortable="true" rendered="#{def.hints.displayHint!='Hide'}"
    sortProperty="#{def.name}" id="hisc1">
    <af:outputText value="#{row[def.name]}" id="othis1">
    </af:outputText>
    </af:column>
    </af:forEach>
    </af:table>
    How to apply the pattern for the ouput text dynammically depending on the data type.
    My Jdeveloper version is 11.1.1.3.0
    Reg,
    vini

    Any help on the above scenario?

  • How to create Node, Attributes and Table Dynamically?

    Hi All,
    How to create node and attributes dynamically, and with this node i want to create table dynamically?? Any related code please?
    Thanks
    Venkat.

    HI
    I guess you are asking the same thing in some other post also .
    use the code as mentioned there also.
    data: wd_node_info type ref to if_wd_context_node_info,
    wd_node type ref to if_wd_context_node,
    lr_container type ref to cl_wd_uielement_container,
    lv_tablename type string,
    lt_db_data type ref to data,
    lr_table type ref to cl_wd_table,
    ls_attribute type wdr_context_attribute_info.
    field-symbols: <lt_data> type any table.
    wd_node_info = wd_context->get_node_info( ).
    CALL METHOD WD_NODE_INFO->ADD_NEW_CHILD_NODE
    EXPORTING
    *STATIC_ELEMENT_TYPE = 'ZDEALER'
    NAME = 'NODE'
    IS_MULTIPLE = ABAP_TRUE
    IS_INITIALIZE_LEAD_SELECTION = ABAP_FALSE
    RECEIVING
    CHILD_NODE_INFO = wd_node_info.
    wd_node = wd_context->get_child_node( name = 'NODE' ).
    wd_node_info = WD_node->GET_NODE_INFO( ).
    data dyn_attr_info type wdr_context_attribute_info.
    DYN_ATTR_INFO-NAME = 'X1'. "Attribute Name
    DYN_ATTR_INFO-TYPE_NAME = 'STRING' ." Data Element(CHAR20) ( Type Of Attribute )
    DYN_ATTR_INFO-NODE_INFO = wd_node_info.
    CALL METHOD wd_node_info->ADD_ATTRIBUTE
    EXPORTING
    ATTRIBUTE_INFO = DYN_ATTR_INFO.
    DYN_ATTR_INFO-NAME = 'X2'. "Attribute Name
    DYN_ATTR_INFO-TYPE_NAME = 'STRING' ." Data Element(CHAR20) ( Type Of Attribute )
    DYN_ATTR_INFO-NODE_INFO = wd_node_info.
    CALL METHOD wd_node_info->ADD_ATTRIBUTE
    EXPORTING
    ATTRIBUTE_INFO = DYN_ATTR_INFO.
    lr_container ?= view->get_root_element( ).
    cl_wd_matrix_layout=>new_matrix_layout( container = lr_container ).
    " Creating internal table with the same structure as our dynamic context node
    CALL METHOD CL_WD_table=>new_table
    EXPORTING
    bind_data_source = 'NODE'
    ID = 'TABLE'
    RECEIVING
    control = lr_table.
    cl_wd_matrix_head_data=>new_matrix_head_data( element = lr_table ).
    *lr_table->bind_data_source( path = 'NODE' ).
    data lr_table_col type ref to cl_wd_table_column.
    data lr_table_col1 type ref to cl_wd_table_column.
    data lr_text_view type ref to cl_wd_text_view.
    data lr_input_field type ref to cl_wd_input_field.
    DATA lr_column_name_header TYPE REF TO cl_wd_caption.
    lr_input_field = cl_wd_input_field=>new_input_field(
    bind_value = 'NODE.X1' ID = 'INP' ).
    LR_TABLE_COL = cl_wd_table_column=>new_table_column( id = 'COL1' ).
    lr_table->add_column( the_column = lr_table_col ).
    lr_column_name_header ?= cl_wd_caption=>new_caption( text = 'X1').
    lr_table_col->set_table_cell_editor(
    THE_TABLE_CELL_EDITOR = lr_input_field ).
    lr_table_col->set_header( lr_column_name_header ).
    lr_text_view = cl_wd_text_view=>new_text_view(
    bind_text = 'NODE.X2' ID = 'TXT' ).
    LR_TABLE_COL1 = cl_wd_table_column=>new_table_column( id = 'COL2' ).
    lr_table->add_column( lr_table_col1 ).
    lr_column_name_header ?= cl_wd_caption=>new_caption( text = 'X2').
    lr_table_col1->set_table_cell_editor(
    THE_TABLE_CELL_EDITOR = lr_text_view ).
    lr_table_col1->set_header( lr_column_name_header ).
    lr_container->add_child( lr_table ).
    cl_wd_matrix_head_data=>new_matrix_head_data( element = lr_table ).
    thanks
    sarbjeet singh

  • How can i edit perticular row in dynamically created table

    Hi to All,
    Here my requirement is create table dynamically from existing XML and first column with radio buttons,column data and row wise data there on XML but i'm able to create table and displaying data then whenever i click on first column radio button that row editable and remaining rows in disable mode then i edit that row and click on save button that particular row data will be inserted to XML.Please tell me how can i achieve this requirement.
    Thanks and Regards,
    surya.

    Hi surya
    - Use RadioButtonGroupByIndex for the first column.
    - Disable automatic change of table's lead selection: selectionChangeBehaviour = manual, selectionMode = none.
    - In onSelect event handler of the RadioButtonGroupByIndex set new table's lead selection from the code to the row where the button is clicked.
    - Add calculated read-only attribute isRowEditable (boolean) to the table's node. Getter shall be like this:
    return (element.index() == element.node().getLeadSelection());
    - Bind the cell editors' enabled property to isRowEditable attribute.
    BR, Siarhei
    PS: this is my message #666 - do not trust it
    Edited by: Siarhei Pisarenka on Feb 23, 2010 2:29 PM

  • Static Tables Creation In oracle & Diff Between Static table ,Dynamic table

    Static Tables Creation In oracle & Diff Between Static table ,Dynamic table

    972471 wrote:
    Static Tables Creation In oracle & Diff Between Static table ,Dynamic tableAll tables in a well designed application should be static tables.
    Whilst it's possible to execute dynamic code and therefore create tables dynamically at run time, this is considered poor design and should be avoided in 99.99% of cases... though for some reason some people still think they need to do this, and it's never really justified.
    So what issue are you facing that you need to even bother considering dynamic tables?

  • Creatin g a table dynamically....

    hi all,
    I am trying to create a table dynamically....
    but neither table is getting created nor giving error....
    can anybody help me to resolve the issue.......
    EXECUTE IMMEDIATE 'CREATE TABLE'|| 'xxce_bai_stmt_hdr_temp'||
    'AS'|| '(SELECT * FROM XXCE_BAI_STMT_HDR_IN_SB
    WHERE (intf_sender_id = l_chr_sender_id) AND
    (account_num_03 = NVL(p_in_chr_account_num,account_num_03)) AND
    (account_num_03 in(
    SELECT bank_account_num
    FROM ap_bank_accounts
    where bank_branch_id = NVL(p_in_num_bank_branch_id,bank_branch_id)
    AND (account_num_03 in
    ( select bank_account_num
    from ap_bank_accounts
    where bank_branch_id in(
    select bank_branch_id
    from ap_bank_branches
    where bank_name = NVL(p_in_chr_bank_name,bank_name)
    AND intf_status = g_chr_validated_status )';

    hello Justin,hello Hans,
    i am agree with both of you..
    that it is not a good practice to create tables
    dynamically...Cool, so we're all in agreement...
    Actually, i need to put the data into temporary table
    every time we run the procedure...Normal so far. I'm not sure whether you really mean a temporary table or a staging table, but we'll get to that later...
    i am doing a Bank Interface where in which i want to
    load the data from staging to temporary
    tables...thats why everytime whenever i run the
    procedure i need to put data in to temporary table.Do you really mean "temporary" as in "delete this data when my session goes away"? Or do you mean that you want to load the data into a permanent staging table?
    The data changes dynamically depending upon the
    parameters passed to the procedure.....The data is changing, but the set of columns in your temporary/ staging table is not. That means that you could create the table once (possibly as a temporary table), then just insert the data. Something like
    Once, when you create all your other tables
    CREATE GLOBAL TEMPORARY TABLE temp_table_name (
      <<list of columns>>
    ON COMMIT DELETE ROWSIn your code, you'd just do
    INSERT INTO temp_table_name( list_of_columns )
      <<your select statement>>
    i am using this data here after in my package...
    thats why instead of inserting the data everytime &
    at every level..And your package is free to use the data that had been loaded into the temporary table throughout the scope of the transaction/ session (depending on how you create the temp table). Since you're not dynamically creating the table, you also don't have to worry about violating transactional integrity, dropping the table if it exists, truncating the table, using dynamic SQL whenever you want to query it, etc. It's just another table that your code uses.
    i just want to create a table once in the
    package......No, just create it once. At compile time.
    Justin

Maybe you are looking for

  • Exchange 2013 - Import-TransportRuleCollection from Exchange 2007 failing

    I am in the middle of a Exchange 2007 SP3 to Exchange 2013 Sp1/CU4 migration and am importing transport rules and it's failing. [PS] C:\Windows\system32>Import-TransportRuleCollection -FileData C:\2007TransportRules.xml -Verbose Cannot process argume

  • SSAS Cube - Throws "attribute key not found" when the key exists

    Hi, I created a cube with 2 fact tables ( CabecNF and ItensNF ) and with some dimensions, in this case Cliente. When I proccess the cube it throws this error: Internal error: The operation terminated unsuccessfully. Errors in the OLAP storage engine:

  • Can we prioritise in SAP BPM

    In SAP BPM,  can we priotirize the process at runtime to hold one process and allow my critical process to run first and the other next. Thanks Prabhakar Edited by: VenkataPrabhakar Teegavarapu on Jul 19, 2011 12:09 PM

  • BSP - Portal Session Handling

    Hi all, is it possible to pass session information from one BSP to another in NW04? I am asking this because of the following problem: - calling a BSP IView opens a session and a new mode in the R3 backend system for the user requesting this BSP IVie

  • Billing Problem that can't seemed to be resolved by anyone

    So I started a family plan with Verizon about 2 weeks ago. We got a two iPhone 5s ($550) and a single iPhone6($650), price per the Verizon website. We got charged for the equivalent of 2 iPhone6 and 1 iPhone5, $100 overcharged. I called Verizon to ge