Bad Performance in a query into table BKPF

Hi forum i have a really problem in the second query under the table
BKPF.. some body cans help me, please
*THIS IS THE QUERY UNDER MSEG
  SELECT tmsegmblnr tmkpfbudat tmsegbelnr tmsegbukrs tmseg~matnr
         tmsegebelp tmsegdmbtr tmsegwaers tmsegwerks tmseg~lgort
         tmsegmenge tmsegkostl
  FROM mseg AS tmseg JOIN mkpf AS tmkpf ON tmsegmblnr = tmkpfmblnr
  INTO CORRESPONDING FIELDS OF TABLE it_docs
  WHERE
    tmseg~bukrs IN se_bukrs AND
    tmkpf~budat IN se_budat AND
    tmseg~mjahr = d_gjahr AND
    ( tmsegbwart IN se_bwart AND tmsegbwart IN (201,261) ).
  IF sy-dbcnt > 0.
I CREATE AWKEY FOR CONSULTING BKPF
    LOOP AT it_docs.
      CONCATENATE it_docs-mblnr d_gjahr INTO it_docs-d_awkey.
      MODIFY it_docs.
    ENDLOOP.
THIS IS THE QUERY WITH BAD BAD PERFOMANCE
I NEED KNOW "BELNR" FOR GO TO THE BSEG TABLE
    SELECT belnr awkey
    FROM bkpf
    INTO CORRESPONDING FIELDS OF TABLE it_tmp
    FOR ALL ENTRIES IN it_docs
    WHERE
      bukrs = it_docs-bukrs AND
      awkey = it_docs-d_awkey AND
      gjahr = d_gjahr AND
      bstat = space .
THNKS

Hi Josue,
The bad performance is because you're not specifying the primary keys of the table BKPF in your WHERE condition; BKPF usually is a big table.
What you really need is to create a new index on database for table BKPF via the ABAP Dictionary on fields BUKRS, AWKEY, GJAHR & BSTAT. You'll find the performace of the program will significantly increase after the new index is activated. But I would talk to the Basis first to confirm they have no issues if you create a new index for BKPF on the database system.
Hope this helps.
Cheers,
Sougata.

