Help dynamic view ???

Hi,
How can I create a view with Vairables
like ex:
CREATE or replace VIEW MYvew
AS
SELECT * FROM xyz where val=VARIABLEsthanks in advance
sh
Edited by: user10736825 on Feb 10, 2010 11:14 AM

You can use a table function:
SQL> create or replace type emprec_t as object (
  2  empno number(4),
  3  ename VARCHAR2(10),
  4  sal NUMBER(7,2));
  5  /
Type created.
SQL> create type empview_t is table of emprec_t;
  2  /
Type created.
SQL> create or replace function emp_by_sal (p_sal in number) return empview_t is
  2  r empview_t;
  3  begin
  4    select emprec_t(empno, ename, sal)
  5     bulk collect into r
  6     from emp
  7     where sal > p_sal;
  8 
  9    return r;
10  end;
11  /
Function created.
SQL> select *
  2  from table(emp_by_sal(1000));
     EMPNO ENAME             SAL
      7499 ALLEN            1600
      7521 WARD             1250
      7566 JONES            2975
      7654 MARTIN           1250
      7698 BLAKE            2850
      7782 CLARK            2450
      7788 SCOTT            3000
      7839 KING             5000
      7844 TURNER           1500
      7876 ADAMS            1100
      7902 FORD             3000
      7934 MILLER           1300
12 rows selected.
SQL> select *
  2  from table(emp_by_sal(1500));
     EMPNO ENAME             SAL
      7499 ALLEN            1600
      7566 JONES            2975
      7698 BLAKE            2850
      7782 CLARK            2450
      7788 SCOTT            3000
      7839 KING             5000
      7902 FORD             3000
