Dynamic iterating over table columns

hello there,
i have to create a string depending on the values in my table columns. this string creation is used on different tables with different number of columns and different column types.
so i want to write a procedure which does simplified the following:
1. create dynamic rowtype with a select statement
2. iterate over rowtype columns and append column value to a string
3. insert the created string in another table.
by trying this dynamically for any table i run in the following two issues:
1. creation of a rowtype needs the tabletype
2. no iterating over rowtype possible
are their any ideas to solve this issue. or do i have to write a procedure for every table i use.
regards,
rené

You can do it with a single, generic procedure using DBMS_SQL.
Joe Fuda
SQL Snippets

Similar Messages

  • Dynamic Component in Table Column

    JDev 11.1.1.6
    Can anyone give me guidance on how to change the component that a table column uses at runtime?
    Basically, I want to have an Input Text on Column B when the value on the Output Text on Column A is within a list of strings.
    Otherwise, I want to have an image on Column B.
    Here is the long-winded scenerio:
    I have a table with 2 columns (Column A and Column B).
    Column A is an OutputText.
    Column B is an InputText.
    The user is only allowed to enter data into Column B when Column A is 'A', 'B', or 'C'.
    If Column A is something other than 'A', 'B', or 'C', I would like to display an image in Column B that alerts the user that they cannot enter any data in this field.
    I tried making the InputText read only, but that doesn't look very good.
    Any help would be appreciated.
    Ray

    You can add image component to the same column and use rendered property on both af:inputText and af:image to show/hide them.
    Dario

  • Dynamic binding for table column

    Hi,
    I am using standard application and in a table (not ALV) i want to chnage the name of a column. Already a OTR is placed in it so am planning to do a dynamic bind for the text in the header. Kindly suggest ways.
    Thanks,
    Koushik

    DATA:
            l_caption          TYPE string,
            l_title            TYPE string.
      data lr_caption type ref to cl_wd_caption.
    *---Get OTR Text for Value Description
      CALL METHOD cl_wd_utilities=>get_otr_text_by_alias
        EXPORTING
          alias      = 'ZPERF_MGMT_DEV/RATING'
      language   =
        RECEIVING
          alias_text = l_title.
    lr_caption ?= view->get_element( 'TBL_VAL_HELP_DESCRIPTION_HEADER' ).
    lr_caption->set_text( value = l_title ).

  • Open a Dynamic URL from a Table column link

    Hi,
    Jdev Version (11.1.1.6.0)
    I have requirement to open a dynamic URL from table column. Any time I click on link, it should generate dynamic URL based on column attribute and open in popup or browser. Can someone pls suggest how to achieve this.
    Thanks
    Ank

    1)If you have any parameters that needs to be passed to build that dynamicURL, just set a propertyListener on the column attribute and get the value.
    2)Then on the af:commandLink action, build your dynamicURL with the required parameters.
    3) If you URL is all together a different application which doesn't share your transaction, you can open it as below
    In the below code, urlWithParams will be your dynamicURL.
    ExtendedRenderKitService erks =
    Service.getRenderKitService(facesContext, ExtendedRenderKitService.class);
    StringBuilder sbURL = new StringBuilder();
    sbURL.append("window.open(\"" + urlWithParams + "\");");
    erks.addScript(facesContext, sbURL.toString());
    You can also try the above response by user 948181.
    Hope it helps.

  • Dynamically changing the Advance table column Header.

    Dear All,
    I want to change dynamically the Advance table column header.
    I tried the below code and its working process request,not in process form request when button pressing.
    Please suggest me.
             OAAdvancedTableBean tableBean =
                               (OAAdvancedTableBean)webBean.findIndexedChildRecursive("advanceTableRN");
                           if (tableBean != null) {
                           System.out.println("tableBean");
                               OAColumnBean columnBean =
                                   (OAColumnBean)tableBean.findIndexedChildRecursive("column3");
                               if (columnBean != null) {
                                   System.out.println("columnBean");
                                   OASortableHeaderBean colHeaderBean =
                                       (OASortableHeaderBean)columnBean.getColumnHeader();
                                   if (colHeaderBean != null) {
                                       System.out.println("colHeaderBean");
                                       colHeaderBean.setText("Segment3");

    You can try 2 options:
    1. Try to call pageContext.forwardImmediatlytoCurrentPage();
    2. Try yo set a vo attribute to the columnbean text property and set the vo attribute programmatically. (I have not tried this but I think it should work)
    Cheers
    AJ

  • Drop-down menu in table cells - how to expand over the column width?

    Hello!
    A client is migrating their 2,400 forms from old JetForms to PDF (LiveCycle Designer) and would like to keep the same functionalities he's used to in the old platform. However, some of the old tool features do not seem to be present in LiveCycle.
    Suppose a drop-down menu in a table cell, containing items which lengths are bigger than the table column. In JetForm, when you open the drop-down it spans over the columns to show all its contents, not cutting the drop-down list contents.
    I tried this in LiveCycle, but the drop-down gets cut and its contents are limited to the table column (hence the drop-down menu) width.
    Is there a way to work around this limitation, even if I have to use some scripting?
    Thank you for any ideas!
    Marcos

    Hi again, Niall!
    Thank you again for your great examples!
    The dynamic width drop-down will cover some of the client's expectations.
    However, they would like it to work even when the drop-down is within a table cell with a width smaller than the width they want the drop-down to show when the mouse enters the field.
    I'm afraid you will say this is not possible... Or at least not without a lot of coding, using subforms or the like.
    Any ideas? 
    Thank you very much!
    Marcos

  • Dynamic table columns...

    hi there,
    i have a table on my webdynpro with several columns displaying values in EUR with 2 decimals.
    now my customer wants to be able to switch between EUR and Thousand-EUR. When Thousand-EUR is displayed ther should be no decimals visible anymore. How can i achieve that? in my context-node the values are defined with 2 decimals. is it possible to change types of context-attributes dynamically? or is there another way to achieve that.
    david

    Hi,
    Suppose ur text view element ID contained in a particular table column is 'TXT_VIEW_AMOUNT'.
    then you get its reference like this in domodifvview
    data: lo_text_view type ref to cl_Wd_text_view.
    lo_text_view ?= view->get_element( 'TXT_VIEW_AMOUNT' ).
    then call the corresponding bind_text method
    lo_text_view->bind_text( path = 'DATA.AMOUNT ). "here DATA.PATH is attribute path
    Hope this helps
    Regards
    Manas Dua

  • SQL from Table Column with Dynamic URL Problem

    This is the SQL I'm attempting to save to a table column via the Object Browser;
    select
    "a"."PBR_BRIEF_ID" "Brief ID",
    "a"."PROJECT_NUMBER" "Project",
    "b"."DESCRIPTION" "Description",
    "b"."ACTUAL_END_DATE" "Actual End",
    "b"."RFS_DATE" "RFS",
    "b"."LOCATION_CODE" "Location",
    ''||"b"."ESA_CODE"||'' "ESA",
    "b"."PROJECT_USER_STATUS" "Status",
    "b"."PROJECT_TRIGGER" "Trigger"
    from
    UPT1TRIAL.FUND_PLAN_BRIEF_LINK_CCR@NDSD "a",
    UPT1INTEGRAL.INT_PROJECT_DATA@NDSD "b"
    where
    "a"."PBR_BRIEF_ID" = :P3_BRIEF_ID and
    "a"."PROJECT_NUMBER" = "b"."PROJECT_DEFINITION_NUMBER"
    The intesting bit is the following, where a URL is return behind a particular column;
    ''||"b"."ESA_CODE"||'' "ESA",
    It's interesting because when I click on "Apply Changes" in the Object Browser, the text that appears in the column is as follows, i.e. with APP_ID and SESSION populated;
    ''||"b"."ESA_CODE"||'' "ESA",
    Why would that happen??
    The full SQL above is used in an application page with a SQL Query (PL/SQL function body returning SQL query). The basic SQL works OK but because of what the Object Browser is doing, the link does not.
    Message was edited by:
    Damian - apologies for lack of formatting!!
    Message was edited by:
    Damian

    Damian,
    Use
    & lt;
    for your < tags and then the message will appear in the proper format.
    If you are using dynamic sql to generate an url with APP_ID and SESSSION you could:
    a) create page items (P1_APP_ID and P1_SESSION)
    b) compute those page items to the actual APP_ID and SESSION_ID
    c) use the value of those items while generating your dynamic sql (instead of APP_ID and SESSION)
    Then, your links will show the right APP_ID and the right SESSION.
    Denes Kubicek

  • Dynamic table column creation

    Hi All,
    I am trying to create a table where the number of columns is equal to the number of entries in an output table in my context. How do I go about creating columns dynamically dependant on the number of entries in a table?
    Kind regards
    Seb

    If you really need to create table columns programmatically, you can do this in the wdDoModifyView() method of the view controller.
    Store the configuration data for the columns in the view controller context and write some code like the following:
    private static void addColumn(IWDTable table, String id, String attributeName)
      IWDTableColumn column = (IWDTableColumn)
        table.getView().createElement(IWDTableColumn.class, id);
      IWDInputField editor = (IWDInputField)
        table.getView().createElement(IWDInputField.class, null);
      column.setTableCellEditor(editor);
      editor.bindValue(attributeName);
      table.addColumn(column);
    public static void wdDoModifyView(
      IPrivateXYZView wdThis,
      IPrivateXYZView.IContextNode wdContext,
      com.sap.tc.webdynpro.progmodel.api.IWDView view,
      boolean firstTime)
      //@@begin wdDoModifyView
      if (<table needs to be recreated>)
        IWDTable table = (IWDTable)      
          view.getElement(<tableID>);
        table.destroyAllColumns();
        addColumn(table, "columnA", "attributeA");
        // etc.
      //@@end
    This assumes you have created the table itself during design time and bound its data source already. If needed, this can also be done programmatically.
    Armin

  • Dynamic table column editing

    Hi,
    I made a VO with quite complex query (nested subqueries linked with inner join) and when I dragged it from Data Control to the page I didn't get the familiar context menu with implementation options I used to get it earlier.
    Instead of, I got an implemented table with following structure:
    - af:table - t3
    - af:forEach
    - af:column - #{...}
    - af:outputText - #{...}
    Did I get a dynamic table?
    My problem is that I cannot get the list of attributes from VO query and then to edit table columns.
    They are shown in table at runtime but with default properties. I can set up af:column options generally but I need to set up all of the attributes individually.
    Is this a query-level problem or there is another way doing this?
    Regards,
    Aleksandar Čkrebo

    Hi,
    I made a VO with quite complex query (nested subqueries linked with inner join) and when I dragged it from Data Control to the page I didn't get the familiar context menu with implementation options I used to get it earlier.
    Instead of, I got an implemented table with following structure:
    - af:table - t3
    - af:forEach
    - af:column - #{...}
    - af:outputText - #{...}
    Did I get a dynamic table?
    My problem is that I cannot get the list of attributes from VO query and then to edit table columns.
    They are shown in table at runtime but with default properties. I can set up af:column options generally but I need to set up all of the attributes individually.
    Is this a query-level problem or there is another way doing this?
    Regards,
    Aleksandar Čkrebo

  • Dynamic entry list used in a table column

    On a form, we noticed a dynamic entry list will limit which values a user may enter by validating against the entry list values.  We need to have the same validation occur when a dynamic entry list is used in a table column. Has anyone had success in getting the dynamic entry list to validate the cell values in a table column?

    Hey Dan,
    You are right.... Its a bug... we are also using VC CE 7.1 SP 05....
    When I try in form (with combo box) its working fine...I mean its giving error saying "Character string "4" does not exist in the allowed set of values and its not forwarding any values...
    but when I use it in table, its not giving any error.
    I saw some demos where it was working fine... but those are older sp versions of CE 7.1...
    Try to contact SAP VC team on this....
    PradeeP
    Edited by: pradeep bondla on Oct 6, 2010 12:06 AM

  • Appending column to an dynamically created internal table

    Hi folks,
    i have an dynamically created internal table <dyn_tab> which is based on a parameter p_table (  containing the table name ). now i want to add one more column to this <dyn_tab> table where i can store further information in. how can i do that ?
    i appreciate your help!

    Hi,
    Please check this sample program.
    type-pools : abap.
    field-symbols: <dyn_table> type standard table,
                   <dyn_wa>,
                   <dyn_field>.
    data: dy_table type ref to data,
          dy_line  type ref to data,
          xfc type lvc_s_fcat,
          ifc type lvc_t_fcat.
    selection-screen begin of block b1 with frame.
    parameters: p_table(30) type c default 'T001'.
    selection-screen end of block b1.
    start-of-selection.
      perform get_structure.
      perform create_dynamic_itab.     
    form get_structure.
      data : idetails type abap_compdescr_tab,
           xdetails type abap_compdescr.
      data : ref_table_des type ref to cl_abap_structdescr.
      * Get the structure of the table.
      ref_table_des ?= 
          cl_abap_typedescr=>describe_by_name( p_table ).
      idetails[] = ref_table_des->components[].
        loop at idetails into xdetails.
        clear xfc.
        xfc-fieldname = xdetails-name .
        xfc-datatype = xdetails-type_kind.
        xfc-inttype = xdetails-type_kind.
        xfc-intlen = xdetails-length.
        xfc-decimals = xdetails-decimals.
        append xfc to ifc.
      endloop.
    *Add your new field(s) into table ifc here.
    endform.
    form create_dynamic_itab.
    * Create dynamic internal table and assign to FS
      call method cl_alv_table_create=>create_dynamic_table
                   exporting
                      it_fieldcatalog = ifc
                   importing
                      ep_table        = dy_table.
        assign dy_table->* to <dyn_table>.
      * Create dynamic work area and assign to FS
      create data dy_line like line of <dyn_table>.
      assign dy_line->* to <dyn_wa>.
    endform.
    Regards,
    Ferry Lianto

  • How to create table columns dynamically ?

    Hi All,
    I am working on an SSRS report that will show sales in the past 5 years. If the user selected to view sales of past 3 years he will only see 3 columns. so How can I create table columns dynamically at run time and how can I make sure that their dimensions
    will adjust to fit the report page size.

    Hi Developer life,
    According to your description that you want to dynamically increase and decrease the numbers of the columns in the table, right?
    As Jason A Long mentioned that we can use the matrix to do this and put the year field in the column group, amount fields(Numric  values) in the details,  add  an filter to filter the data base on this column group, but if
    the data in the DB not suitable to add to the matrix directly, you can use the unpivot function to turn the column name of year to a single row and then you can add it in the column group.
    If there are too many columns in the column group, it will fit the page size automatically and display the extra columns in the next page.
    Similar threads with details steps for your reference:
    https://social.technet.microsoft.com/Forums/en-US/339965a1-8cca-41d8-83ef-c2548050799a/ssrs-dataset-column-metadata-dynamic-update?forum=sqlreportings 
    If your still have any problem, please try to provide us more details information, such as the data structure in the DB and the table structure you are currently designing.
    Any question, please feel free to let me know.
    Best Regards
    Vicky Liu

  • Dynamic table columns in web dynpro abap

    Hi,
    In my current project I have got a requirement whose solution I am not able to figure out.
    My requirement is this:
    I will have a table containig budget owners name(since its compensation management in HR).There will be a table popin inside this table on the click of the personal number of the budget owner. Now the table popin will have another table with all employees name under that particular budget owner.
    The problem is that the table inside the popin will not be having fixed columns.Actually the columns will be coming from a standard java web dynpro application (say in the form of an internal table).
    My requirement is this how can this be handled?Can we include all the possible columns in the node(which i bind to the child table) and make them visible/invisible during runtime? or create a dynamic node and assign it to the table(but in this case a node needs to be bound to the table during design time,what to bind?)  ?
    Can u please help along with code snippets.
    Thanks and Regards,
    Saikat.

    Thnx for the input.
    I am abke to make the table columns inside the popin visible/invisible.
    I have a tabstrip.Indise one of the tabs is my main table and inside one of the columns is the popin.Inside that a transparent container and finally the table inside that.
    This is the code that worked for me.
    METHOD wddomodifyview .
      DATA lr_root_container TYPE REF TO cl_wd_uielement_container.
      DATA lr_table_popin TYPE REF TO cl_wd_table_popin.
      DATA lr_transparent_container TYPE REF TO cl_wd_transparent_container.
      DATA lr_table TYPE REF TO cl_wd_table.
      DATA lr_table_column TYPE REF TO cl_wd_table_column.
      DATA lr_table_in_table_popin TYPE REF TO cl_wd_table.
      DATA lr_node_header_node TYPE REF TO if_wd_context_node.
      DATA lr_node_item_node TYPE REF TO if_wd_context_node.
      DATA lr_tabstrip TYPE REF TO cl_wd_tabstrip.
      DATA lr_tab TYPE REF TO cl_wd_tab.
      data lr_tc type ref to CL_WD_TRANSPARENT_CONTAINER.
      data lr_table2 type ref to cl_wd_table.
      DATA lr_table2_column TYPE REF TO cl_wd_table_column.
      IF first_time = abap_false.
        lr_root_container ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).
        lr_tabstrip ?= lr_root_container->get_child( id = 'TABSTRIP1' ).        "GETTING THE TABSTRIP
        lr_tab      ?= lr_tabstrip->get_tab( id = 'TAB1' ).        "GETTING THE TAB INSIDE TABSTRIP
        lr_table    ?= lr_tab->GET_CONTENT( ).      "GETTING THE CONTENT(TABLE IN THIS CASE) INSIDE TABSTRIP
        lr_table_column ?= lr_table->get_grouped_column( id = 'TABLE_MAIN_PERNR' ).   "GETTING THE COLUMN INSIDE THE TABLE
        "Table popin
        lr_table_popin ?=  lr_table_column->GET_POPIN( ).   "GETTING THE POPIN INSIDE THE TABLE
        lr_tc  ?= lr_table_popin->GET_CONTENT( ).   "GETTING THE CONTENT(TRANSPARENT CONTAINER IN THIS CASE)INSIDE THE TABLE
        lr_table2 ?= lr_tc->get_child( id = 'TABLE_EMPLOYEE' ).        "GETTING THE EMPLOYEE TABLE INSIDE THE TRANSPARENT CONTAINER
        lr_table2_column ?= lr_table2->get_grouped_column( id = 'TABLE_EMPLOYEE_PERNR' ).   "GETTING THE COLUMN INSIDE THE TABLE
        lr_table2_column->SET_VISIBLE( '02' ).  "SETTING VISIBILITY FOR THE COLUMN
      ENDIF.
    ENDMETHOD.
    But I'm still considering the dynamic node concept.Lets see if this works out or not.If not then I'll have to go for the dynamic node thing.
    Thanks,
    Saikat

  • How to clone data with in Table with dynamic 'n' number of columns

    Hi All,
    I've a table with syntax,
    create table Temp (id number primary key, name varchar2(10), partner varchar2(10), info varchar2(20));
    And with data like
    insert itno temp values (sequence.nextval, 'test', 'p1', 'info for p1');
    insert into temp values (sequence.nextval, 'test', 'p2', 'info for p2');
    And now, i need to clone the data in TEMP table of name 'test' for new name 'test1' and here is my script,
    insert into Temp  select sequence.nextval id, 'test1' name, partner, info from TEMP where name='test1';
    this query executed successfully and able to insert records.
    The PROBLEM is,
    if some new columns added in TEMP table, need to update this query.
    How to clone the data with in the table for *'n' number of columns and*
    some columns with dynamic data and remaining columns as source data.
    Thanks & Regards
    PavanPinnu.
    Edited by: pavankumargupta on Apr 30, 2009 10:37 AM

    Hi,
    Thanks for the quick reply.
    My Scenario, is we have a Game Details table. When ever some Game get cloned, we need to add new records in to that Table for the new Game.
    As, the id will be primary key, this should populate from a Sequence (in our system, we used this) and Game Name will be new Game Name. And data for other columns should be same as Parent Game.
    when ever business needs changes, there will be some addition of new columns in Table.
    And with the existing query,
    insert into Temp (id, name, partner, info) select sequence.nextval id, 'test1' name, partner, info from TEMP where name='test'_
    will successfully add new rows but new added columns will have empty data.
    so, is there any way to do this, i mean, some columns with sequence values and other columns with existing values.
    One way, we can do is, get ResultSet MetaData (i'm using Java), and parse the columns. prepare a query in required format.
    I'm looking for alternative ways in query format in SQL.
    Thanks & Regards
    PavanPinnu.
    Edited by: pavankumargupta on Apr 30, 2009 11:05 AM
    Edited by: pavankumargupta on Apr 30, 2009 11:05 AM

Maybe you are looking for

  • [Help] How to open StickiesDatabase in my PC?

    Hi guys. My IMAC died yesterday. I have the file StickiesDatabase from my post it notes, but now I only have a PC. I tried to open it with notepad, but the result is crazy. I also tried opening in my Quick View Plus. The result is a little bit better

  • How do I delete all my sent emails on IPad 2?  I only get 2 options: Flag and Mark as Unread.  It doesn't let me Mark All of them.

    Have been trying to figure out how to delete all of my sent mail on my IPad 2...it only lets me choose to Flag or Mark as Unread.  It will take me hours to go through and check off each one.  I have 2 years of emails in my sent folder!

  • Download Error on Flash Player 11

    While installing Adobe Flash Player 11, the installation reached 50% and directed me to shut down Internet Explorer.  I shut down Internet Explorer and clicked RETRY, but the Flash Player Installer did not recognize that Internet Explorer was closed

  • Even and odd counts..

    Whats the easiest way to determine if a button has been pushed and even or an odd number of times? Here is why I'm asking... If it has been pushed an even number of times than i want it to display one method, if odd I want it to display another metho

  • "Phantom Remnant" - How to remove a non-existing server from Snow Leopard

    I have a very strange problem that I am sure has a very simple solution, but I cannot figure it out. Previously, my network was centered on my Time Capsule, which, due to router settings, was at 192.168.1.1. However, since moving, the address has cha