Similar Messages

  • Bad performance of af:query

    I am working on Oracle Jdeveloper 11g Release 1
    I have a VO which gets executed when the first page gets loaded. suppose the VO is RuleLibraryVO
    I have a view criteria RuleLibraryVOCriteria in the VO which is used in the af:query panel in the page.
    When i do search for any attribute using the query panel the VO gets executed again everytime even if the VO is in the memory. This is hampering the performance of my query panel as it is again calling getters for all 2000+ rows and then searching. The VO Criteria used is:
    <ViewCriteria
        Name="RuleLibraryVOCriteria"
        ViewObjectName="oracle.sysman.core.gccompliance.model.library.rule.view.RuleLibraryVO"
        Conjunction="AND"
        Mode="3">
        <Properties>
          <CustomProperties>
            <Property
              Name="displayOperators"
              Value="InAdvancedMode"/>
            <Property
              Name="autoExecute"
              Value="true"/>
            <Property
              Name="allowConjunctionOverride"
              Value="true"/>
            <Property
              Name="showInList"
              Value="false"/>
            <Property
              Name="mode"
              Value="Basic"/>
            <Property
              Name="displayName"
              ResId="DEFAULT_SEARCH"/>
          </CustomProperties>
        </Properties>
        <ViewCriteriaRow
          Name="vcrow3"
          UpperColumns="1">
          <ViewCriteriaItem
            Name="RuleDnameTransient"
            ViewAttribute="RuleDnameTransient"
            Operator="CONTAINS"
            Conjunction="AND"
            Required="Optional">
            <CompOper
              Name="LessThan"
              ToDo="-1"
              Oper="&lt;"
              MinCardinality="0"
              MaxCardinality="0"/>
            <CompOper
              Name="LessThanOrEqualTo"
              ToDo="-1"
              Oper="&lt;="
              MinCardinality="0"
              MaxCardinality="0"/>
            <CompOper
              Name="GreaterThan"
              ToDo="-1"
              Oper=">"
              MinCardinality="0"
              MaxCardinality="0"/>
            <CompOper
              Name="GreaterThanOrEqualTo"
              ToDo="-1"
              Oper=">="
              MinCardinality="0"
              MaxCardinality="0"/>
          </ViewCriteriaItem>
          <ViewCriteriaItem
            Name="DescriptionTransient"
            ViewAttribute="DescriptionTransient"
            Operator="CONTAINS"
            Conjunction="AND"
            Required="Optional">
            <CompOper
              Name="LessThan"
              ToDo="-1"
              Oper="&lt;"
              MinCardinality="0"
              MaxCardinality="0"/>
            <CompOper
              Name="LessThanOrEqualTo"
              ToDo="-1"
              Oper="&lt;="
              MinCardinality="0"
              MaxCardinality="0"/>
            <CompOper
              Name="GreaterThan"
              ToDo="-1"
              Oper=">"
              MinCardinality="0"
              MaxCardinality="0"/>
            <CompOper
              Name="GreaterThanOrEqualTo"
              ToDo="-1"
              Oper=">="
              MinCardinality="0"
              MaxCardinality="0"/>
          </ViewCriteriaItem>
          <ViewCriteriaItem
            Name="IsSystem"
            ViewAttribute="IsSystem"
            Operator="="
            Conjunction="AND"
            Required="Optional"/>
          <ViewCriteriaItem
            Name="RuleType"
            ViewAttribute="RuleType"
            Operator="="
            Conjunction="AND"
            Required="Optional"/>
          <ViewCriteriaItem
            Name="TargetType"
            ViewAttribute="TargetType"
            Operator="="
            Conjunction="AND"
            Required="Optional"
            Value=":targetType"
            IsBindVarValue="true"/>
          <ViewCriteriaItem
            Name="KeywordsTransient"
            ViewAttribute="KeywordsTransient"
            Operator="CONTAINS"
            Conjunction="AND"
            Required="Optional"/>
        </ViewCriteriaRow>
      </ViewCriteria>The query panel in jspx is:
    <af:query id="qryId2"
                      headerText="#{coregccomplianceuiBundle.COMPLIANCE_SEARCH}"
                      disclosed="false"
                      value="#{bindings.RuleLibraryVOCriteriaQuery.queryDescriptor}"
                      model="#{bindings.RuleLibraryVOCriteriaQuery.queryModel}"
                      queryListener="#{bindings.RuleLibraryVOCriteriaQuery.processQuery}"
                      queryOperationListener="#{bindings.RuleLibraryVOCriteriaQuery.processQueryOperation}"
                      resultComponentId="::pc1:ruleLib" rows="3" maxColumns="2"
                      saveQueryMode="hidden"/>How can i optimize the search behavior so that it only searches using the vo data already loaded in memory.

    Hi Frank,
    Thanks for quick response,
    As suggested i made the Query Execution Mode to - In-Memory. And my view criteria now is:
    <ViewCriteria
        Name="RuleLibraryVOCriteria"
        ViewObjectName="oracle.sysman.core.gccompliance.model.library.rule.view.RuleLibraryVO"
        Conjunction="AND"
        Mode="2">
        <Properties>
          <CustomProperties>
            <Property
              Name="displayOperators"
              Value="InAdvancedMode"/>
            <Property
              Name="autoExecute"
              Value="true"/>
            <Property
              Name="allowConjunctionOverride"
              Value="true"/>
            <Property
              Name="showInList"
              Value="false"/>
            <Property
              Name="mode"
              Value="Basic"/>
            <Property
              Name="displayName"
              ResId="DEFAULT_SEARCH"/>
          </CustomProperties>
        </Properties>
        <ViewCriteriaRow
          Name="vcrow3"
          UpperColumns="1">
          <ViewCriteriaItem
            Name="RuleDnameTransient"
            ViewAttribute="RuleDnameTransient"
            Operator="CONTAINS"
            Conjunction="AND"
            Required="Optional">
            <CompOper
              Name="LessThan"
              ToDo="-1"
              Oper="&lt;"
              MinCardinality="0"
              MaxCardinality="0"/>
            <CompOper
              Name="LessThanOrEqualTo"
              ToDo="-1"
              Oper="&lt;="
              MinCardinality="0"
              MaxCardinality="0"/>
            <CompOper
              Name="GreaterThan"
              ToDo="-1"
              Oper=">"
              MinCardinality="0"
              MaxCardinality="0"/>
            <CompOper
              Name="GreaterThanOrEqualTo"
              ToDo="-1"
              Oper=">="
              MinCardinality="0"
              MaxCardinality="0"/>
          </ViewCriteriaItem>
          <ViewCriteriaItem
            Name="DescriptionTransient"
            ViewAttribute="DescriptionTransient"
            Operator="CONTAINS"
            Conjunction="AND"
            Required="Optional">
            <CompOper
              Name="LessThan"
              ToDo="-1"
              Oper="&lt;"
              MinCardinality="0"
              MaxCardinality="0"/>
            <CompOper
              Name="LessThanOrEqualTo"
              ToDo="-1"
              Oper="&lt;="
              MinCardinality="0"
              MaxCardinality="0"/>
            <CompOper
              Name="GreaterThan"
              ToDo="-1"
              Oper=">"
              MinCardinality="0"
              MaxCardinality="0"/>
            <CompOper
              Name="GreaterThanOrEqualTo"
              ToDo="-1"
              Oper=">="
              MinCardinality="0"
              MaxCardinality="0"/>
          </ViewCriteriaItem>
          <ViewCriteriaItem
            Name="IsSystem"
            ViewAttribute="IsSystem"
            Operator="="
            Conjunction="AND"
            Required="Optional"/>
          <ViewCriteriaItem
            Name="RuleType"
            ViewAttribute="RuleType"
            Operator="="
            Conjunction="AND"
            Required="Optional"/>
          <ViewCriteriaItem
            Name="TargetType"
            ViewAttribute="TargetType"
            Operator="="
            Conjunction="AND"
            Required="Optional"
            Value=":targetType"
            IsBindVarValue="true"/>
          <ViewCriteriaItem
            Name="KeywordsTransient"
            ViewAttribute="*KeywordsTransient*"
            Operator="CONTAINS"
            Conjunction="AND"
            Required="Optional"
            UpperColumns="0"/>
        </ViewCriteriaRow>
      </ViewCriteria>
      The performance hit is when i search for attribute: KeywordsTransient.
    The attribute is as :
      <ViewAttribute
        Name="KeywordsTransient"
        IsSelected="false"
        IsPersistent="false"
        PrecisionRule="true"
        Type="java.lang.String"
        ColumnType="VARCHAR2"
        AliasName="VIEW_ATTR"
        SQLType="VARCHAR">
        <RecalcCondition><![CDATA[return (adf.object.isAttributeChanged("Keywords")]]></RecalcCondition>
        <TransientExpression><![CDATA[object.Keywords]]></TransientExpression>
        <Dependencies>
          <Item
            Value="Keywords"/>
        </Dependencies>
        <Properties>
          <SchemaBasedProperties>
            <LABEL
              ResId="KEYWORDS"/>
          </SchemaBasedProperties>
        </Properties>
      </ViewAttribute>
      This attribute is dependent on Keywords attribute of the VO , The keyword getter is as below:
         * Gets the attribute value for the calculated attribute Keywords.
         * @return the Keywords
        public String getKeywords() {
            if (((String) getAttributeInternal(KEYWORDS)) == null)
                        long startTime = System.currentTimeMillis();
                        String keyword = "";
                        CSRUtil csrUtil = new CSRUtil();
                       // get the keyword name list from RuleKeywordTableVO which stores ruleGuid to KeywordName mapping. This VO is Loaded in memory as soon as bean initailizes.
                        Set<String> keywordList =
                            csrUtil.getRuleKeywordListFromKeywordMapVO(getRuleGuid());
                        if (keywordList != null)
                            Iterator rowIter = keywordList.iterator();
                            while (rowIter.hasNext())
                                keyword =
                                        keyword.concat(csrUtil.getKeywordNlsIdFromTable((String) rowIter.next())) +
                        if (keyword.endsWith(", "))
                            keyword = keyword.substring(0, keyword.length() - 2);
                        setKeywords(keyword);
                        setKeywordsTransient(keyword);
                        long endTime = System.currentTimeMillis();
                        logger.severe("Time taken for this rule in millis : "+ (endTime-startTime));
                    return (String) getAttributeInternal(KEYWORDS);
      This getter is creating keyword list using nlsid translation based on other tables data for a rule.
    Also, I have loaded the rule vo data in memory using invokeAction on my page as below:
        <invokeAction id="ExecuteRuleInvoke" Binds="ExecuteRULE"
                      Refresh="renderModel" RefreshCondition="#{sdk_core_uifwk_refresh_ctrl.executeNeeded}"/>
         <action IterBinding="RuleLibraryVO1Iterator" id="ExecuteRULE"
                InstanceName="ComplianceLibraryAMDataControl.RuleLibraryVO1"
                DataControl="ComplianceLibraryAMDataControl"
                RequiresUpdateModel="true" Action="iteratorExecute"/>
      So now when i search for a keywordTransient attribute using query panel the getter is always called for keywords even if the VO data is in memory.
    So what am i missing, is the data loaded by invokeAction not visible to the query, or i have to use some other optimization.

  • Performance problem with query on bkpf table

    hi good morning all ,
    i ahave a performance problem with a below query on bkpf table .
    SELECT bukrs
               belnr
               gjahr
          FROM bkpf
          INTO TABLE ist_bkpf_temp 
         WHERE budat IN s_budat.
    is ther any possibility to improve the performanece by using index .
    plz help me ,
    thanks in advance ,
    regards ,
    srinivas

    hi,
    if u can add bukrs as input field or if u have bukrs as part of any other internal table to filter out the data u can use:
    for ex:
    SELECT bukrs
    belnr
    gjahr
    FROM bkpf
    INTO TABLE ist_bkpf_temp
    WHERE budat IN s_budat
        and    bukrs in s_bukrs.
    or
    SELECT bukrs
    belnr
    gjahr
    FROM bkpf
    INTO TABLE ist_bkpf_temp
    for all entries in itab
    WHERE budat IN s_budat
        and bukrs = itab-bukrs.
    Just see , if it is possible to do any one of the above?? It has to be verified with ur requirement.

  • Need pointers to improve performance of a select query to table vbrk

    Hey Folks,
    I have a query , whose performance needs to be tuned , as such:
        SELECT a~vbeln
               a~fkart                    
               a~waerk
               a~fkdat                   
               b~posnr
               b~vgbel
               b~vgpos
               b~matnr
               b~arktx
               b~prctr
               b~txjcd
          INTO TABLE gi_billing_items
          FROM vbrk AS a
          INNER JOIN vbrp AS b
          ON a~vbeln = b~vbeln
          FOR ALL ENTRIES IN gi_sales_items
         WHERE b~vgbel = gi_sales_items-vbeln
           AND b~vgpos  = gi_sales_items-posnr
           AND b~matnr  = gi_sales_items-matnr
           AND b~werks  = gi_sales_items-werks.
    where
    gi_sales_items is an internal table consisting of 278 entries,.
    The result set collected in table gi_billing_items is 200 records
    The total execution time for this query for the afore given data is 72,983 ms with the average time/record being ~ 9,471 ms which is too high.
    When I try to verify the Explain Plan of the query in ST05, in the Access path I see that the performance of Query Block 1 is bad. Query Block 1 is of the QBLOCK_TYPE UNIONA. Its the very first step in the Query execution internally.
    The indexes are defined on participating tables VBRK and VBRP as:
    VBRK~0      MANDT,VBELN
    VBRK~LOC MANDT,LCNUM
    VBRP~0      MANDT,VBELN,POSNR
    VBRP~Z01   FPLNR,MANDT
    VBRP~Z02   MANDT,MATNR,WERKS
    Its clear from the ST05, STAD and SE30 traces that there is a performance issue in this query. Does anyone have any pointers as to how to resolve this issue? Is there a protocol one needs to follow when using the "FOR ALL ENTRIES IN" clause? Or is there a need for any secondary indexes to be created?
    Please let me know
    Thanks and Best Regards,
    Rashmi.

    Hi,
    Try using the VBFA...to get the Invoice number and line item..and then use that value in VBRK...
    * Declare the internal table for T_VBFA.
    IF NOT gi_sales_items[] IS INITIAL.
    SELECT VBELV
                  POSNV
                  VBELN
                  POSNN
                  VBTYP_N
                  INTO TABLE T_VBFA
                  FOR ALL ENTRIES IN gi_sales_items
                  WHERE VBELV = gi_sales_items-VBELN
                  AND       POSNV = gi_sales_items-POSNR
                  AND       VBTYP_N = 'M'.             "Invoice                       ""Added this..
    ENDIF.
    **Add two columns to GI_SALES_ITEMS..to store the VBELN POSNN the data from t_vbfa..let's assume it is VBELN_VF and POSNR_VF
    * Basically merge gi_sales_items AND t_vbfa
    ** Then use that field in
    IF NOT GI_SALES_ITEMS[] IS INITIAL.
          SELECT a~vbeln
               a~fkart                    
               a~waerk
               a~fkdat                   
               b~posnr
               b~vgbel
               b~vgpos
               b~matnr
               b~arktx
               b~prctr
               b~txjcd
          INTO TABLE gi_billing_items
          FROM vbrk AS a
          INNER JOIN vbrp AS b
          ON a~vbeln = b~vbeln
          FOR ALL ENTRIES IN gi_sales_items
          WHERE b~vbeln = gi_sales_items-vbeln_vf   " Change here
           AND b~posnr  = gi_sales_items-posnr_vf     " Change here
           AND b~matnr  = gi_sales_items-matnr
           AND b~werks  = gi_sales_items-werks.
    ENDIF.
    Thanks
    Naren
    Edited by: Narendran Muthukumaran on Oct 15, 2008 11:35 PM

  • Unable to perform "insert into table select ...." using DBF_JDBC30

    below i post my code :
    import java.util.*;
    import java.sql.*;
    import java.io.*;
    import com.hxtt.sql.*;
    public class backofficeDbfVerification {
    public backofficeDbfVerification(String path) throws SQLException {
    Properties prop = new Properties();
    prop.setProperty("user", "");
    prop.setProperty("OtherExtensions","true");
    prop.setProperty("Version Number", "03");
    try {
    Class.forName("com.hxtt.sql.dbf.DBFDriver").newInstance();
    connection = DriverManager.getConnection("jdbc:DBF:/"+path, prop);
    catch (ClassNotFoundException classnotfoundexception) {
    System.out.println("could ot find HXTT class, make sure the classpath have been defined in your system !");
    catch(Exception e) {
    System.out.println(e.getMessage());
    public void createBadRecord(String table, String newtable, int blth) throws SQLException {
    Statement stmt = connection.createStatement();
    String insert = "insert into \""+newtable+"\" select * from \""+table+"\"";
    boolean bInsert = stmt.execute(insert);
    stmt.close();
    public static void main (String args[]) {
         String path = "C:\\MASTER\\SOURCEDATA\\AREA";
    try {
    backofficeDbfVerification test = new backofficeDbfVerification(path);
    test.createBadRecord("source\\area\\123.AA2","source\\area\\others\\89964568.AA1");
    catch(SQLException sqx) {
    System.out.println("Error "+sqx.getMessage());
    i try to perform simple query : insert into tablea select from tableb which has same structure. the source table has only 9 rows, but the process ran very long time, no error message raised,it just run and never end (which make me upset for the whole day).
    i have tried another simple query : insert into table1 values (1,2) using the same driver and execute successfully.
    is it becoz of function limitation since i used evaluation copy ?

    Copy the answer from HXTT's support forum:
    No function limitation. I just tested:
    create table testa1 select * from test;
    insert into testa1 select * from test;
    Passed.
    I also run your backofficeDbfVerification.java sample. Passed too. I'm using the same code as you. The difference is only my 89964568.AA1 and 123.AA2 is simulative tables files. If possible, please zip your 89964568.AA1 and 123.AA2 and email to [email protected] Thanks.
    BTW, I pasted the little modified backofficeDbfVerification.java below:
    import java.sql.*;
    import java.util.*;
    public class backofficeDbfVerification {
    Connection connection;
    public backofficeDbfVerification(String path) throws SQLException {
    Properties prop = new Properties();
    prop.setProperty("user", "");
    prop.setProperty("OtherExtensions", "true");
    prop.setProperty("Version Number", "03");
    try {
    Class.forName("com.hxtt.sql.dbf.DBFDriver").newInstance();
    connection = DriverManager.getConnection("jdbc:DBF:/" + path, prop);
    catch (ClassNotFoundException classnotfoundexception) {
    System.out.println("could ot find HXTT class, make sure the classpath have been defined in your system !");
    catch (Exception e) {
    System.out.println(e.getMessage());
    public void createBadRecord(String table, String newtable) throws
    SQLException {
    Statement stmt = connection.createStatement();
    String insert = "insert into \"" + newtable + "\" select * from \"" +
    table + "\"";
    boolean bInsert = stmt.execute(insert);
    stmt.close();
    public static void main(String args[]) {
    String path = "f:\\dbffiles";
    try {
    backofficeDbfVerification test = new backofficeDbfVerification(path);
    test.createBadRecord("source\\area\\123.AA2",
    "source\\area\\others\\89964568.AA1");
    catch (SQLException sqx) {
    System.out.println("Error " + sqx.getMessage());
    }

  • Performance - inserts into tables.

    Hi All,
    I am using Oracle 11g R2 and I am preparing some performance tests for our application. This application will load a lot of data (around 10 millions of rows per day) in a couple of Oracle tables with CLOB data types and varchar data types.
    I would like to know if you have any advices on setting up the tables in order to increase the performance of the inserts into theses tables (use of ASM ? changing table parameters like initrans, etc.)
    Many thanks !

    Hi,
    I'm not sure if I can be any more specific than this, but ok, I'll try.
    It's a bad habit to start any database activity by tweaking the parameters. Of course, there are exceptions to this rule, but generally you either don't need to touch parameters at all, or you modify them based on evidence from performance tests. So here is what I would do:
    - take requirements
    - take a test environment that has enough similarity to production
    - build a simiple test -- X sessions doing Y inserts per second concurrently, where X and Y will be derived from your requirements
    - see if insert time is within the target goal
    - if not, look at response time profile -- where does the process spend more time? how can this time be reduced. in particular, if you see contention-related waits, then you may need to tweak initrans or some other parameters
    If you do it this way, you'll be able to understand and trust your results. If you just collect a bunch of opinions from guys you never met and who never saw your system, who knows what you'd get.
    Best regards,
      Nikolay

  • Performance Tuning for A016 (cluster table) Query

    Dear SDNers,
    Issue:
    The report runs  successfully sometimes and sometimes the report gets timed out.
    My findings
    Query which is taking a  long time to execute is the query on A016(cluster Table) to fetch the condition details
    SELECT kschl
             evrtn
             evrtp
             knumh
             FROM a016 INTO TABLE t_a016
             FOR ALL ENTRIES IN t_ekpo
             WHERE
             kappl EQ c_m (Application)
             AND kschl IN s_kschl
             AND evrtn = t_ekpo-ebeln
             AND evrtp = t_ekpo-ebelp.
    where t_ekpo contains entries (4354)from ekko and ekpo based on the selection screen entries.
    I see that a016 is a cluster table that is being used here and t_a016 contains (390*) records after the above fetch.
    Dear readers,Please help me as to what has to be taken care of inorder to fine tune this select query?
    what are the things that i need to make corrections in.
    How can i make this fetch effective and faster?
    Please help me with your inputs.
    Regards,
    SuryaD.
    Edited by: SuryaD on Oct 26, 2009 6:29 PM

    Hi,
    1) Try to hit the table A016 with only unique entries of t_ekpo for EBELN and EBELP...
    Use some temp table lt_ekpo = t_ekpo
    i.e. sort lt_ekpo by ebeln ebelp
    delete adjacent duplicates from lt_ekpo comparing ebeln ebelp.
    Now write you select query as below...So that the table might be hit with less number of entries...
    SELECT kschl
    evrtn
    evrtp
    knumh
    FROM a016 INTO TABLE t_a016
    FOR ALL ENTRIES IN lt_ekpo
    WHERE
    kappl EQ c_m (Application)
    AND kschl IN s_kschl
    AND evrtn = lt_ekpo-ebeln
    AND evrtp = lt_ekpo-ebelp.
    Please note that there will be no change in the output data if you hit with duplicate entries/unique as FOR ALL ENTRIES will fetch only unique entries matching the where condition.
    2) Order of where conditon fields should be same as the order in table for better performance...
    3) If you find any index on the table, try to include the fields in where condition(if possible) for better performance
    Hope this helps
    Regards
    Shiva

  • Loading an Oracle SQL query into an MSSQL table

    I have a select query on an Oracle table. I want to load this data into an MSSQL table.
    Problem is that I cannot create an interim table on the Oracle database (lack of privelages)
    Is there a way to load an Oracle query into the MSSQL table without an interim table?
    Many thanks
    Z

    Yes,
    1) Create an ODI procedure
    2) Create a step inside
    3) at source tab put the oracle query
    4) at target tab put the sql insert code
    Refer to the oracle returned values like "#column_name_from_oracle_query"
    Make sense?
    Cezar Santos
    [www.odiexperts.com]

  • Inserting into Table-in-Table after re-execution the Outer Table query

    Hi Gurus,
    I have a problem with inserting into Table-in-Table after re-execution the Outer Table query:
    The problem:
    I have two tables; both tables are based on VO; tables have a VL between them;
    The Inner Table is hidden when page lode.
    I'm executing the Outer Table, open the details to see the Inner Table, I can add rows to the Inner Table. Everything is OK.
    But-
    After I'm executing the Outer Table again –
    Adding new rows to the Inner Table is not work anymore, despite I'm executing the Inner Table RowSet query.
    Scenario is:
    In processRequest():
    In the processRequest() I'm calling executeQuery() of the Outer Table Only.
    (So the Details executeQuery() will be done by VL and Its works fine.)
    In processFormRequest():
    User opens the details to see the Inner Table.
    On some event, I'm executing the Outer Table query.
    On some other event, programmatically I am inserting a new row to the Inner Table, and a new row is displayed in the Inner Table as I wanted.
    In this way, one row after another, I can add as many rows as I wish, without any problem.
    (This scenario should behave as same clicking on button of type "Add-Another-Row", just adding the row automatically)
    The code for the inserting (as specified in the chapter "Classic Tables" --> "table-in-table"):
    OARow newRow = (OARow) innerRowSet.createRow();
    innerRowSet.insertRow(newRow);
    innerRowSet.setRangeSize(innerRowSet.getRangeSize()+ 1);
    innerRowSet.executeQuery();
    If the user won't cause to re-execution of the outer table – no problem occurs.
    * Should I add something after the Outer Table VO execution?
    * Maybe to the inserting to the Inner Table code?
    Please help…

    Hi, Thanks.
    I don't know which one of the Outer Table rows is the current row,
    But-
    Only the Details (the Inner Tables) who where opened before the executeQuery() of the Outer table are not acts as they should.
    All the Details who where closed before the executeQuery() of the Outer table are still works fine.
    Please advise.

  • How to minimise performance degradation when querying a growing table during processing...?

    Hi everyone
    Let's say you have a PL/SQL routine that is processing data from a source table and for each record, it checks to see whether a matching record exists in a header table (TableA); if one does, it uses it otherwise it creates a new one. It then inserts associated detail records (into TableB) linked to the header record. So the process is:
    Read record from source table
    Check to see if matching header record exists in TableA (using indexed field)
    If match found then store TXH_ID (PK in TableA)
    If no match found then create new header record in TableA with new TXH_ID
    Create detail record in TableB where TXD_TXH_ID (FK on TableB) = TXH_ID
    If the header table (Table A) starts getting big (i.e. the process adds a few million records to it), presumably the stats on TableA will start to get stale and therefore the query in step 2 will become more time consuming?
    If so, is there any way to rectify this? Would updating the stats at certain points in the process be effective?
    Would it be any different if a MERGE was used to (conditionally) insert the header records into TableA? (i.e. would the stats still get stale?)
    DB is 11GR2 and OS is Windows Server 2008
    Thanks

    Let's say you have a PL/SQL routine that is processing data from a source table and for each record, it checks to see whether a matching record exists in a header table (TableA); if one does, it uses it otherwise it creates a new one. It then inserts associated detail records (into TableB) linked to the header record. So the process is:
    Read record from source table
    Check to see if matching header record exists in TableA (using indexed field)
    If match found then store TXH_ID (PK in TableA)
    If no match found then create new header record in TableA with new TXH_ID
    Create detail record in TableB where TXD_TXH_ID (FK on TableB) = TXH_ID
    If the header table (Table A) starts getting big (i.e. the process adds a few million records to it), presumably the stats on TableA will start to get stale and therefore the query in step 2 will become more time consuming?
    What do you mean 'presumably the stats . .'?
    In item #3 you said that TXH_ID is the primary key. That means only ONE value will EVER be found in the index so there should be NO degradation for looking up that primary key value.
    The plan you posted shows an index range scan. A range scan is NOT used to lookup primary key values since they must be unique (meaning there is NO RANGE).
    So there should be NO impact due to the header table 'getting big'.

  • How many records are  fetched my query into my internal tables

    Hi
    I am in the debugger, would like to know, how many records are  fetched my query into my internal tables. How do I  find out ?
    thanks
    siva

    Hi,
    Do the following,
    Step 1:
      Fill your internal table with select query.
    Step 2 : Use DESCRIBE statement with LINE addition to get the no of rows in the internal table.
    for further informations, check
    http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb3798358411d1829f0000e829fbfe/content.htm
    Regards,
    Anirban

  • Performance issues while query data from a table having large records

    Hi all,
    I have a performance issues on the queries on mtl_transaction_accounts table which has around 48,000,000 rows. One of the query is as below
    SQL ID: 98pqcjwuhf0y6 Plan Hash: 3227911261
    SELECT SUM (B.BASE_TRANSACTION_VALUE)
    FROM
    MTL_TRANSACTION_ACCOUNTS B , MTL_PARAMETERS A  
    WHERE A.ORGANIZATION_ID =    B.ORGANIZATION_ID 
    AND A.ORGANIZATION_ID =  :b1 
    AND B.REFERENCE_ACCOUNT =    A.MATERIAL_ACCOUNT 
    AND B.TRANSACTION_DATE <=  LAST_DAY (TO_DATE (:b2 ,   'MON-YY' )  )  
    AND B.ACCOUNTING_LINE_TYPE !=  15  
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      3      0.02       0.05          0          0          0           0
    Fetch        3    134.74     722.82     847951    1003824          0           2
    total        7    134.76     722.87     847951    1003824          0           2
    Misses in library cache during parse: 1
    Misses in library cache during execute: 2
    Optimizer mode: ALL_ROWS
    Parsing user id: 193  (APPS)
    Number of plan statistics captured: 1
    Rows (1st) Rows (avg) Rows (max)  Row Source Operation
             1          1          1  SORT AGGREGATE (cr=469496 pr=397503 pw=0 time=237575841 us)
        788242     788242     788242   NESTED LOOPS  (cr=469496 pr=397503 pw=0 time=337519154 us cost=644 size=5920 card=160)
             1          1          1    TABLE ACCESS BY INDEX ROWID MTL_PARAMETERS (cr=2 pr=0 pw=0 time=59 us cost=1 size=10 card=1)
             1          1          1     INDEX UNIQUE SCAN MTL_PARAMETERS_U1 (cr=1 pr=0 pw=0 time=40 us cost=0 size=0 card=1)(object id 181399)
        788242     788242     788242    TABLE ACCESS BY INDEX ROWID MTL_TRANSACTION_ACCOUNTS (cr=469494 pr=397503 pw=0 time=336447304 us cost=643 size=4320 card=160)
       8704356    8704356    8704356     INDEX RANGE SCAN MTL_TRANSACTION_ACCOUNTS_N3 (cr=28826 pr=28826 pw=0 time=27109752 us cost=28 size=0 card=7316)(object id 181802)
    Rows     Execution Plan
          0  SELECT STATEMENT   MODE: ALL_ROWS
          1   SORT (AGGREGATE)
    788242    NESTED LOOPS
          1     TABLE ACCESS   MODE: ANALYZED (BY INDEX ROWID) OF
                    'MTL_PARAMETERS' (TABLE)
          1      INDEX   MODE: ANALYZED (UNIQUE SCAN) OF
                     'MTL_PARAMETERS_U1' (INDEX (UNIQUE))
    788242     TABLE ACCESS   MODE: ANALYZED (BY INDEX ROWID) OF
                    'MTL_TRANSACTION_ACCOUNTS' (TABLE)
    8704356      INDEX   MODE: ANALYZED (RANGE SCAN) OF
                     'MTL_TRANSACTION_ACCOUNTS_N3' (INDEX)
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      row cache lock                                 29        0.00          0.02
      SQL*Net message to client                       2        0.00          0.00
      db file sequential read                    847951        0.40        581.90
      latch: object queue header operation            3        0.00          0.00
      latch: gc element                              14        0.00          0.00
      gc cr grant 2-way                               3        0.00          0.00
      latch: gcs resource hash                        1        0.00          0.00
      SQL*Net message from client                     2        0.00          0.00
      gc current block 3-way                          1        0.00          0.00
    ********************************************************************************On a 5 node rac environment the program completes in 15 hours whereas on a single node environemnt the program completes in 2 hours.
    Is there any way I can improve the performance of this query?
    Regards
    Edited by: mhosur on Dec 10, 2012 2:41 AM
    Edited by: mhosur on Dec 10, 2012 2:59 AM
    Edited by: mhosur on Dec 11, 2012 10:32 PM

    CREATE INDEX mtl_transaction_accounts_n0
      ON mtl_transaction_accounts (
                                   transaction_date
                                 , organization_id
                                 , reference_account
                                 , accounting_line_type
    /:p

  • Please help with multiple insert query into nested table!!!!

    I am having a problem with inserting multiple references to objects into a nested table using the following query:
    INSERT INTO TABLE(SELECT Taken_by FROM courses WHERE course_number= 001)
    (SELECT REF(p) FROM persons p
    WHERE p.enroled_in = 'Computing for Business'
    The database says that p.enroled_in is an invalid identifier. I know why this is. This is because the field enroled_in is part of a subtype of person called student_type and the query above is not accounting for this properly. I would like to know the correct syntax to use so I can insert into the nested table wherever a student is enroled into the 'computing for business' course. My full schema is below:
    CREATE TYPE person_type;
    CREATE TYPE student_type;
    CREATE TYPE staff_type;
    CREATE TYPE course_type;
    CREATE TYPE module_type;
    CREATE TYPE address_type AS OBJECT
    Street VARCHAR2 (30),
    Town     VARCHAR2 (30),
    County VARCHAR2 (30),
    Postcode VARCHAR2 (9)
    CREATE TYPE person_type AS OBJECT
    Name VARCHAR2 (50),
    Address address_type,
    DOB     DATE
    ) NOT FINAL;
    CREATE TYPE staff_type UNDER person_type
    Staff_number NUMBER (2,0)
    ) FINAL;
    CREATE TYPE student_type UNDER person_type (
    Student_number NUMBER (2,0),
    Enroled_in VARCHAR2(50),
    MEMBER FUNCTION getAge RETURN NUMBER
    )NOT FINAL;
    CREATE OR REPLACE TYPE BODY student_type AS
    MEMBER FUNCTION getAge RETURN NUMBER AS
    BEGIN
    RETURN Trunc(Months_Between(Sysdate, DOB)/12);
    END getAge;
    END;
    CREATE TYPE module_type AS OBJECT
    Module_number VARCHAR2(6),
    Module_name VARCHAR2(50),
    Credit NUMBER(2,0),
    Taught_in VARCHAR2(50)
    CREATE TYPE students_tab AS TABLE OF REF person_type;
    CREATE TYPE modules_tab AS TABLE OF REF module_type;
    CREATE TYPE course_type AS OBJECT
    Course_number NUMBER (2,0),
    Course_name VARCHAR2(50),
    Dept_name VARCHAR2(50),
    Taken_by Students_tab,
    Contains Modules_tab
    CREATE TABLE modules OF module_type(
    constraint pk_modules primary key (Module_number)
    CREATE TABLE courses OF course_type(
    constraint pk_courses primary key (Course_number)
    NESTED TABLE Taken_by STORE AS students_nt,
    NESTED TABLE Contains STORE AS modules_nt;

    By the way I am using oracle 9i and trying to insert into the nested table data from a subtype (i.e student is a subtype of person)

  • Extracting the result of a query into a internal table

    Hi,
    Does anyone knows or have an idea how to extract the result of a query into a internal table, is there a function module or BAPI?
    Thanks in advance,
    CK

    So then normally I would use a statment like:
    IFunctionTemplate ftemplate = repository.getFunctionTemplate("<b>BAPI_SALESORDER_GETLIST</b>");
    to call a particluar function, but I tried using
    IFunctionTemplate ftemplate = repository.getFunctionTemplate("<b>BAPI_MDDATAPROVIDERBW_GETCATALOGS</b>");
    and it did not seem to work. I also tried -
    IFunctionTemplate ftemplate = repository.getFunctionTemplate("<b>MDDataProviderBW.GetCatalogs</b>");
    How do I format the function?
    Thanks
    Paul

  • Inserting results from select query into another table

    Hi: Is there a way to insert results returned from a SQL query into another table within the same SQL statement.
    For example
    SELECT a.SRCID,
    SUM(DECODE(a.CLASS_ID,91147,1,0)) BLOCK,
    SUM(DECODE(a.CLASS_ID,91126,1,0)) ALLOW,
    FROM EVENT_DATA a
    where
    a.class_id in (91147,91126)
    GROUP BY SRCID
    order by TOTAL DESC;The columns returned SRCID, BLOCK and ALLOW need to go into another table called AGGREGATE_COUNT. This table has fields SRCID, BLOCK and ALLOW. Or is the only way this can be done from outside of SQL like using perl or C.
    Thanks
    Ray

    INSERT INTO aggregate_count
         ( chart_id
         , srcid
         , block
         , allow
    SELECT 2234  chart_id
         , srcid
         , SUM(DECODE(class_id, 91147, 1, 0))
         , SUM(DECODE(class_id, 91126, 1, 0))
      FROM event_data
    WHERE class_id IN (91147, 91126)
    GROUP BY chart_id, srcid
    ORDER BY total DESC;

Maybe you are looking for

  • Not able to view certificate in QC55

    Hi All, I am trying to do a GR from an inbound delivery. The storage location is HU managed. After doing the GR i go to QC55 to view the certificate i dont see it. The certificate is put "YES" in inbound delivery. Material master is maintained with c

  • MacBook + HP LaserJet 1100 + AirPort

    I would like to print wirelessly using my HP LaserJet 1100 with my new MacBook, but it looks like it will be more difficult than I thought. Problem #1: My HP does not officially work with my macbook. Is GutenPrint or HPIJS the better solution for a d

  • Snow Leopard won't install because drive is not Mac OS Extended (Journaled)

    I cannot install Snow Leopard (from regular Leopard) on my other 21" Intel iMac (not this one) because the hard drive is apparently only Mac OS Extended and NOT Mac OS Extended "(Journaled)". Is there a fix for this? Everything else on the computer i

  • SAP B1  Radio Beacon vms 54.11

    Saludos. Alguno a utilizado SAP B1 con Radio Beacon(Warehouse), ya que tengo un problema de sincronizacion en el campo de onHand por un lado SAP me da una cantidad y Radio Beacon me da otra diferente. llegé a pensar que SAP calcula la existencia basa

  • Different background for first 2 pages of the report

    Hi Guys, I need to create new Invoice Report and I am not able to create a rtf template or a pdf template.The first page and second requires different backgrounds and I dont know how to achieve this in rtf and pdf formats. Can someone please help me