7 rows selected.Max
[My Italian Oracle blog| http://oracleitalia.wordpress.com/2010/02/07/aggiornare-una-tabella-con-listruzione-merge/]

Similar Messages

  • Select from Query ? / Dynamic view ? Anything else ?

    Hello,
    This could be a bit challenging. (or maybe not, i hope)
    I have to create a report which is based on 3/4 tables with pretty complex SQL.
    Step 1. I have to use views (in the database currently) to select data from these tables.
    Step 2. Then create the next set of views (in the db) based on the previous views.
    Step 3. Then finally join the last set of views in Reports and create the report based on the PARAMETERS entered.
    This was fine, until the client changed the criteria. Now the views have to be created but the PARAMETERS affect the FIRST set of views.
    That is, the views in the FIRST STEP will have a where condition based on the parameters at RUN TIME.
    I was wondering about how to do this ?
    1. Can I use dynamic views (in db) passing the where condition parameter to the where clause ? Alternatively use DDL in Reports.
    OR
    2. Create a query in Reports and create subsequent QUERIES BASED ON THE FIRST QUERY (like MS Access). Can this be done ?
    3. Any other way ?
    If you need any clarification, I can provide that.
    THANKS for taking the time to read it. It would be great if you could give me any ideas.
    Pat.

    hello,
    you might look into REF-CURSOR-QUERIES for this particular case. it might help.
    regards,
    the oracle reports team

  • How to create dynamic View Object and Dynamic Table

    Dear ll
    I want to create a dynamic view object and display the output in a dynamic table on the page.
    I am using Jdeveloper 12c "Studio Edition Version 12.1.2.0.0"
    This what I did:
    1- I created a read only view object with this query "Select sysdate from dual"
    2- I added this View object to the application module
    3- I created a new method that change the query of this View object at runtime
        public void changeVoQuery(String dbViewName) {
            String sqlstm = "Select * From " + dbViewName;
            ViewObject dynamicVo = this.findViewObject("DynamicVo");
            if (dynamicVo != null) {
                dynamicVo.remove();
            dynamicVo = this.createViewObjectFromQueryStmt("DynamicVo", sqlstm);
            dynamicVo.executeQuery();
    4- I run the application module for testing the method and I passed "Scott.Emp" as a parameter and the result was Success
    5- Now I want to show the result of the view on the page, so I draged and dropped the method from the data control as a parameter form
    6- I dragged and dropped the view Object "DynamicVo" as a table and I choose "generate Column Dynamically at runtime". This is the page source
    <af:panelHeader text="#{viewcontrollerBundle.SELECT_DOCUMTN_TYPE}" id="ph1">
            <af:panelFormLayout id="pfl1">
                <af:inputText value="#{bindings.dbViewName.inputValue}" label="#{bindings.dbViewName.hints.label}"
                              required="#{bindings.dbViewName.hints.mandatory}"
                              columns="#{bindings.dbViewName.hints.displayWidth}"
                              maximumLength="#{bindings.dbViewName.hints.precision}"
                              shortDesc="#{bindings.dbViewName.hints.tooltip}" id="it1">
                    <f:validator binding="#{bindings.dbViewName.validator}"/>
                </af:inputText>
                <af:button actionListener="#{bindings.changeVoQuery.execute}" text="changeVoQuery"
                           disabled="#{!bindings.changeVoQuery.enabled}" id="b1"/>
            </af:panelFormLayout>
        </af:panelHeader>
        <af:table value="#{bindings.DynamicVo.collectionModel}" var="row" rows="#{bindings.DynamicVo.rangeSize}"
                  emptyText="#{bindings.DynamicVo.viewable ? 'No data to display.' : 'Access Denied.'}"
                  rowBandingInterval="0" selectedRowKeys="#{bindings.DynamicVo.collectionModel.selectedRow}"
                  selectionListener="#{bindings.DynamicVo.collectionModel.makeCurrent}" rowSelection="single"
                  fetchSize="#{bindings.DynamicVo.rangeSize}" filterModel="#{bindings.DynamicVoQuery.queryDescriptor}"
                  queryListener="#{bindings.DynamicVoQuery.processQuery}" filterVisible="true" varStatus="vs" id="t1"
                  partialTriggers="::b1">
            <af:iterator id="i1" value="#{bindings.DynamicVo.attributesModel.attributes}" var="column">
                <af:column headerText="#{column.label}" sortProperty="#{column.name}" sortable="true" filterable="true"
                           id="c1">
                    <af:dynamicComponent id="d1" attributeModel="#{column}"
                                         value="#{row.bindings[column.name].inputValue}"/>
                </af:column>
            </af:iterator>
        </af:table>
    when I run the page this error is occured
    <Nov 13, 2013 2:51:58 PM AST> <Error> <oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter> <BEA-000000> <ADF_FACES-60096:Server Exception during PPR, #1
    javax.el.ELException: java.lang.NullPointerException
    Caused By: java.lang.NullPointerException
    Can any body help me please
    thanks

    Have you seen Shay's video https://blogs.oracle.com/shay/entry/adf_faces_dynamic_tags_-_for_a
    All you have to do is to use the dynamic table to get your result.
    Timo

  • Dynamic view object loses bind variables after passivation

    I am creating a view object definition/view object programmatically in Jdev 11.1.1.2.0. The query requires a named bind parameter. All was working fine but now I am testing with app module pooling disabled and the bind variable is not being restored after passivation -- it's like the definition has disappeared or something.
    Here is my VO creation code:
    ViewObject vo = findViewObject("FinalistsWithEvalDataVO");
    if (vo != null){
    vo.remove();
    ViewDefImpl voDef = new ViewDefImpl("FinalistsWithEvalDataVODef");
         // I add a bunch of viewAttrs here...
    voDef.setQuery(fullQuery);
    voDef.setFullSql(true);
    voDef.setBindingStyle(SQLBuilder.BINDING_STYLE_ORACLE_NAME);
    voDef.resolveDefObject();
    voDef.registerDefObject();
    vo = createViewObject("FinalistsWithEvalDataVO", voDef);
    vo.defineNamedWhereClauseParam("Bind_SchlrAyId", null, new int[] {0});
    vo.setNamedWhereClauseParam("Bind_SchlrAyId", new Number(1)); //For testing
    vo.executeQuery();
    The query executes fine right there and then the VO seems to passivate fine. I even see the bind var in passivation:
    <exArgs count="1">
    <arg name="Bind_SchlrAyId" type="oracle.jbo.domain.Number">
    <![CDATA[1]]>
    </arg>
    </exArgs>
    But then when it reactivates prior to rendering the page, it invariably throws a missing parameter exception and this in the log:
    <ViewUsageHelper><createViewAttributeDefImpls> [7409] *** createViewAttributeDefImpls: oracle.jdbc.driver.OraclePreparedStatementWrapper@1af78e1
    <ViewUsageHelper><createViewAttributeDefImpls> [7410] Bind params for ViewObject: [FinalistsWithEvalDataVO]AwardViewingServiceAM.FinalistsWithEvalDataVO
    <ViewUsageHelper><createViewAttributeDefImpls> [7411] ViewUsageHelper.createViewAttributeDefImpls failed...
    <ViewUsageHelper><createViewAttributeDefImpls> [7412] java.sql.SQLException: Missing IN or OUT parameter at index:: 1
    I have worked on this for hours and can't see anything wrong. Like I said, it works fine when not forcing passivation...
    Any help would be appreciated.
    Thanks.
    -Ed

    @Jobinesh - Thanks for the suggestions. I have read all the documentation I can find. Everything works fine without passivation. Everything still breaks with passivation. I have given up on trying to get the bind variable to restore after passivation and am currently just building the query with all values embedded in the query rather than bind variables. This is bad practice but avoids the problem. However, now that I avoided that obstacle, I'm on to the next issue with passivation of this dynamic view object, which is that the current row primary key apparently cannot be reset after activation. I get the following error:
    <Key><parseBytes> [7244] Key(String, AttributeDef[]): Invalid Key String found. AttributeCount:1 does not match Key attributes
    <DCBindingContainer><reportException> [7254] oracle.jbo.InvalidParamException: JBO-25006: Value 00010000000A30303033383133343734 passed as parameter String to method Constructor:Key is invalid: {3}.
         at oracle.jbo.Key.parseBytes(Key.java:537)
         at oracle.jbo.Key.<init>(Key.java:179)
         at oracle.jbo.server.IteratorStateHolder.getCurrentRowKey(IteratorStateHolder.java:34)
         at oracle.jbo.server.ViewRowSetIteratorImpl.activateIteratorState(ViewRowSetIteratorImpl.java:3877)
    I've been trying various workarounds for over a day now with no luck. Very frustrating.
    Thanks for trying to help.
    -Ed

  • Get bind variables of a dynamic view object

    I seem unable to retrieve the bind variables for a dynamically created view object, even though I can do the same thing for a regular view object.
    Here is the code:
    newVO = repServ.createViewObjectFromQueryStmt("newQry",strSql);
    VariableValueManager vvm = newVO.ensureVariableManager();
    if (vvm != null)
    Variable vars[] = vvm.getVariables();
    vars will be empty, even though the sql statement in strSql has bind variables in it.
    Is there any way to determine the bind variables of a dynamic view object?
    Thanks!

    I got the same problem as yours and still could not find any way out.
    However, as I can see, you wanted to get VariableValueManager of newly created ViewObject that may be not available at this moment.
    If you find way to solve the problem, please help.
    Cheer,
    MinhTran

  • Creating and Accessing a Dynamic View Object

    Hi,
    I'm needing to create a Dynamic View Object so to have the ability to modify the FROM and WHERE clauses in an SQL statement.
    I then need to view all the columns and rows in an adf table or something similar.
    I've read up a fair bit on similar situations, however I'm struggling with the basic framework of building the View Object.
    I know I'm wanting to use ..createViewObjectFromQueryStmt..but just unsure of the syntax in using it, especially connecting the VO to an Application Module.
    This is similar to what I've got now, located in AppModuleImpl.java
        public void createDynVO(ApplicationModule appMod, String FROMclause, String WHEREclause){
        String SQL = "SELECT JOURNAL_NAME, PERIOD_NAME FROM " + FROMclause + " " + WHEREclause;
        ViewObject vo = appMod.createViewObjectFromQueryStmt("DynamicView", SQL);
        vo.executeQuery();But how does it know what the application module is?
    Any help would be greatly appreciated!
    -Chris

    Ok, I've actually modified my approach to this.
    I've created a View Object in the design view, added it to the App Module, and then created an iterator and bound an adf table to that iterator.
    The View Object which I created has the same column names as what I am going to be getting later down the track.
    Everything is working perfectly, except that I can't seem to bind variables to the WHERE clause.
    Below is what I have got running:
        public void recreateDynView(String FromClause, String whereCompany, String whereDepartment) {
             String sql_PAGE_ITEM1 = " AND PAGE_ITEM1 LIKE :P_PAGE_ITEM1";
             String sql_PAGE_ITEM2 = " AND PAGE_ITEM2 LIKE :P_PAGE_ITEM2";
             findViewObject("DynamicView1").remove();
             String SQLStmt = "SELECT PAGE_ITEM1, PAGE_ITEM2, PAGE_ITEM3, LINE_ITEM FROM " + FromClause;
             ViewObject vo = createViewObjectFromQueryStmt("DynamicView1",SQLStmt);
             vo.setWhereClause("1=1");
               if (whereCompany != null && whereCompany.length()>0){
                   vo.setWhereClause(vo.getWhereClause() + sql_PAGE_ITEM1);
                   vo.defineNamedWhereClauseParam("P_PAGE_ITEM1",null,null);
                   vo.setNamedWhereClauseParam("P_PAGE_ITEM1",whereCompany);
               if (whereDepartment != null && whereDepartment.length()>0){
                   vo.setWhereClause(vo.getWhereClause() + sql_PAGE_ITEM2);
                   vo.defineNamedWhereClauseParam("P_PAGE_ITEM2",null,null);
                   vo.setNamedWhereClauseParam("P_PAGE_ITEM2",whereDepartment);
             vo.executeQuery();
           }However whenever I input a value into one of the bound variables, I get the following error on the page.
       1. JBO-29000: Unexpected exception caught: oracle.jbo.InvalidOperException, msg=JBO-25070: Where-clause param variable P_PAGE_ITEM1 needs ordinal index array.
       2. JBO-25070: Where-clause param variable P_PAGE_ITEM1 needs ordinal index array.In the view object which i created at design stage, I've set the binding style to Oracle Named, so it should be alright. But obviously since I'm removing the view object and creating another version of it, it doesn't have the same binding style attached by default?
    Is there a work around for this? I'm so close!
    -Chris

  • How to bind to a dynamic View in UIX

    I wish to have a UIX page access data from a dynamic View (i.e. the View is created at runtime). Since the View is not created at design time, I cannot create bindings for it in the UIX page's UIModel. Therefore, how do I reference this view in the UIX page?
    Brad

    Sanjay,
    No -- but I'm experimenting with something simillar to what you mention. Actually, there is a way to iterate over each element if you made the childData attribute of your contents child of the messageChoice your rangeSet, i.e.:
    <messageChoice>
    <contents childData="${bindings.myIterator.rangeSet}">
    <option text="${uix.current.myfield}"/>
    </contents>
    <messageChoice>
    The problem is that this causes a problem with the subsequent submit, the current row, and what selection shows when the page is re-rendered. I am becoming more convinced because of this and some other things I've run into that there are either problems with using ViewLinks, or problems in UIX components where ViewLinks are involved. I'm pretty much abandoning use of ViewLinks altogether. I haven't seen much of anything work with them that isn't done exactly like tutorials and examples. And with regards to those, most tutorials and examples offer very little UIX help (most of them are JSPs), and even the ones that do have in-a-vaccuum style in-line databinding rather than database databinding (you'd think Oracle, a database company, might actually use database examples), which doesn't clarify a bunch of issues someone writing a reall application runs into.
    As to an answer -- no unfortunately. Getting an answer to any ADF/UIX question is a time-consuming, frustrating, and most often fruitless process. Of my 45 some-odd posts on this forum, about 30 of them are unresponded-to posts.
    B

  • Problem in tabular form based on dynamic view and pagination

    Hi All,
    I have a manual tabular form based on a dynamic view. The view fetches the records based on search criteria given by the user in all cases. But this view fetches ALL records when user clicks on pagination, without considering the search criteria. This is the problem I am facing.
    I am doing the following:
    Since tabular form does not support pl/sql function returning query, I cannot use a table directly. I need my results based on search criteria selected by user. Hence I created a dynamic view and used a "INSTEAD OF UPDATE" trigger to update the table.
    I use a set bind variables procedure, on load before header for setting the variables.
    This view fetches the correct data based on user search always. It creates a problem only in one situation, when using pagination in the report.
    The example can be found at:
    http://apex.oracle.com/pls/otn/f?p=19399:1:
    username = [email protected]
    pwd = kishore
    Here if "manager name" is entered as test, we get 5 records in "Summary of requests" report and 5 records in "Inactive Requests" report. When user clicks on Pagination in any of the reports, ALL the 7 records get fetched in "Summary of Requests" and 6 records in "Inactive Requests". How can I overcome this problem?? The report must consider the search variables even when pagination occurs.
    Is this because, the inbuilt "html_PPR_Report_Page" executes the region query once again by considering all search variables as NULL?
    Backend Code is at:
    http://apex.oracle.com/pls/otn/
    workspace: sekhar.nooney
    Username :[email protected]
    pwd: kishore
    application id = 19399
    My region code is something like:
    select *
    from regadm_request_v
    where access_type = :F110_REGADM
    and status <> 'INACTIVE'
    order by request_id
    My view code is:
    CREATE OR REPLACE VIEW REGADM_REQUEST_V
    AS
    SELECT *
    FROM REGREGOWNER.REGADM_REQUEST
    WHERE upper(employee_name) LIKE '%'||nvl(upper(REGADM_REQUEST_PKG.GET_EMPLOYEE_NAME),'%')||'%'
    AND upper(manager_name) LIKE '%'||nvl(upper(REGADM_REQUEST_PKG.GET_MANAGER_NAME),'%')||'%'
    AND upper(employee_sunetid) LIKE '%'||nvl(upper(REGADM_REQUEST_PKG.GET_EMPLOYEE_SUNET_ID),'%')||'%'
    AND upper(manager_sunetid) LIKE '%'||nvl(upper(REGADM_REQUEST_PKG.GET_MANAGER_SUNET_ID),'%')||'%'
    AND upper(request_date) LIKE '%'||nvl(upper(REGADM_REQUEST_PKG.GET_REQUEST_DATE),'%')||'%'
    AND upper(USAGE_AGREEMENT_RECVD) LIKE '%'||nvl(upper(DECODE(REGADM_REQUEST_PKG.GET_USAGE_AGREMNT_RECVD,'~!@',NULL,REGADM_REQUEST_PKG.GET_USAGE_AGREMNT_RECVD)),'%')||'%'
    AND upper(STATUS) LIKE '%'||nvl(upper(DECODE(REGADM_REQUEST_PKG.GET_STATUS,'~!@',NULL,REGADM_REQUEST_PKG.GET_STATUS)),'%')||'%'
    AND upper(REQUEST_APPROVED) LIKE '%'||nvl(upper(DECODE(REGADM_REQUEST_PKG.GET_REQUEST_APPROVED,'~!@',NULL,REGADM_REQUEST_PKG.GET_REQUEST_APPROVED)),'%')||'%'
    AND upper(nvl(APPROVAL_DATE,sysdate)) LIKE '%'||nvl(upper(REGADM_REQUEST_PKG.GET_APPROVED_DATE),'%')||'%'
    AND upper(APRVL_REQUEST_SENT) LIKE '%'||nvl(upper(DECODE(REGADM_REQUEST_PKG.GET_EMAIL_APPROVERS,'~!@',NULL,REGADM_REQUEST_PKG.GET_EMAIL_APPROVERS)),'%')||'%'
    AND upper(NOTIFY_APPROVED) LIKE '%'||nvl(upper(DECODE(REGADM_REQUEST_PKG.GET_APPROVAL_NOTIFICATION,'~!@',NULL,REGADM_REQUEST_PKG.GET_APPROVAL_NOTIFICATION)),'%')||'%'
    I would be glad for any suggestions.
    Andy/Varad any ideas? You both helped me a lot on my problems for the same application that I had faced before in More Problems in Tabular form - Please give me suggestions.
    Thanks,
    Sumana

    Hi Andy,
    The view and the package for setting bind variables work properly in my entire application other than the pagination. A pity that I came across this only now :(
    I have used this same method for holding variables in another application before, where I needed to print to PDF. I used this approach in the other application because my queries were not within the APEX character limit specified for the "SQL Query of Report Query shared component".
    In this application, I initially had to fetch values from 2 tables and update the 2 tables. Updateable form works only with one table right? Hence I had created a view. Later the design got changed to include search and instead of changing the application design I just changed the view then. Still later, my clients merged the 2 tables. Once again I had just changed my view.
    Now, I wanted to know if any method was available for the pagination issue (using the view itself). Hence I posted this.
    But as you suggested, I think it is better to change the page design quickly (as it would be much easier).
    If I change the region query to use the table and the APEX bind parameters in the where clause as:
    SELECT *
    FROM REGADM_REQUEST
    WHERE upper(employee_name) LIKE '%'||nvl(upper(:P1_EMPLOYEE_NAME),'%')||'%' .....
    I also changed the ApplyMRU to refer to the table.
    Here the pagination issue is resolved. But here the "last Update By" and "Last Update Date" columns do not get updated with "SYSDATE" and "v(APP_USER)" values, when update takes place. Even if I make the columns as readonly text field, I am not sure how I can ensure that SYSDATE and v('APP_uSER') can be passed to the columns. Any way I can ensure this? Please have a look at the issue here: http://apex.oracle.com/pls/otn/f?p=19399:1:
    I have currently resolved the "last update" column issue by modifying my view as:
    CREATE OR REPLACE VIEW REGADM_REQUEST_V
    AS
    SELECT *
    FROM REGADM_REQUEST
    I modified my region query to use APEX bind parameters itself as:
    SELECT *
    FROM REGADM_REQUEST_V
    WHERE upper(employee_name) LIKE '%'||nvl(upper(:P1_EMPLOYEE_NAME),'%')||'%' .....
    And I use the "INSTEAD OF UPDATE" trigger that I had initially written for update. The code is:
    CREATE OR REPLACE TRIGGER REGADM_REQUEST_UPD_TRG
    INSTEAD OF UPDATE
    ON REGADM_REQUEST_V
    REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    BEGIN
    UPDATE REGREGOWNER.REGADM_REQUEST
    SET MANAGER_EMAIL = :NEW.MANAGER_EMAIL
    , EMPLOYEE_EMAIL = :NEW.EMPLOYEE_EMAIL
    , STATUS_UPDATE_DATETIME = SYSDATE
    , USER_UPDATE_ID = (SELECT v('APP_USER') FROM DUAL)
    WHERE REQUEST_ID = :OLD.REQUEST_ID;
    END;
    Please let me know how I can resolve the "last update" column issue using the table itself. (Just for my learning)
    Thanks,
    Sumana

  • Problem in BDC with ( MM01-Dynamic views )

    HI
    I am working with BDC on material Mater(mm01).
    Now while Creating Material,there is option of selecting different views based on MaterialType.
    But while recording a BDC i can record it for a particular Material Type.and can select view associated to that particular Material Type.
    Is there any solution to create a bdc progarm which can accept a new material based on
    any material type and having views on user's choice that are given by user in Input file.
    FOr that i think i need to create dynamic views and screen elements for input associated to those views.
    After scanning some sites and forums for this particular problem,i got some help on this:-----
    <b>SELECTION_VIEWS_FIND</b> should be very useful in this case.
    There are three FModules totally involved:
    a) <b>T130M_SINGLE_READ</b>
    Pass TCODE = MM01, and get T130M values
    b) <b>BILDSEQUENZ_IDENTIFY</b>
    Pass KZRFB = 'X',TCODE_REF=T130M-TRREF and get
    BILDSEQUENZ values
    c) <b>SELECTION_VIEWS_FIND</b>
    Pass BILDSEQUENZ and T130M-PSTAT
    Now, this function module holds the values of all the views and the next screen numbers
    But i am unable to interpret the solution..Can somebody Elaborate on this.or provide me some other solution for this.
    Thanks in Advance
    Help Will be appreciated.

    Yes, I agree with Christian.  You are gonna want to use the BAPI or the underlying function module.  It works good and isn't really that complex.  Here is sample program.  Here the function module is being used to change data,  it can also be used to create,  you will have to change the Tcode from MM02 to MM01.
    report zrich_0001.
    data: i_mara type table of mara_ueb with header line.
    data: i_marc type table of marc_ueb with header line.
    data: i_marcx type table of marc with header line.
    parameters: p_matnr type mara-matnr,
                p_plifz type marc-plifz.
    start-of-selection.
    * Get all plants for that material
      select * into corresponding fields of table i_marcx
            from marc where matnr = p_matnr.
    * Now maintain data for each plant
      loop at i_marcx.
    * Reset I_Mara to new material number
        clear i_mara. refresh i_mara.
        select * into corresponding fields of table i_mara
              from mara where matnr = p_matnr.
        read table i_mara index 1.
        i_mara-tcode = 'MM02'.
        i_mara-tranc = '0000000001'.
        modify i_mara index 1.
    * Get Plant Data
        clear i_marc. refresh i_marc.
        select * into corresponding fields of table i_marc
              from marc where matnr = i_marcx-matnr
                          and werks = i_marcx-werks.
        read table i_marc index 1.
        i_marc-plifz  = p_plifz.        " Plan Del time
        i_marc-tranc = '0000000001'.
        modify i_marc index 1.
    * Maintain material
        perform MATERIAL_MAINTAIN_DARK'.
      endloop.
    *  MATERIAL_MAINTAIN_DARK
    form MATERIAL_MAINTAIN_DARK.
    * Variable for "Maintain_Material_Dark" Function Module
      data: numerror like tbist-numerror.
      data: last_matnr type mara-matnr.
      data: i_delfields type table of mfieldres with header line.
      data: i_errors    type table of merrdat   with header line.
      call function 'MATERIAL_MAINTAIN_DARK'
             exporting
                  sperrmodus                = ' '
                  kz_prf                    = 'W'
                  max_errors                = ' '
                  p_kz_no_warn              = 'X'
                  kz_verw                   = 'X'
                  kz_aend                   = 'X'
                  kz_dispo                  = 'X'
                  kz_test                   = ' '
                  flag_muss_pruefen         = ' '
                  call_mode                 = 'ACT'
             importing
                  number_errors_transaction = numerror
                  matnr_last     = last_matnr
             tables
                 amara_ueb      = i_mara    "Basic Data
    *             amakt_ueb      = i_makt    "Descriptions
                 amarc_ueb      = i_marc    "Plant
    *             amard_ueb      = i_mard    "Storage Location
    *            AMFHM_UEB      = I_MFHM    "Production Tools
    *             amarm_ueb      = i_marm    "Units of Measure
    *            AMEA1_UEB      = I_MEA1    "Internal Mangagement -  EANs
    *             ambew_ueb      = i_mbew    "Accounting/Costing
    *             asteu_ueb      = i_steu    "Tax Data
    *             astmm_ueb      = i_steumm  "Tax Data
    *            AMLGN_UEB      = I_MLGN    "Warehouse Data
    *            AMLGT_UEB      = I_MLGT    "Storage Type Data
    *            AMPGD_UEB      = I_MPGD    "Change Documents
    *            AMPOP_UEB      = I_MPOP    "Forcast Parameters
    *            AMVEG_UEB      = I_MVEG    "Total Consumption Data
    *            AMVEU_UEB      = I_MVEU    "Unplanned Consumption Data
    *             amvke_ueb      = i_mvke    "Sales Data
    *             altx1_ueb      = i_ltx1    "Sales Text
    *            AMPRW_UEB      = I_MPRW    "Forcast Values
                 amfieldres     = i_delfields
                 amerrdat       = i_errors
             exceptions
                  kstatus_empty             = 01
                  tkstatus_empty            = 02
                  t130m_error               = 03
                  internal_error            = 04
                  update_error              = 05
                  too_many_errors           = 06.
      if sy-subrc <> 0.
        rollback work.
        call function 'DEQUEUE_ALL'.
      else.
        commit work and wait.
        call function 'DEQUEUE_ALL'.
      endif.
      clear: i_mara, i_marc.
      refresh: i_mara, i_marc.
    endform.
    Regards,
    Rich Heilman

  • Dynamic views

    When i try to create a procedure using any view of type V$ (dynamic view) . I encounter error.
    Please help me in understanding this below is the sample code to explain in detail what i am talking about
    SCOTT@xe>CREATE OR REPLACE PROCEDURE p_parm
      2  IS
      3     vname   VARCHAR2 (500);
      4 
      5     CURSOR c
      6     IS
      7        SELECT NAME
      8          FROM V$parameter;
      9  BEGIN
    10     FOR rec IN c
    11     LOOP
    12        vname := rec.NAME;
    13        DBMS_OUTPUT.put_line (vname);
    14     END LOOP;
    15  END;
    16  /
    Warning: Procedure created with compilation errors.
    SCOTT@xe>show error
    Errors for PROCEDURE P_PARM:
    LINE/COL ERROR
    7/7      PL/SQL: SQL Statement ignored
    8/14     PL/SQL: ORA-00942: table or view does not exist
    12/7     PL/SQL: Statement ignored
    12/16    PLS-00364: loop index variable 'REC' use is invalid
    SCOTT@xe>
    SCOTT@xe>
    SCOTT@xe>  SELECT NAME
      2      FROM V$parameter where rownum = 1 ;
    NAME
    tracefile_identifier

    Gm~ wrote:
    In reply to Alex Nuijten comment I tried this ::
    SCOTT@xe>set role none

    SCOTT@xe>select name from v$parameter where rownum =1;
    NAME
    tracefile_identifier
    Well, you didn't really do anything here... just to clarify
    Notice the difference with and without the slash:
    SQL> set role none
      2 
    SQL> set role none
      2  /
    Role set.

  • Dynamic view creation in Flex

    I am new to  Flex web applications and I am doing research to see if functionality
    contained in an existing web application can be replicated in a Flex web app.
    We currently have a JSP / Struts based web application that creates a data entry
    web view dynamically based on information that describes the different widgets and
    their view locations as recieved from the application backend.  We are looking at
    migrating this application and this functionality to Flex.
    When User X selects 1 of any number of data entry views, the Flex application would
    receive data from the back end that  contains information describing the different widgets
    to display on the dynamic view: what type of widget to display ( text field,combo, line,
    box, etc), the pixel specific positional information as to where each widget exists in the
    view.  These data entry views are not something the Flex developer designs or knows
    what to expect from the backend. Flex has to generate the view on the fly based on the
    information that describes the view.
    The question:  I fully expect there to be coding within the action scripts; before trying to
                         learn how to do this, is this something that Flex support.  
    Thanks,
    Brian

    Yep, we do something similar. We had to build out the infrastructure, but It works fine. E.g.,
    var bDesc:XML = <button x="10" y="5" label="hello world" color="red"/>
    var b:Button = new Button();
    b.label = bDesc.@label;
    b.x = bDesc.@x;
    b.y = bDesc.@y;
    b.setStyle('color', b.@color);
    addChild(b);
    In your app, the actual description (XML or other format) would be coming from the server. Then you just add it to the display list (and wire in any event handlers if necessary). In a real setting, you'll need error checking and a more formalized way of doing this, but it works reasonably well. No major snags.

  • Updatable , Dynamic VIEW OBJECT ??

    Hi ,
    I want to create a dynamic VO which is updatable.
    I dont have any information about the table on which my View Object is based on, at DESIGN TIME. At run time I create query for the view and create dynamic view using AM.createViewObjectFromQueryStmt(String, String) but this kind of view will not be an updatable view.
    I think if I use createViewObjectFromQueryClauses() from entity, it will be updatable,,,but in that I will have to create entities for all the table in my schema ..which sounds BAD...
    is there any thing as DYnamic Entities ??
    or any other trick to do this.....
    BC4J should support something like changing QUERY_DATA_SOURCE_NAME at runtime in oracle forms.. which allow you to update record.
    Thanx,
    Prasoon

    Hi Prasoon,
    Steve Muench's "Dive Into BC4J" page has the following example: http://radio.weblogs.com/0118231/stories/2003/07/15/creatingUpdateableMultientityViewObjectDefinitionsDynamically.html
    But this is based on pre-defined Entity Objects. It might give you some ideas, though.
    Good luck!
    Chris

  • Paging issues using a dynamic view object...

    I am working on an application that uses JAG to generate JSP pages, i had the requirement to use dynamic view objects where the view object query is generated at runtime. The rest of the application is more or less the same... I used the defult functionality provided by TableScrollButtons.jsp file for paging. Now the problem im facing is that while the '>' and '<' buttons are working fine, i cant seem to navigate to the pages using the drop down...
    With the default handler, whenever i select the range the range displayed remains the same ie 1-10, 10 being the rangesize, but the rows are refreshed with values from the next page. Also, if the next page is the last and is incomplete, then the rows are pushed in from the bottom, so that the last page is always full...I tried the tuning panel in the view object edit dialogue and all settings are fine (i think)...could anyone please tell me what i am doing wrong??

    could it be because i am using a dynamic view object with dynamic bindings? i am using the preparemodel() method in the action as follows...
    protected void prepareModel(DataActionContext ctx) throws Exception {
    inferRangeBindingIfUnset(ctx);
    ctx.getBindingContainer().setEnableTokenValidation(false);
    String sql = ctx.getHttpServletRequest().getParameter("sql");
    String cost=ctx.getHttpServletRequest().getParameter("CostCostCent");
    String event=ctx.getHttpServletRequest().getParameter("event");
    if (sql != null && event == null) {
    setupDynamicQueryAndDynamicBindings(ctx,sql.substring(1),cost);
    if (retrieveOnlyCurrentPageFromDatabase()) {
    ViewObject vo = getIterForPaging(ctx).getViewObject();
    if (vo.getAccessMode() != ViewObject.RANGE_PAGING) {
    vo.setAccessMode(ViewObject.RANGE_PAGING);
    // if(event==null)
    super.prepareModel(ctx);
    ctx.getBindingContainer().setEnableTokenValidation(true);
    if (ctx.getEvents() == null || ctx.getEvents().size() ==0) {
    setPage(ctx,1);
    setLastPage(ctx,getIterForPaging(ctx).getRowSetIterator().getEstimatedRangePageCount());
    else if(event.equals("setRangeStart")) {
    setPageFromRequest(ctx);
    }

  • Lov based on a dynamic view object

    Build JDEVADF_11.1.2.0.0_GENERIC_110531.1615.6017
    Hi,
    I have a database table containing a column with the Name of a Table as content.
    I created a dynamic view and overwrite this with a method in Appmodule.
    Then I add to the element in the main view the Lov. I execute the method in JSP page.
    But the SelectOnechoice list is empty!
    Where is the problem? How can I create a Lov based on a dynamic view object?
    Thanks in advance and best regards
    Edited by: NewBB on 12.08.2011 00:53

    Hi Neliel,
    thank you for your reply.
    My problem is not the same. I can also see my dynamic view objects as selectonechoice. I have a table T1 has a column t1c1 (Number),
    another table T2 (dynamic view object) with two columns t2c1 (Number) and t2c2 (varchar2).
    In my application I want to represent the values of t1c1 as selectonechoice with the values of t2c2.
    and that does not work. My list is empty. Any idea???

  • Master-detail with dynamic view object

    How can you create a view link with a view object that is dynamic? I have created a master-detail relationship on a UIX page. I change the master view object at runtime using a view definition and SQL and then I bind the view object to an iterator on a UIX page. I need the new dynamic view object to maintain the link between the detail view object. Is this possible?
    The reason why I have to change the view object at runtime is because I am implementing a search module and the tables in the from clause can be modified at runtime so I need to have a dynamic view object.
    Thanks,
    Sanjay

    After playing around with ViewObjectImpl's setQuery() method some more I found out that this solution might not work for me due to the following reason: when the user tries to sort a column in the result table, the original contents of the view object get executed instead of the run time query.
    <p>
    I would like to go back to my original solution that included creating a view definition based on the runtime query and then creating a view object from that which I bind to the RowSetIterator. The missing piece to the master-detail functionality is with the detail Iterator being in sync with the master. I have tried the following but I get a ClassCastException <p>
    DCIteratorBinding detailBinding = ctx.getBindingContainer().findIteratorBinding("DetailIterator");
    detailBinding.getViewObject().<b>setMasterRowSetIterator</b>(masterBinding.getRowSetIterator());
    <p>
    here is the relevant stack trace:
    java.lang.ClassCastException
    at oracle.jbo.client.remote.ViewUsageImpl.getImplObject(ViewUsageImpl.java:1829)
    at oracle.jbo.client.remote.RowSetImpl.setMasterRowSetIterator(RowSetImpl.java:512)
    at oracle.jbo.client.remote.ViewUsageImpl.setMasterRowSetIterator(ViewUsageImpl.java:1147)
    at oracle.jbo.common.ws.WSViewObjectImpl.setMasterRowSetIterator(WSViewObjectImpl.java:1005)

Maybe you are looking for

  • LV 8.2 install error - system doesn't meet min requirments

    Minimum system requirements for 8.2 are pasted below.  I'm trying to install on a 2GHz P4, 256MB RAM, w/100GB HD space yet I get a message effectively telling me my system in not good enough . What gives? Processor Pentium III/Celeron 866 MHz or equi

  • Creating a sales order document

    Hi, When I create a sales order document in one company I want to automatically create a purchase order document (in the same company), and when this one is created I want to create a sales order document (in another company) with the same data as th

  • [Systemd] Very long boot time

    I have a very long boot time with my Arch. Startup finished in 828766ms (kernel) + 63430ms (userspace) = 892196ms Especially after login into gnome, it takes quite a while until the desktop is visible. In meanwhile, I only see the wallpaper.  Does an

  • Full File path of the uploaded fie in struts

    How do we get full file path from the FileForm component in Struts upload. Acutal requirement is that , in the file browser component, the user may select a file or he may paste and external link like http://www.xyz.com/abc/index.html etc.., How do w

  • PS-script that can list all clients in a specific collection and if possible, point out direct members...

    CM2012Sp1Cu1  Need a powershell-function that can list all the clients in a specific collection, and then somehow define which of them are direct members. The most important thing for me is to list all the members but it would also be great if I coul