Create a view dynamically

I would like to create a view dynamically based on “Employee” table
A view in each database should contain every column in “Employee” table except column called “year”. “Employee” table exists in every database but has different columns except “year” column ,so
the employee view should contain different columns based on which database you create a view
How can I create a view dynamically for each database? I am using SQL server 2008 R2

Try this... (Note the @Debug parameter is there to allow you to preview the code before you create the view... 1 to view the dynamically generated code, 0 tt simply execute it.)
DECLARE
@DeBug BIT = 1,
@ColumnString VARCHAR(MAX),
@sql VARCHAR(MAX)
SELECT
@ColumnString = COALESCE(@ColumnString + ',' + CHAR(10) + CHAR(9), '') + c.COLUMN_NAME
FROM
INFORMATION_SCHEMA.COLUMNS c
JOIN INFORMATION_SCHEMA.TABLES t ON c.TABLE_NAME = t.TABLE_NAME AND c.TABLE_SCHEMA = t.TABLE_SCHEMA
WHERE 1 = 1
AND t.TABLE_TYPE = 'BASE TABLE'
AND c.TABLE_NAME = 'Employee'
AND c.COLUMN_NAME <> 'Year'
ORDER BY
c.ORDINAL_POSITION
SET @sql = '
CREATE VIEW dbo.v_Employee
AS
SELECT
' + @ColumnString + '
FROM dbo.Employee'
IF @DeBug = 1
BEGIN
PRINT (@sql)
END
ELSE
BEGIN
EXEC (@SQL)
END
HTH,
Jason
Jason Long

