Help in creating View

Hi Guys,
I am trying to create a view from table A and table B.  Data in table A and table B are as follows.
Table A                              TableB
Field_1       Field_2                    Field_1           Desc_1
A1          B1                    A1          New York     
A1          B1                    A2          Albany
A1          B2                    A3          Rochester     
A1          B2                    A4          Buffalo
A1          B2                    A5          Syracuse
A2          B1                              
A2          B2
I want to get the following result:
Field_1        Desc_1          Field_2     
A1          New York     B1                    
A1          New York     B1                    
A1          New York     B2                         
A1          New York     B2                    
A1          New York     B2                    
A2          Albany          B1                              
A2          Albany          B2
Please advise me which type of view should I create. I create Maintenance view and I am getting following error"
"No database view exists for view Z_TEST_VIEW".
Please help in creating a view without the error.
Thanks,

Since your requirement is to view logically connected data from different tables, try creating the "database view".
http://help.sap.com/saphelp_nw70/helpdata/en/cf/21ecab446011d189700000e8322d00/content.htm

Similar Messages

  • Help with Creating Views

    Hi Gurus,
    There are 3 R/3 Tables for Plant Maintenance namely:
    1. ZPM_T_CONTRWO - Work Order Details for Contractor Payroll - ZIPY
    2. ZPM_T_WODETAILS - Work Order Details for ZIPY
    3. ZPM_T_ZIPYMASTER - Document Numbers for ZIPY
    The keys for the tables are:
    1. ZPM_T_CONTRWO: Document #, Order #, Operation/Activity #, Notification #
    2. ZPM_T_WODETAILS: Document #, Order #, Operation/Activity #, Notification #
    3. ZPM_T_ZIPYMASTER: Document #
    I'm thinking of creating 2 views, one b/w CONTRWO & ZIPYMASTER and the other b/w CONTRWO & WODETAILS.
    Please provide me guidelines & suggestions of doing this.
    Points will be rewarded.
    Thanks in advance,
    Manjesh
    NOTE: Below are the field names for each table ***
    ZPM_T_CONTRWO:
    Client, Document Number - ZIPY, Order Number, Operation/Activity Number
    Notification Number, Work Order Reference Number, Base quantity
    Base unit of measure, Total hours in selection period, Segment From
    Segment To, Offset From, Offset To, Checkbox, Last changed on, Time of entry
    User name
    ZPM_T_WODETAILS:
    Client, Document Number - ZIPY, Order Number, Operation/Activity Number
    Work Order Reference Number, Base quantity, Base unit of measure
    Total hours in selection period, Segment From, Segment To, Offset From
    Offset To, Checkbox, Page Number, Single-character flag, Confirmation number of operation, Confirmation counter, Single-character flag, Last changed on,
    Time of entry, User name
    ZPM_T_ZIPYMASTER:
    Client, Document Number - ZIPY, Date, Work center, Plant, Personnel number,
    Single-character flag, Time, Last changed on, Time of entry, User name

    Hi Manjesh,
    To create a view, you have to have atleast one common field in both tables to have the right join condition.
    You are meeting that condition with Document# for all tables.
    Refer this
    http://help.sap.com/saphelp_erp2005/helpdata/en/cf/21ec5d446011d189700000e8322d00/content.htm
    <b>for how to create the views?</b>
    R/3 side:
    1. Go to SE11 tcode.
    2. Enter the name of the view and create.
    3. Take common key fields of the tables to meet the Join Conditions ZPM_T_CONTRWO or ZPM_T_WODETAILS or ZPM_T_ZIPYMASTER
    ---> Document# will give correct join condition.
    4. add the fields from ZPM_T_CONTRWO or ZPM_T_WODETAILS or ZPM_T_ZIPYMASTER.
    Regards,
    BVC

  • Help in creat view

    i have a accounting table consist of the folwing fields:
    ACC_ID NOT NULL NUMBER(10)
    ACC_DESC VARCHAR2(100)
    ACC_PARENT_ID NUMBER(6)
    IS_PARENT NUMBER(1)
    and another table for transacion have two filds:
    ACC_ID NUMBER(10)
    AMOUNT NUMBER(20,2)
    THE ACCOUNT TABLE Is a Hierarchical
    when i insert the value in transaction table the acc_id should not be PARENT ACCOUNT
    I wnat the result of view in this way
    acc_id is_parent amount
    1 1 5000
    11 1 5000
    111 1 5000
    1111 0 1500
    1112 0 1500
    1113 0 2000
    the sumation in the parent account debent on the sumation of chield account
    i hope if i find the help

    CREATE TABLE ACC (
    ACC_ID VARCHAR2(12) PRIMARY KEY,
    ACC_DESC VARCHAR2(100),
    PARENT_ACC VARCHAR2(12),
    IS_PARENT NUMBER(1));
    INSERT INTO ACC VALUES('1','ACC1',NULL,1);
    INSERT INTO ACC VALUES('11','ACC2',1,1);
    INSERT INTO ACC VALUES('111','ACC3','11',1);
    INSERT INTO ACC VALUES('1111','ACC41','111',0);
    INSERT INTO ACC VALUES('1112','ACC42','111',0);
    INSERT INTO ACC VALUES('1113','ACC43','111',1);
    INSERT INTO ACC VALUES('11131','ACC43','1113',0);
    CREATE TABLE TRANS (
    ACC_ID VARCHAR2(12),
    AMOUNT NUMBER(10,2));
    INSERT INTO TRANS VALUES (1111,3000);
    INSERT INTO TRANS VALUES (1112,5000);
    INSERT INTO TRANS VALUES (11131,4000);

  • Need help in creating a view with Encryption for hiding the code used by the multiple users

    Hi,
    Can anyone help me out in creating view with encryption data to hide the stored procedure logic with other users.
    I have create a stored procedure with encryted view but while running this manually temporary views are getting created, therefore the problem is if there are 500 entries then 500 temp views will get created.
    Any solution to aviod creating temporary views, please refer my code below
    USE [etl_validation]
    GO
    /****** Object:  StoredProcedure [dbo].[Pr_DBAccess_mod]    Script Date: 05/23/2014 12:53:22 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ALTER PROCEDURE [dbo].[Pr_DBAccess_mod](@ETL_CONFIG_ID INT)
    AS
    BEGIN
    DECLARE @openquery NVARCHAR(MAX),
     @DATABASENAME NVARCHAR(100),
     @HIERNAME NVARCHAR(100),
     @TABLENAME NVARCHAR(100),
     @SERVERTYPE NVARCHAR(100),
     @SERVERNAME NVARCHAR(100),
     @USERNAME NVARCHAR(100),
     @PASSWORD NVARCHAR(100),
     @ETL_CONFIG_IDN NVARCHAR(100);
     SET @ETL_CONFIG_IDN=CAST(@ETL_CONFIG_ID AS NVARCHAR);
     SET @TABLENAME='Department';
     SET @SERVERTYPE='SQL';
     SET @SERVERNAME ='192.168.31.176';
     SET @DATABASENAME='AdventureWorks2008R2';
     SET @HIERNAME = 'HumanResources';
     IF @SERVERTYPE='SQL'
     BEGIN
    /*SET @openquery= 'SELECT * INTO ##TestTable
                     FROM OPENROWSET(''SQLNCLI'',''server=192.168.31.176;Trusted_Connection=yes;'','''+@query+''')'
    SET @openquery=  'CREATE VIEW '+@TABLENAME+@ETL_CONFIG_IDN+
                     ' WITH ENCRYPTION AS SELECT * FROM OPENROWSET(''SQLNCLI'',''SERVER='+@SERVERNAME+';TRUSTED_CONNECTION=YES;'',''SELECT * FROM '+@DATABASENAME+'.'+@HIERNAME+'.'+@TABLENAME+''')'
    SELECT @openquery
    END
    EXECUTE sp_executesql @openquery
    END

    Hi aa_rif,
    According to your description and code message, you execute the sp_executesql statement in your stored procedure, it indeed create many views with a tablename and ETL_CONFIG_ID named. If you need not to use these temporary views, you can delete them when
    it contains the tablename in one view name.  
    In addition, if you want to create view with encryption in SQL Server, you can use directly the ENCRYPTION option to encrypt the T-SQL of a view in create view commands, for more information, see:
    http://learnsqlserver.in/4/Create-View-With-Encryption.aspx. if not, you can descript more detail about requriements, so that more forum members can involve into the thread and help you
    out. 
    Regards,
    Sofiya Li
    Sofiya Li
    TechNet Community Support

  • A dynamic table based on run-time created view object -- please help!

    Hello!
    I'm trying to create a dynamic table based on an run-time created view object. All go ok, but table binding component take the first view/iterator state and don't reflect changes they have. Please, take a look:
    1. At run-time the view is being replaced by new red-only one based on query in application module:
    getQueryView().remove();
    createViewObjectFromQueryStmt("QueryView", statement);
    2. Page definition file contains an iterator (using iterator or methodIterator - doesn't matter) binding and table, which binds to the iterator, like:
    <methodIterator id="distributeQuery1Iter" Binds="distributeQuery1.result"
    DataControl="QueryServiceDataControl" RangeSize="10"/>
    <table id="distributeQuery11" IterBinding="distributeQuery1Iter"/>
    3. The page code uses <af:table>. But, if I use table binding (it's right) like this:
    <af:table var="row" value="#{bindings.distributeQuery11.collectionModel}">
    <af:forEach items="#{bindings.distributeQuery11.attributeDefs}" var="def">
    the table will never changed (i.e. still show the first view instance).
    When I tried to use iterator binding directly (it's bad and cannot provide all needed features unlike CollectionModel from table binding) I saw that table works!
    (Code is somehing like:
    <af:table var="row" value="#{bindings.myIterator.allRowsInRange}">
    <af:forEach items="#{bindings.myIterator.attributeDefs}" var="def">
    Why the table binding do not reflect changes in iterator? Or should I use different approach?
    Thanks in advance!
    Ilya.

    I got it to work! I used a hybrid approach comprised of some of your code and some of Steve Muench's AcceessAppModuleInBackingBean example.
    In the setBindings method, I execute an app module method that redefines the query, then I used your code to delete and recreate bindings and iterator:
    public void setBindingContainer(DCBindingContainer bc) {
    this.bindingContainer = bc;
    rebuildVO();
    The rebuildVO() method looks like the code you provided in your example:
    private void rebuildVO() {
    DCDataControl dc;
    DispatchAppModule dApp;
    DCBindingContainer bc;
    DCIteratorBinding it;
    OperationBinding operationBinding;
    ViewObject vo;
    DCControlBinding cb;
    try {
    bc = getBindingContainer();
    dc = bc.findDataControl(DATACONTROL);
    dApp = (DispatchAppModule)dc.getDataProvider();
    // Execute App Module Method to rebuild VO based upon new SQL Statement.
    dApp.setDispatchViewSQL();
    vo = dApp.findViewObject(DYNAMIC_VIEW_NAME);
    it = bc.findIteratorBinding(DYNAMIC_VO_ITER_NAME);
    it.bindRowSetIterator(vo, true);
    // logger.info("Remove value binding...");
    cb = bc.findCtrlBinding(DYNAMIC_VIEW_NAME);
    cb.getDCIteratorBinding().removeValueBinding(cb);
    bc.removeControlBinding(cb);
    // logger.info("Creating new value binding...");
    FacesCtrlRangeBinding dynamicRangeBinding =
    new FacesCtrlRangeBinding(null,
    bc.findIteratorBinding(DYNAMIC_VO_ITER_NAME), null);
    // logger.info("Add control binding...");
    bc.addControlBinding(DYNAMIC_VIEW_NAME, dynamicRangeBinding);
    } catch (Exception e) {
    e.printStackTrace();
    And my App Module method that redefines the view object looks like this:
    public void setDispatchViewSQL() {
    String SQL =
    "begin ? := PK_BUsiNESS.F_GETDISPATCHVIEWSQL();end;";
    CallableStatement st = null;
    String ViewSQL = null;
    try {
    st = getDBTransaction().createCallableStatement(SQL,
    DBTransaction.DEFAULT);
    * Register the first bind parameter as our return value of type LONGVARCHAR
    st.registerOutParameter(1, OracleTypes.LONGVARCHAR);
    st.execute();
    ViewSQL = ((OracleCallableStatement) st).getString(1);
    findViewObject(DYNAMIC_VO_NAME).remove();
    ViewObject vo = createViewObjectFromQueryStmt(DYNAMIC_VO_NAME, ViewSQL);
    vo.executeQuery();
    } catch (SQLException s) {
    throw new JboException(s);
    } finally {
    try {
    st.close();
    } catch (SQLException s) {
    s.printStackTrace();
    When I run it I get my desired results. One thing I don't quite understand is why when the page is first rendered it shows the last set of records rather than the first. Now I have to figure out how to put navigation URLS in each of the table cells.
    Thanks for your help; I would not have gotten this far without it,
    Jeff

  • Pls help in creating cluster view

    Pls help in creating cluster view
    regards
    jindow

    Hi,
    Please try this and use BSEG as an example.
    1. Go to SE12.
    2. Enter BSEG
    3. Click Display button
    4. Go to Delivery and Maintenance' tab.
    5. You should be able to see Pool/cluster RFBLG.
    6. Double click RFBLG and then click Where-Used list button (CTRLSHIFTF3).
    7. Select Table option and click Execute button.
    8. System will show all the table that belong to this pool/cluster.
    For Pool/Cluster REGUC, it is only used in table REGUP.
    Look at the below link
    Re: Define view for cluster table?
    Regards,
    Priyanka.

  • Plz help me create a Procedure with create view cmd

    i want to create a view from the procedure like the following one,
    It creates the proc but while running it show invalid column name please help me;
    create or replace procedure asho2005.mock_pro( fin_fr_dt in date, fin_to_dt in date) is
         ffdt date;
         ftdt date;
    begin
         select to_date(fin_fr_dt,'dd-mm-yyyy') into ffdt from dual;
         select to_date(fin_to_dt,'dd-mm-yyyy') into ftdt from dual;
    execute immediate 'create or replace view mock_vu as select a.amt from cbtran a where chq_dt > ffdt and chq_dt <ftdt';
    end;

    i want to create a view from the procedure like the
    following one,
    It creates the proc but while running it show invalid
    column name please help me;
    create or replace procedure asho2005.mock_pro(
    fin_fr_dt in date, fin_to_dt in date) is
         ffdt date;
         ftdt date;
    begin
    select to_date(fin_fr_dt,'dd-mm-yyyy') into ffdt
    t from dual;
    select to_date(fin_to_dt,'dd-mm-yyyy') into ftdt
    t from dual;
    execute immediate 'create or replace view mock_vu
    vu as select a.amt from cbtran a where chq_dt > ffdt
    and chq_dt <ftdt';
    end;Hallo,
    your problem is , that execute immediate does't recognize ffdt
    You have to concatenate literals
    create or replace procedure asho2005.mock_pro( fin_fr_dt in date, fin_to_dt in date) is
    ffdt date;
    ftdt date;
    begin
    select to_date(fin_fr_dt,'dd-mm-yyyy') into ffdt from dual;
    select to_date(fin_to_dt,'dd-mm-yyyy') into ftdt from dual;
    execute immediate 'create or replace view mock_vu as select a.amt from cbtran a where chq_dt > '''||ffdt||''' and chq_dt <'''||ftd||'''';
    end; BTW, your view doesn't return any rows
    ffdt and < ffdt :-)
    Besides that , it's a very very bad method!
    You must not create views in runtime. Use of literals results in hard parsing .
    The performance will be poor.
    You have to create view in design time, and then simply use select:
    select * from mock_vu where chq_dt > (your_date) and something else
    HTH
    Regards
    Dmytro
    corrected wrong number of quotes (no wonder ) :-)
    Message was edited by:
    Dmytro Dekhtyaryuk

  • Help for creating classification view in mm01

    hi guys can anybody help on creating classification views in mm01 using bdc recording i need a step by step procedure . since when i tryed in mm01 there are filds like class name i dont know where all these data's to find one more thing is i was asked to create classification view using bdc recording ...please help me with some programs if u have

    Hi,
    You need to use the BAPI 'BAPI_OBJCL_CREATE' to create characteristics for a material.
    The characteristics are need to be passed in the table ALLOCVALUESCHAR.
    If you do not know the values for a particular characteristics then you canmake use of FM
    BAPI_CLASS_GET_CHARACTERISTICS and BAPI_CHARACT_GETDETAIL to get the values.
    Regards,
    Ankur Parab

  • Needs help to create a VIEW

    EXAMPLE data as under below;
    TABLE customer_transactions;
    there is 4 columns
    cust_id type_of_transaction trasaction_no date_of_transactions amount
    1 INVOICE INV01 1/6/2002 9500
    1 DEBIT NOTE DB01 2/8/2002 1050
    1 RECEIPT R01 2/8/2002 10000
    1 INVOICE INV02 5/9/2002 2500
    1 CREDIT NOTE CR01 2/9/2002 70
    receipt_master
    rec_no rec_date amount
    R01 2/8/2002 10000
    receipt_details(child table to receipt_master)
    rec_no againest_voucher_type voucher_no
    R01 INVOICE INV01
    R01 DEBIT NOTE DB01
    i need a to create a VIEW like below
    custid total_due due0_30days due30_60days due60_90days due_above_90days
    1 2980 2430 550 0 0
    im facing critical situation with receipts which i have to deduct againest some invoices and
    debitnotes.
    now at the moment im using a long pL/SQL program to do this which i taking so much time. i saw a
    advise few days back to create view for the above report. i tried to in my way. but no success.
    please advise me on my issue.

    Not certain how you determine when to subtract, however you might be able to use DECODE.
    select A.Cust_Id, max(B.due_0_30), max(C.Due_31_60), max(D.Due_61_90), max(E.Due_Above90)
      from cust_trans A,
              (select Cust_ID, Sum(Decode(Trans_Type,
                                                                       'INVOICE', Amount,
                                                                       'CREDIT NOTE', (Amount*-1), 
                                                                       'DEBIT NOTE', Amount,
    --                                                                   'RECEIPT', (Amount*-1),  -- THIS IS WHERE I'M NOT CERTAIN
                                                                        Amount) ) Due_0_30
                     from Cust_trans
                     where Trans_dt between trunc(sysdate-30) and trunc(sysdate)
                    group by Cust_Id ) B,
                  (select Cust_ID, Sum(Decode(Trans_Type,
                                                                         'INVOICE', Amount,
                                                                         'CREDIT NOTE', (Amount*-1),
                                                                         'DEBIT NOTE', Amount,
    --                                                                   'RECEIPT', (Amount*-1),  -- THIS IS WHERE I'M NOT CERTAIN
                                                                         Amount) ) Due_31_60
                    from Cust_trans
                    where Trans_dt between trunc(sysdate-60) and trunc(sysdate-31)
                   group by Cust_Id ) C,
               (select Cust_ID, Sum(Decode(Trans_Type,
                                                                        'INVOICE', Amount,
                                                                        'CREDIT NOTE', (Amount*-1),
                                                                        'DEBIT NOTE', Amount,
    --                                                                   'RECEIPT', (Amount*-1),  -- THIS IS WHERE I'M NOT CERTAIN
                                                                         Amount) ) Due_61_90
                    from Cust_trans
                    where Trans_dt between trunc(sysdate-90) and trunc(sysdate-61)
                   group by Cust_Id ) D,
                (select Cust_ID, Sum(Decode(Trans_Type,
                                                                        'INVOICE', Amount,
                                                                        'CREDIT NOTE', (Amount*-1),
                                                                        'DEBIT NOTE', Amount,
    --                                                                   'RECEIPT', (Amount*-1),  -- THIS IS WHERE I'M NOT CERTAIN
                                                                         Amount) ) Due_Above90
                    from Cust_trans
                    where Trans_dt < trunc(sysdate-90)
                   group by Cust_Id ) E
    WHERE A.Cust_Id = B.Cust_Id(+)
      AND A.Cust_Id = C.Cust_Id(+)
      AND A.Cust_Id = D.Cust_Id(+)
      AND A.Cust_Id = E.Cust_Id(+)
    group by A.Cust_ID

  • In generic extration how to create view

    HI
    In se11 i try to create view using two table vbap and vbak .
    vbak            mandt                          vbap                     mandt
    vbak             vbeln                           vbap                     vbeln        for join condion
    and also i fill view field tab but the view is no cretated. It give error field name MANDT is not unique. please anyoone clar the error.
    By
    Rajan

    Hi Rajan,
    You cannot use one field twice in a View.
    If you need the Field "MANDT" from both the tables, change the description as MANDT_VBAK & MANDT_VDAT in View Field column & select it from the respective tables in "Table column".
    Hope it helps!
    Regards,
    Pavan

  • Error while creating view

     Hello,
    I am trying to create view which is based on multiple source tables and I am receiving following error 
    Internal error: An expression services limit has been reached. Please look for potentially complex expressions in your query, and try to simplify them.
    Can anyone know how to resolve this.
    Thanks,

    See MS Support for how to solve it:
    Error message when you run a query in SQL Server 2005: "Internal error: An expression services limit has been reached"
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • Looking for some help in creating an ItemFilter for a Targeter

    Looking for some help in creating an ItemFilter for a Targeter
    Need a examples for creating itemfilter and TargeterFirst

    Hi David,
    We can integrate Syncfusion with LightSwitch application, if you want to customize column when create a report using syncfusion reportviewer, since I didn't try this third party
    extension before, I think you could consider getting help from
    syncfusion forum, more syncfusion experts can help you on this issue.
    Thanks for your understanding.
    Best regards,
    Angie
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Need help in creating custom reports

    hello,
    I am using EM 10.2.0.2 on windows 32-bit.
    All EM components are installed on a single machine.
    Have installed AGENT 10.1.0.5 for managing targets which are on LINUX 2.1
    Please help me in getting the solution for the following queries:
    (a)I need to create a custom report regarding the CAPACITY MANAGEMENT .
    (b)I have some UDM defined but I am not able to use these UDM while creating custom report.
    (c)Also is there any possibility that we can use views other than REPOSITORY VIEWS. What I meant was : instead of using REPOSITORY VIEWS can we use the tables of the target instances.
    Thanks in advance.

    Same post
    Need help on repository views for creating custom capacity planning reports

  • Creating View for a table with parent child relation in table

    I need help creating a view. It is on a base table which is a metadata table.It is usinf parent child relationship. There are four types of objects, Job, Workflow, Dataflow and ABAP dataflow. Job would be the root parent everytime. I have saved all the jobs
    of the project in another table TABLE_JOB with column name JOB_NAME. Query should iteratively start from the job and search all the child nodes and then display all child with the job name. Attached are the images of base table data and expected view data
    and also the excel sheet with data.Picture 1 is the sample data in base table. Picture 2 is data in the view.
    Base Table
    PARENT_OBJ
    PAREBT_OBJ_TYPE
    DESCEN_OBJ
    DESCEN_OBJ_TYPE
    JOB_A
    JOB
    WF_1
    WORKFLOW
    JOB_A
    JOB
    DF_1
    DATAFLOW
    WF_1
    WORKFLOW
    DF_2
    DATAFLOW
    DF_1
    DATAFLOW
    ADF_1
    ADF
    JOB_B
    JOB
    WF_2
    WORKFLOW
    JOB_B
    JOB
    WF_3
    WORKFLOW
    WF_2
    WORKFLOW
    DF_3
    DATAFLOW
    WF_3
    WORKFLOW
    DF_4
    DATAFLOW
    DF_4
    DATAFLOW
    ADF_2
    ADF
    View
    Job_Name
    Flow_Name
    Flow_Type
    Job_A
    WF_1
    WORKFLOW
    Job_A
    DF_1
    DATAFLOW
    Job_A
    DF_2
    DATAFLOW
    Job_A
    ADF_1
    ADF
    Job_B
    WF_2
    WORKFLOW
    Job_B
    WF_3
    WORKFLOW
    Job_B
    DF_3
    DATAFLOW
    Job_B
    DF_4
    DATAFLOW
    Job_B
    ADF_2
    ADF
    I implemented the same in oracle using CONNECT_BY_ROOT and START WITH.
    Regards,
    Megha

    I think what you need is recursive CTE
    Consider your table below
    create table basetable
    (PARENT_OBJ varchar(10),
    PAREBT_OBJ_TYPE varchar(10),
    DESCEN_OBJ varchar(10),DESCEN_OBJ_TYPE varchar(10))
    INSERT basetable(PARENT_OBJ,PAREBT_OBJ_TYPE,DESCEN_OBJ,DESCEN_OBJ_TYPE)
    VALUES('JOB_A','JOB','WF_1','WORKFLOW'),
    ('JOB_A','JOB','DF_1','DATAFLOW'),
    ('WF_1','WORKFLOW','DF_2','DATAFLOW'),
    ('DF_1','DATAFLOW','ADF_1','ADF'),
    ('JOB_B','JOB','WF_2','WORKFLOW'),
    ('JOB_B','JOB','WF_3','WORKFLOW'),
    ('WF_2','WORKFLOW','DF_3','DATAFLOW'),
    ('WF_3','WORKFLOW','DF_4','DATAFLOW'),
    ('DF_4','DATAFLOW','ADF_2','ADF')
    ie first create a UDF like below to get hierarchy recursively
    CREATE FUNCTION GetHierarchy
    @Object varchar(10)
    RETURNS @RESULTS table
    PARENT_OBJ varchar(10),
    DESCEN_OBJ varchar(10),
    DESCEN_OBJ_TYPE varchar(10)
    AS
    BEGIN
    ;With CTE
    AS
    SELECT PARENT_OBJ,DESCEN_OBJ,DESCEN_OBJ_TYPE
    FROM basetable
    WHERE PARENT_OBJ = @Object
    UNION ALL
    SELECT b.PARENT_OBJ,b.DESCEN_OBJ,b.DESCEN_OBJ_TYPE
    FROM CTE c
    JOIN basetable b
    ON b.PARENT_OBJ = c.DESCEN_OBJ
    INSERT @RESULTS
    SELECT @Object,DESCEN_OBJ,DESCEN_OBJ_TYPE
    FROM CTE
    OPTION (MAXRECURSION 0)
    RETURN
    END
    Then you can invoke it as below
    SELECT * FROM dbo.GetHierarchy('JOB_A')
    Now you need to use this for every parent obj (start obj) in view 
    for that create view as below
    CREATE VIEW vw_Table
    AS
    SELECT f.*
    FROM (SELECT DISTINCT PARENT_OBJ FROM basetable r
    WHERE NOT EXISTS (SELECT 1
    FROM basetable WHERE DESCEN_OBJ = r.PARENT_OBJ)
    )b
    CROSS APPLY dbo.GetHierarchy(b.PARENT_OBJ) f
    GO
    This will make sure it will give full hieraracy for each start object
    Now just call view as below and see the output
    SELECT * FROM vw_table
    Output
    PARENT_OBJ DESCEN_OBJ DESCEN_OBJ_TYPE
    JOB_A WF_1 WORKFLOW
    JOB_A DF_1 DATAFLOW
    JOB_A ADF_1 ADF
    JOB_A DF_2 DATAFLOW
    JOB_B WF_2 WORKFLOW
    JOB_B WF_3 WORKFLOW
    JOB_B DF_4 DATAFLOW
    JOB_B ADF_2 ADF
    JOB_B DF_3 DATAFLOW
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Create view link programatically

    Hi all,
    I am working on this weird requirement.
    Basically, I have to create a detail table on a search resullt table. The search result is seeded search, for Item Advance search in Oracle PIM module which is not based upon a VO. The search result table is dynamically built at run time in the EgoItemSearchHelper class and that's where they build the search result VO (EgoItemSearchResultsVO).
    Now, I need to access this VO in the controller class, and create a view link programatically between details table VO and this VO. The problem is since I do not have Impl class for the EgoItemSearchResultsVO, how do I accees the column that is the key attribute. Second I do not know how to create view link between the two VOs programatically.
    Please help it's urgent.
    Thanks

    Pratap, My problem is the seeded VO is in seeded AM and my details VO will be in my custom AM, I don't know if we can have a view link between View objects that are in different AMs.
    To bypass that problem, I tried to create a VO in the seeded AM programatically and then created a view link. Now since the AM is seeded, and I am adding my details VO to this AM programatically, I thought of creating a table also programatically on the detais VO.
    In the end it does not work, I end up getting a show button on the main table, but when I click I get an error (Cannot find <null> attribute in the EOGITEMSEARCHRESULTVO) which is the seeded VO class. Unfortunately there is no boolean variable on the dynamic seeded VO, so don't know what to put in oatablebean.setDetailViewAttributeName("") method;
    Any clues on this, appreciate all responses from the forum gurus.
    ViewObject voEmp = oaapplicationmodule.createViewObject("MyEmp", "xxuss.oracle.apps.ego.item.eu.server.DetailsOrderLinesVO");
    ViewObject voEmp = am.createViewObject("MyEmp", "xxuss.oracle.apps.ego.item.eu.server.DetailsOrderLinesVO");
    AttributeDef[] prjLinkAttrs = new AttributeDef[]{oaapplicationmodule.findViewObject("EgoItemSearchResultsVO").findAttributeDef("INVENTORY_ITEM_ID_B")};
    System.out.println("definition for attr = "+ prjLinkAttrs[0]);
    AttributeDef[] taskLinkAttrs = new AttributeDef[]{voEmp.findAttributeDef("InvId") };
    ViewLink vl = am.createViewLinkBetweenViewObjects("MyLink3",
    "DetailInv", // accessor name--more on this below
    am.findViewObject("EgoItemSearchResultsVO"), // master
    prjLinkAttrs, // department attributes
    voEmp, // detail
    taskLinkAttrs, // employee attributes
    null); // assoc clause
    System.out.println("view link =" + vl.getName());
    OATableBean tb = (OATableBean)createWebBean(oapagecontext,TABLE_BEAN,null,"table");
    tb.setViewUsageName("MyEmp");
    OAMessageStyledTextBean beans = (OAMessageStyledTextBean)createWebBean(oapagecontext,MESSAGE_STYLED_TEXT_BEAN,OAWebBeanConstants.VARCHAR2_DATATYPE,"number");
    beans.setPrompt("column1");
    beans.setViewUsageName("MyEmp");
    beans.setViewAttributeName("InvId");
    tb.addIndexedChild(beans);
    oatablebean.setDetail((OAWebBean)tb);
    oatablebean.setDetailViewAttributeName("SelectFlag"); // I just tried this, SelectFlag is not a boolean attribute though, is there a way to create a boolean attribute programatically for seeded VO EGOITEMSEARCHRESULTVO and set it here, will it help
    oatablebean.setAllDetailsEnabled(true);

Maybe you are looking for