Similar Messages

  • How to create a view dynamicly in plsql?

    I need to write a pl/sql package to create a view dynamic
    ,but i can't use 'create or replace view xxxx as select *
    from db where ...',I know the dbms_sql package can parse the
    'select' sentence,but i don't know how to create a view,only can
    drop a view,who can help me?
    thanks!
    null

    Try 'EXECUTE IMMEDIATE 'CREATE AS SELECT....' in your PL/SQL
    xhpxorcl (guest) wrote:
    : I need to write a pl/sql package to create a view dynamic
    : ,but i can't use 'create or replace view xxxx as select *
    : from db where ...',I know the dbms_sql package can parse the
    : 'select' sentence,but i don't know how to create a view,only
    can
    : drop a view,who can help me?
    : thanks!
    null

  • How to create a webdynpro view dynamically and embed into view container?

    Hi all,
    Anyone knows how to create a view dynamically and embed the view into an existing view container?
    My layout looks like this:
    I have an existing view named main_view.
    Inside main_view, I create a view ui container named vcu_view.
    I embed the main_view into my window.
    I need the codes to create a view dynamically and embed the view into the view container. Anyone have any idea?
    Thanks in advance.
    Rgds,
    Siong Chao

    hi Siong Chao   ,,
    empty view insence ..( create a view without any UI element in it  ) in design time ..
    >
    Siong Chao wrote:
    > Hi Chinnaiya,
    >
    > How do you create an empty view dynamically then? Thanks in advance.
    i think we cannot create a new view dynamically because it is a webdynpro restriction ..
    NOTE: experts correct me if i am wrong in this answer
    Regards
    Chinnaiya P

  • How to populate list in tree view  dynamically

    Hi,
    I am new to  Indesign Plugin creation.
    I want to create list in tree view dynamically.
    I tried wlistboxcomposite sdk sample in indesign cs4.
    I have some doubts in this.
    1. Can i write my own method in  WLBCmpTreeViewAdapter class because it's implements ListTreeViewAdapter
    If it's possible how can i call this method.
    2. In this example they populating static string in constructor like this
    WLBCmpTreeViewAdapter::WLBCmpTreeViewAdapter(IPMUnknown* boss):ListTreeViewAdapter(boss){
    K2Vector<PMString> lists;
    for (int32 i = 0; i< 12; i++){PMString name(kWLBCmpItemBaseKey);name.AppendNumber(i+1);name.Translate();lists.push_back(name);}
    InterfacePtr<IStringListData> iListData(this, IID_ISTRINGLISTDATA);}
    and this list is populating on loading time but my requirement is i have one button "get list" after clicking this button i have to populate the list, how can
    i achieve this.
    Pls do needful.
    Thanks
    Arun

    The TreeViewAdaptor is responsible for mapping your custom data to the tree view itself.  I almost always start by making it return some fixed number of objects with names "item 1" etc. That way you get the tree view working first.
    Then, after you get it laid out and displaying properly, you can worry about using real data.  At that point, you have your adaptor return the actual number of items in your list and each individual item.  Then you can populate your list when you push your button and then invalidate the IControlView of the tree view widget to cause it to redraw.  At that point your adaptor will get called and your data should appear.
    Jon
    "Expert for hire"

  • How to create a viewobject dynamically without using wizard

    Hi,
    I am Using jDEV 11G, i need to create a viewobject dynamically without using wizard, without binding from any entity.
    Actually my intention is to make a grid like in .Net, when a user want to create a new row in RichTable without using DB.
    just like shopping cart.
    i have done thsi code:
    ViewObjectImpl view=new ViewObjectImpl();
    view.addDynamicAttributeWithType("Att1","String",null);
    view.addDynamicAttributeWithType("Att2","String",null);
    view.addDynamicAttributeWithType("Att2","String",null);
    Row rw=view.createRow();
    rw.setAttribute("Att1","First1");
    rw.setAttribute("Att2","First2");
    rw.setAttribute("Att2","First3");
    view.insertRow(rw);
    I have a RichTable , i need bind this viewobject into that.
    Edited by: vipin k raghav on Mar 10, 2009 11:39 PM

    Hi Vipin,
    You can create the view object with rows populated at run time.
    [http://download.oracle.com/docs/cd/E12839_01/web.1111/b31974/bcquerying.htm#CEGCGFCA]
    For reference of how to create an empty rwo at run time on button click
    [http://kohlivikram.blogspot.com/2008/10/add-new-row-in-adf-table-on-button.html]
    ~Vikram

  • Creating Forte FieldWidgets Dynamically at Runtime

    Hi Everyone,
    Could someone please help me with the following problem I have when
    creating Forte fieldwidgets dynamically at run-time. I am using Forte
    ver. 3.0.G.2.
    (-1-) I have a window class with an empty gridfield, <grfMain>, inside a
    viewport. The idea is to populate the gridfield with DataField
    fieldwidgets dynamically at runtime. Depending on some input criteria,
    sometimes some of the DataFields need to map to IntegerNullables, some
    to DoubleNullables and some to DateTimeNullables. (Please note that I
    cannot use the Forte window workshop to create these fieldwidgets,
    because different types of fieldwidgets will be needed at different
    times, in different numbers, at run-time. ) Here is a sample of how I am
    currently trying to achieve this:
    dfDate : DataField = new;
    dfDate.MaskType = MK_Template;
    dfDate.DateTemplate = new( value='dd/mm/yyyy' );
    dfDate.Row = 1;
    dfDate.Column = 2;
    dfDate.Parent = <grfMain>;
    dfInt : DataField = new;
    dfInt.MaskType = MK_INTEGER;
    dfInt.Row = 2;
    dfInt.Column = 2;
    dfInt.Parent = <grfMain>;
    dfReal : DataField = new;
    dfReal.MaskType = MK_FLOAT;
    dfReal.Row = 3;
    dfReal.Column = 2;
    dfReal.Parent = <grfMain>;
    The code above is called after the window has been opened with the
    Open() statement.
    Looking at the code above, one obvious omission is that the "Mapped
    Type" of the Datafields are not set up. In the Forte window workshop, an
    interface is provided to set up the "Mapped Type" of the Datafield
    widgets, but I'm not sure how to do that dynamically, and that is
    basically my biggest problem here.
    (-2-) If I now run the window class, the Datafield widgets get created,
    and they all have the correct input maks, but no validation gets done
    when one tabs away from the field. For example, Datafields with
    MaskType=MK_INTEGER will gladly accept '--1--0++7', while Datafields
    created in the window workshop (mapping to IntegerNullables) will do a
    validation, and not allow one to tab out of the field before the extra
    minus and plus signs are not removed.
    I have the same problem with the Datafields which have
    MaskType=MK_Template and DateTemplate='dd/mm/yyyy'. For the date, one
    can enter something like '2*\**\****', and leave the field, while the
    same type of datafield created in the window workshop (mapped to a
    DateTimeNullable), will not allow you to leave the field before a valid
    date has not been entered. To summarise, the input masks of my
    dynamically created Datafields work fine, but no validation gets done
    when the field looses the focus.
    (-3-) As a test, I used the Forte debugger ("view"-"local variables") to
    look at the differences between Datafields created dynamically, and
    those created in the Forte window workshop. One very obvious difference
    was that Datafield attribute "MapTypeName" was filled in for the window
    workshop Datafields, but not for my dynamically created Datafields. The
    problem is that Forte does not allow me to set this attribute
    dynamically in my code. How else can I setup the Mapped Type
    dynamically?
    (-4-) In order to have a consistent look-and-feel throughout our Forte
    project, we are making use of Domain classes for DATE and DECIMAL data
    entry fields. My questions are:
    (4.1) How must I go about creating Datafields dynamically that make use
    of these Domain classes?
    (4.2) Is it also a matter of setting up the "MapTypeName" attribute,
    which I cannot seem to do?
    (4.3) Is the mapping done differently for Domain classes?
    (-5-) Another interesting thing to note for Datafields created in the
    Forte Window Workshop, is that if the mapped type is IntegerNullable
    with Input Mask = Integer, or DoubleNullable with Input Mask = Float,
    then the Object that the Datafield widget maps to, must first be
    instantiated before the Loose-Focus validations will start to work. For
    example, if a Datafield widget called "dfTestInt" was created in the
    Forte window workshop, which maps to an IntegerNullable, and Input Mask
    = Integer, then the following line is needed before the window is
    displayed: dfTestInt = new;
    Without this line, one can enter something like '2---3+++7', and leave
    the field.
    This is not true for Datafields where the mapped type is
    DateTimeNullable with say Input Mask Template='dd\mm\yyyy'. In this case
    validations are done even thought the object being mapped to, has not
    been instantiated yet. In other words you will never be able to enter
    '2*/**/****', and leave the field for datafield created in the window
    workshop. Maybe in this case the validation is being done by the
    template itself?
    Thanks in advance
    Riaan
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

    what I mean is rendering JSF components on the fly, becuase some time you don't know things at design time. Lets say I am designing a page in creator that shows the total number of dependants that belongs to a primary inusrance member in text boxes. Of course we don't know in advance how many dependants we have for a specific member unless we go to databse and fetch all the data at runtime. Desiging some thing dynamic like that is very easy in CGI or ASP/JSP but JSF model seems very static due to it's design time feature.
    So is it possible with JSF or not?

  • How to embed views dynamically in a view container ?

    Hi ,
        Can you please guide me how to embed a view dynamically in a view container ?
    Thanks & Regards
    Gaurav Jain

    Hello,
    Please read this [/people/rajagopal.vemuri/blog/2006/09/19/web-dynpro-for-abap-creating-dynamic-ui-elements-and-context-step-by-step].
    Regards.

  • Error while creating a view and creating navigation link

    Hi,
    i created one view with one button and on click of button it has to navigate to DeleteOperationview.This is the exception i am getting while running.
    can u plz tell me where the problem might beee...
    com.sap.tc.webdynpro.services.exceptions.CreationFailedException: Cannot create view element implementation com.sap.tc.webdynpro.clientserver.uielib.standard.impl.Caption
    *     at com.sap.tc.webdynpro.progmodel.view.ViewElementFactory.createElement(ViewElementFactory.java:161)*
    *     at com.sap.tc.webdynpro.progmodel.view.View.createElement(View.java:177)*
    *     at com.utc.pwc.tasklistm.wdp.InternalDeleteOperation.wdCreateUITreeForGroup(InternalDeleteOperation.java:282)*
    *     at com.utc.pwc.tasklistm.wdp.InternalDeleteOperation.wdCreateUITree(InternalDeleteOperation.java:259)*
    *     at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.createUITree(DelegatingView.java:74)*
    *     at com.sap.tc.webdynpro.progmodel.view.View.initController(View.java:443)*
    *     at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:200)*
    *     at com.sap.tc.webdynpro.progmodel.view.ViewManager.getView(ViewManager.java:709)*
    *     at com.sap.tc.webdynpro.progmodel.view.ViewManager.bind(ViewManager.java:555*
    Regards
    Padma N

    Hi Padma,
    In Outline check the <b>id </b> property of the <b> Caption-Header </b> view elements from the properties window it seems some of the ids are duplicate it should be unique.
    Other wise delete the container elements and design the view layout once again.
    Re: dynpro table -dynamically change table header name
    Regards,
    Mithu

  • Creating a view with existing GeoRaster columns and new SDO_GEOMETRY column

    Hi,
    In a nutshell, I already have 1 real table, which has several attributes including types such as text, numbers etc. but also a GeoRaster column. This table works great, has its metadata stored properly and is spatially indexed; no worries.
    I am then creating a view based on the above mentioned table, including the GeoRaster column. This worked, no problems. However now I want the same view to also have a SDO_GEOMETRY column which explicitly stores the spatial extent for each GeoRaster. Note the original table does not have this SDO_GEOMETRY column. So, I have created a revised SQL statement to create the view, but now it dynamically adds a new column and puts the GeoRaster.spatialextents into the SDO_GEOMETRY column.
    This worked, the data made it into the view, but when we try to view the SDO_GEOMETRY in a viewer, we get errors. I added a system metadata entry for the view, but this did not help. Also, it is not possible to spatially index a view so I knew that was not the problem.
    I think what has happened is the SDO_GEOMETRY column is in a sort of "limbo", where because it was not contained in the original table (and indexed there) and it is not able to be indexed in a view, it cannot be manipulated/viewed/used spatially.
    Here is a snippet describing the original table:
    "IMAGERY_ID" NUMBER NOT NULL ENABLE,
    "CAM_ANGLE_X" NUMBER,
    "CAM_ANGLE_Y" NUMBER,
    "CAM_ANGLE_Z" NUMBER,
    "SPEED" NUMBER,
    "HEADING" NUMBER,
    "IMAGE_GEOR" "SDO_GEORASTER",
    "ACQUISITION_TIME" TIMESTAMP (6),
    "SENSOR_ID" NUMBER,
    "DOWNWARD_LOOKING" CHAR(1 BYTE),
    "ORG_ID" NUMBER,
    "POC_ID" NUMBER,
    "FILE_NAME" VARCHAR2(100 BYTE),
    "CORRELATION_ID" VARCHAR2(256 BYTE),
    And here is the statement I used to create the new view:
    CREATE VIEW level_0_img_view (imagery_id, cam_angle_x, cam_angle_y, cam_angle_z, speed, heading, image_geor, acquisition_time, sensor_id, downward_looking, org_id, poc_id, file_name, correlation_id, geor_extents)
    AS
    SELECT a.imagery_id, a.cam_angle_x, a.cam_angle_y, a.cam_angle_z, a.speed, a.heading, a.image_geor, a.acquisition_time, a.sensor_id, a.downward_looking, a.org_id, a.poc_id, a.file_name, a.correlation_id, a.image_geor.spatialextent
    FROM imagery a
    WHERE a.file_name LIKE '%.lev0';
    Note in the above statement that the "geor_extents" column is the new column added dynamically (and not in the original table). Note the new column with the SDO_GEOMETRY data is flawless, I have looked at the records in SQL developer and all the data is there.
    Any ideas?
    In case you're wondering, I do have reasons for: (i) wanting an explicit column with the SDO_GEOMTRY (serving via WFS), and (ii) not wanting to alter the original table to include the equivalent SDO_GEOMETRY column.
    Cheers,
    M.

    Hi,
    if you are having problems to display your view spatial columns in MapBuilder/MapViewer, you may be missing to register the view information in the metadata (name and spatial columns).
    For example, lets see the following table that simulates your case:
    SQL> desc pci_image;
    Name Null? Type
    GEORID NOT NULL NUMBER
    TYPE VARCHAR2(32)
    GEORASTER MDSYS.SDO_GEORASTER
    -- create a view
    create view pci_img_view (georid,georaster,geor_extents)
    as
    select a.georid,a.georaster,a.georaster.spatialextent
    from pci_image a;
    -- register metadata for view spatial columns (GeoRaster and geometry column)
    insert into user_sdo_geom_metadata
    select 'PCI_IMG_VIEW','GEORASTER.SPATIALEXTENT', diminfo, srid
    from user_sdo_geom_metadata where table_name = 'PCI_IMAGE'
    insert into user_sdo_geom_metadata
    select 'PCI_IMG_VIEW','GEOR_EXTENTS', diminfo, srid
    from user_sdo_geom_metadata where table_name = 'PCI_IMAGE'
    There is no need to index the spatial columns if they have been indexed before.
    Now, if you go in MapBuilder you should see the the view name in the list of geometry tables, and be able to create a theme on column GEOR_EXTENTS (select it on the combo box) and to preview it.
    For the GeoRaster column, currently the view name is not shown on the list of GeoRaster tables in MapBuilder.
    For GeoRaster data, MapBuilder uses the contents of metadata view user_sdo_geor_sysdata, and then it would be needed to register the view contents there. We will talk with Jeffrey to check if there is any problem in registering
    view contents in this metadata view. If the view name and georaster column is registered in user_sdo_geor_sysdata,
    then it should show in MapBuilder. But you can still create a GeoRaster theme for this view using a SQL command, and should be able to preview it in MapBuilder.
    -- create a GeoRaster theme based on view Georaster column.
    insert into user_sdo_themes values (
    'PCI_IMAGE_V_GEOR',
    'View of georaster column',
    'PCI_IMG_VIEW',
    'GEORASTER',
    '<?xml version="1.0" standalone="yes"?>
    <styling_rules theme_type="georaster" raster_id="1" raster_table="RDT_PCI" raster_bands="0,1,2">
    </styling_rules>');
    -- commit changes
    commit;
    Joao

  • How to create sub views in Oracle SQL

    I am trying to write a select statement through TOAD that needs to build a view and then query from that view further in the same statement. I don't mean create a VIEW in the common sense of running a CREATE VIEW command, I mean creating one dynamically within an SQL statement. Here's what I mean - in DB2 sql I can write the following:
    WITH COUNT_NUM
    COUNT_ADS
    AS
    (SELECT
    COUNT(AD_ID)
    FROM AD
    WHERE CONTRACT_ID = '000234123'
    SELECT * FROM COUNT_NUM;
    Obviously this is a real simple example but you get the idea. Using this syntax you can create numerous sub-views to build data into your final select. My question is how to do this for Oracle. I have searched tons of help pages and sites but the only reference is to creating permanent views. I do not want to create temporary views either as I do not have adequate system permissions - I only want to create dynamic ones within my SQL.
    Thanks in advance for any help!

    In Oracle, the equivalent concept is known as an in-line view. The Oracle version of your statement is:
    SELECT *
    FROM (SELECT COUNT(AD_ID) count_ads
          FROM AD
          WHERE CONTRACT_ID = '000234123')Essentially, you can use an in-line view anywhere you would use a "real" view or a table, so the follwoing is also possible:
    SELECT a.contract_id, a.count_ads, b.count_pages
    FROM (SELECT contract_id,ad_id,COUNT(*) count_ads
          FROM ad
          GROUP BY contract_id,ad_id) ads,
         (SELECT ad_id,count(*) count_pages
          FROM ad_pages
          GROUP BY ad_id) ad_pages
    WHERE ads.ad_id = ad_pages.ad_idHTH
    John

  • How to create a Tray dynamically

    Hi All
    I have tried to develop a method where I can create a tray dynamically.  I have embedded this code in the method WDDOINIT of my View called 'MAIN_VIEW'.   My longer term plan is to create x number of trays where x is dictated by the number of entires in an Internal Table.
    The code I have written compiles, but nothing appears where I thought it would.  Can anyone spot what I have so fundementally missed?
    Assistance is sincerely appreciated.
    Regards
    Tony
    create object wd_this->all_in_one_util.
    data: node_input  type REF TO if_wd_context_node,
          elem_input  TYPE REF TO if_wd_context_element,
          stru_input type if_main_view=>element_input.
    data: lr_view                type ref to cl_wdr_view,
          lr_tray   type REF TO CL_WD_TRAY,
          tray_id  type string,
          lr_caption             type ref to cl_wd_caption,
          caption_id             type string,
          lr_grid_data           type ref to cl_wd_grid_data,
          lr_grid_layout         type ref to cl_wd_grid_layout.
    *Navigate from <CONTEXT> to <INPUT> via lead selection
    node_input = wd_context->get_child_node( name = if_main_view=>wdctx_input ).
    lr_tray = cl_wd_tray=>new_tray(
        EXPANDED                 = ABAP_TRUE
        ID                       = tray_id
        VIEW                     = lr_view  "'MAIN_VIEW'
        WIDTH                    = '100%'
            set the caption of the tray
              concatenate lr_tray->id '_HEADER' into caption_id.
              lr_caption = cl_wd_caption=>new_caption(
                             id   = caption_id
                             text = 'text goes here'
                             view = lr_view ).
              lr_tray->set_header( lr_caption ).
            create the grid layout data for tray
              lr_grid_data = cl_wd_grid_data=>new_grid_data( lr_tray ).
            assign the layout data to the tray
              lr_tray->set_layout_data( lr_grid_data ).
            create a new grid layout for the content of the tray
              lr_grid_layout = cl_wd_grid_layout=>new_grid_layout( lr_tray ).
            assign the grid layout to the tray
              lr_tray->set_layout( lr_grid_layout ).

    Hi Tony,
    If we have to do any dynamic programming in webdynpro( creating UIelements dynamically ), WDDOMODIFYVIEW is the method where we need to code the logic for creating the tray.
    But you have done the coding of creating tray in WDDOINIT thats why it is not working fine. Just the have the same code in WDDODMODIFYVIEW and you need to have below code to add this tray to view's ROOTUICONTAINER.
    data:  lr_container TYPE REF TO cl_wd_uielement_container.
    lr_container ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).
      " View is import parameter of wddomodifyview method.
    lr_container->add_child( '' pass the tray that is created ' ).
    This is the way to create dynamic UIelements in webdynpro using wddodmodifyview
    For more information on dynamic programming have at following information
    <a href="http://help.sap.com/saphelp_crm50/helpdata/en/44/2d9a41ed79a009e10000000a155106/frameset.htm">http://help.sap.com/saphelp_crm50/helpdata/en/44/2d9a41ed79a009e10000000a155106/frameset.htm</a>
    Thanks,
    Prashanth Kumar B

  • Create a view with parameter

    it's posible create a view with parameters?
    i want to create a view and pass it parameters, in the same way when i create a procedure or function.
    i never have seen it, but i would like to know if that's posible
    thanks

    You cannot create a view with parameters. The only way is to use a stored proc to dynamically create the sql statement. The substitution variable approach does not work. SQL*Plus will prompt for the value of the variable at compile time (i.e. when you create the view) and use the value you provide in the view's query.
    SQL> create or replace view jws_test_v as
      2  select * from jws_test where flag = '&flg'
      3  /
    Enter value for flg: AA
    old   2: select * from jws_test where flag = '&flg'
    new   2: select * from jws_test where flag = 'AA'
    View created.
    SQL> select * from jws_test_v
      2  /
    no rows selected
    SQL> select text from user_views where view_name = 'JWS_TEST_V'
      2  /
    TEXT
    select "LEV1","LEV2","LEV3","LEV4","LEV5","LEV6","FC","FLAG","ONAFT","ONAPT","CU
    PEFT","CUPEPT" from jws_test where flag = 'AA'This makes sense, since substitution vartiables are a sqlplus construct, not a sql or Oracle construct. A view constructed in this way would not be callable from anywhere other than sqlplus.

  • Create Radio button dynamically in Table column.

    HI All
       I have used following code to create radio button dynamically. but it's getting dump saying that Could not find attribute STATUS. 
    Here STATUS is the attribute of the node in View context. But why this dump is coming. 
    Please correct me if any thing worng.
      DATA: lr_radio TYPE REF TO cl_wd_radiobutton.
      DATA: lr_containr TYPE REF TO cl_wd_transparent_container.
      DATA: lr_data TYPE REF TO cl_wd_flow_data.
      IF first_time = abap_true.
        lr_containr ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).
        lr_radio = cl_wd_radiobutton=>new_radiobutton(
        view = view
        id = 'RADIO'
        text = 'Enroll'
        bind_selected_key = 'STATUS'
        key_to_select = 'STATUS' ).
        lr_data = cl_wd_flow_data=>new_flow_data( element = lr_radio ).
        lr_radio->set_layout_data( lr_data ).
        lr_containr->add_child( lr_radio ).
      ENDIF.
    Thank you very much
    Ram

    Hi Rama,
    I solved it.check this code.
    i think u did mistake in creating radio button you are not passing the 
    BIND_KEY_TO_SELECT
      instead you are passing KEY_TO_SELECT.
    data:lr_column2 type ref to cl_wd_table_column,
         lr_radio type ref to cl_wd_radiobutton.
       lr_column2 = obj_table->get_column(
                   id         = 'TABLE1_PLANETYPE'
    *              INDEX      = INDEX
    lr_radio = cl_wd_radiobutton=>new_radiobutton(
    *      BIND_ENABLED        = BIND_ENABLED
           BIND_KEY_TO_SELECT  = 'STATUS'
    *      BIND_KEY_VISIBLE    = BIND_KEY_VISIBLE
    *      BIND_READ_ONLY      = BIND_READ_ONLY
           bind_selected_key   = 'STATUS'
    *      BIND_STATE          = BIND_STATE
    *      BIND_TEXT           = BIND_TEXT
    *      BIND_TEXT_DIRECTION = BIND_TEXT_DIRECTION
    *      BIND_TOOLTIP        = BIND_TOOLTIP
    *      BIND_VISIBLE        = BIND_VISIBLE
    *      ENABLED             = ABAP_TRUE
    *      EXPLANATION         = EXPLANATION
           ID                  = 'RAD1'
    *      KEY_TO_SELECT       = KEY_TO_SELECT
    *      KEY_VISIBLE         = KEY_VISIBLE
    *      ON_SELECT           = ON_SELECT
    *      READ_ONLY           = READ_ONLY
    *      STATE               = E_STATE-NORMAL
           TEXT                = 'Test'
    *      TEXT_DIRECTION      = E_TEXT_DIRECTION-INHERIT
    *      TOOLTIP             = TOOLTIP
    *      VIEW                = VIEW
    *      VISIBLE             = E_VISIBLE-VISIBLE
    lr_column2->set_table_cell_editor( the_table_cell_editor = lr_radio  ).
    Thanks,
    Suman

  • Creating filtered view on the physical layer ussing session variable USER

    Hi:
    I´m creating a view on the physical layer, the view needs to be created dynamically. So depending on the user (using the session variable USER) the view is created with the data a particular user is able to see.
    Fisrt I imported the table and changed it´s properties to be created through a "Select Statement" so i don´t needed to change the mapping on the bussiness model layer.
    The consistency check was OK but i´m not able to see data in answers, even using the Administrator user. Have anyone tried to do this? Here is my query.
    Thanks
    A Garcia
    Select * from D_ESTRUCTURA_RH2 where Region_ID
    IN
    select distinct a.REGION_ID from APP_INDPERSONAL_DM.D_ESTRUCTURA_RH2 a
    inner join (
    select distinct b.REGION_ID from APP_INDPERSONAL_DM.D_ESTRUCTURA_RH2 b
    where exists (select 1 from APP_INDPERSONAL_DM.Autorizacion a, usuarios c
    where a.app_id = 1
    and a.usuario_id = c.Usuario_Id
    and UPPER(c.Nombre_Usuario)=UPPER(':USER')
    and a.miembro_id = 'REGION_ID'
    and a.operador = '='
    and (b.REGION_ID = (case when valor = 'Todo' then 0 else valor end) or valor='Todo'))
    ) seguridad
    on
    a. REGION_ID = seguridad.REGION_ID
    )

    whay not use the same filter in the content tab of the logical table source?
    check the physical sql sent to databse using web-admin-manage sessions-view log and see if there is any unexpected behavior. also run the same query in db and see iff you get the results in databse itself.

  • Create a Table Dynamically in WEB Dynpro Java with diferent type of column

    Hi everyone, I have a question if is possible to create a table dynamically in Web Dynpro Java?, depending of the RFC consults create the rows dynamically, ,this table must have diferent type of columns, for example link column (when the user click this link execute an action and show a adobe interactive form in another view), image column (show an image depending of the information)
    Thank you everyone
    Atte Israel

    Hello,Israel.
    Yes , it is possible through dynamic programming in wdModify of the View.
    You can do this ,for example, using cell variants.
    IWDTable tab = (IWDTable) view.getElement("TABLE_NAME");               
    IWDTableStandardCell cellV= (IWDTableStandardCell) view.createElement(IWDTableStandardCell.class,"TableStandardCell"+i); 
    cellV.setVariantKey("NotEditableVariant");
    cellV.setCellDesign((WDTableCellDesign)wdContext.nodeTableDaysTitle().currentTableDaysTitleElement().getAttributeValue("CellDesign"+i));
    IWDTextView textViewi= (IWDTextView) view.createElement(IWDTextView.class,"TextView"+i);  // -- here you control the type of the object that is displayed in the cell
    textViewi.bindText(dayAttrib);
    cellV.setEditor(textViewi);          
    tabColumn.addCellVariant(cellV);
    tab.addGroupedColumn(tabColumn,tab.numberOfGroupedColumns());     
    Using this code you can control even specific cells in the table and not only columns.
    Hope this helps you,
    Constantine

Maybe you are looking for