The mara table in join statement takes 6 min...

hi all, i want to reduce the runtime for this statement...
it is taking nearly 6 min in the mara table itself...
plz help...
SELECT mara~matnr mara~mfrpn mara~prdha mchb~werks mchb~charg
           mchb~lgort mchb~ersda mchb~clabs mchb~ceinm mchb~cspem
           mchb~cretm
           APPENDING CORRESPONDING FIELDS OF TABLE i_initstk FROM
          ( mara AS mara INNER JOIN mchb AS mchb
                  ON mara~matnr = mchb~matnr )
             WHERE   mara~prdha IN prodhier  AND
                     mara~matnr IN partnbr   AND
                     mchb~werks IN werks   AND
                   ( mchb~clabs GT 0 OR
                     mchb~cspem GT 0 OR
                     mchb~ceinm GT 0 OR
                     mchb~cretm GT 0 ) AND
                     mchb~lgort IN stloc AND
                     mchb~ersda < chkdate.
thanks a lot.

Hi,
>
sakthi sri wrote:
> it is taking nearly 6 min in the mara table itself...
> thanks a lot.
how did you confirm that the time is spent on MARA and not on MCHB?
in order to help you we need more information:
mara~matnr IN partnbr   AND
what is the content of partnbr?
With default indexes the matnr field from MARA is the only indexed field in your
where conditin that could be reached without gaps and equal conditions.
So the question is what is the content of this field?
The other ones are interesting as well, what is the content of these?
mchb~werks IN werks   AND
mchb~lgort IN stloc AND
Kind regards,
Hermann

Similar Messages

  • Problem in creaing the logical tables by SELECT statement

    Hi,
    I have created logical tables in the physical layer of the OBIEE tool by "select statement". Connection Pool is set up properly for the repository. Rows of the tables are updating properly by clicking to the "Update Row Count" but when I am clicking to the "View Data" it shows the following error
    [nQSError:17001] Oracle Error code:936, message: ORA-00936:missing expression at OCI call OCIStmtExecute.
    [nQSError:17010]SQL statement preparation failed.
    Also for some tables data is coming properly by clicking to the "View Data" .
    I'm stack in this point and cannot move forward. Please, help me guys.
    Thanks
    Sandeep

    Hi
    I also face same type of error. Just do one thing Change the call interface OCI 10g to ODBC 3.5 and on Feature tab click revert to default.
    I think that will work properly.
    Best of Luck
    Thanks
    SIddhartha P

  • How to Compare the Version of the mara table in Quality & Production

    Hi...
         I'm in need of comparing the Version of Mara Table in Quality & Production.. I like to Know the Difference between them..
    Can anyone help me with a Solutions.
    With Regards,
    AAHBHA.

    Moderator message - Cross post locked

  • Please tell me the  Three table INNER JOIN Sql statement

    Hi experts,
      I got requirement like by using INNER JOIN i have to write the code in MY program i.e using 3 tables VBAK VBAP and VBUK.And the common field is VBELN .SO please give the  INNER JOIN SQL statement for above three tables...
    vbak-vbeln,erdat
    vbap-vbeln,posnr
    vbuk-vbeln,RFSTK
    Thanks in Advance

    hi guglani  please see my total code b.caus DATA is not extracting...once see the code  correct error.
    DATA:V_VBELN TYPE VBAK-VBELN.      "VBAK,VBAP AND VBUK
    SELECT-OPTIONS SORDER FOR V_VBELN.
    TYPES:BEGIN OF T_VBAK,
         VBELN TYPE VBELN_VA,
         ERDAT TYPE ERDAT,
      END OF T_VBAK.
    TYPES:BEGIN OF T_VBAP,
           VBELN TYPE VBELN_VA,
            POSNR TYPE POSNR_VA,
      END OF T_VBAP.
    TYPES:BEGIN OF T_VBUK,
        VBELN TYPE VBELN,
      RFSTK TYPE RFSTK,
      END OF T_VBUK.
    TYPES:BEGIN OF FS,
       VBELN TYPE VBELN_VA,
         ERDAT TYPE ERDAT,
    POSNR TYPE POSNR_VA,
      RFSTK TYPE RFSTK,
      END OF FS.
    DATA:WA1 TYPE T_VBAK,
         WA2 TYPE T_VBAP,
         WA3 TYPE T_VBUK,
         WA TYPE FS.
    DATA:ITAB1 TYPE TABLE OF T_VBAK,
          ITAB2 TYPE TABLE OF T_VBAP,
          ITAB3 TYPE TABLE OF T_VBUK,
          ITAB TYPE TABLE OF FS.
    select a~vbeln a~erdat b~posnr c~rfstk
           from vbak as a inner join vbAP as b on a~vbeln = b~vbeln
                          inner join vbuk as c on a~vbeln = c~vbeln
    into table itab
    where A~vbeln eq SORDER.
    IF NOT ITAB IS INITIAL.
      SORT ITAB BY VBELN.
    ENDIF.
    LOOP AT ITAB INTO WA.
       WRITE:/ WA-VBELN,WA-ERDAT,WA-rfstk.
       ENDLOOP.
       CLEAR WA.
       REFRESH ITAB.

  • Select from multiple tables without join statement

    Hey Gurus,
    I would like to make a select from a multiple tables to check if there is any reference to my data. I would like to do it with some elegancy, but I don't know how.
    Is in abap sql possible to do it only with the select statement?
    Or I was also think about a solution that I should fill some data structure with all of the tables which I want to select from and then just loop that data structure and do the select seperately from all of the tables. I just need to check if it founds some results, so no need to store it. If this solution would be fine what data structure should I use?
    Or can tell me what would be the best for this?
    My code for select from one table, which I want to make for multiple tables:
    SELECT SINGLE id_kniznice FROM zbr_t_autori INTO wa_id
           WHERE id_kniznice EQ ls_extract-zview-id_kniznice.
         IF sy-dbcnt > 0.
           MESSAGE i000(zbr_msgc_lib).
           ls_extract-flags-vim_mark = '*'.
           MODIFY extract FROM ls_extract.
    ENDIF.   
    Thank you for any posts.
    Regards,
    Robert

    And there we go again...
    Read this topic:
    For All Entries is NOT better than INNER JOIN in most cases
    And this one:
    inner join vs for all entries
    Also that one:
    Re: LOOP AT vs INNER JOIN
    JOINs are really better than for all entries in most cases. Problem is people tend to ignore basic things like using pks or indexes while making them.

  • Can we add(sum) the rows while quering the whole table in one statement.

    Hi,
    I have a table "create table test1(id number(5), name varchar2(10), salary number(10,2))" with the data
    ID     NAME     SALARY
    1     AAAAAA     55000
    2     BBBBB     15430
    3     CCCCC     15430
    4     DDDDD     25430
    5     EEEE     29830
    6     FFFFF     7645
    7     GGGGG     6546
    8     HHHHH     9645
    9     IIIIII     7584
    I need a select query which gives the result like this ie.., the 10th row should be the sum of all the 9 rows...
    ID     NAME     SALARY
    1     AAAAAA     55000
    2     BBBBB     15430
    3     CCCCC     15430
    4     DDDDD     25430
    5     EEEE     29830
    6     FFFFF     7645
    7     GGGGG     6546
    8     HHHHH     9645
    9     IIIIII     7584
    10 Total 172540

    Or;
    create table t as (
      select 1 id, 'AAAAAA' name, 55000 salary from dual union all
      select 2, 'BBBBB', 15430 from dual union all
      select 3, 'CCCCC', 15430 from dual union all
      select 4, 'DDDDD', 25430 from dual union all
      select 5, 'EEEE', 29830 from dual union all
      select 6, 'FFFFF', 7645 from dual union all
      select 7, 'GGGGG', 6546 from dual union all
      select 8, 'HHHHH', 9645 from dual union all
      select 9, 'IIIIII', 7584 from dual);
    Table createdQuery;
    with sub_tot as (
      select max(id) + 1 max_id,
        'Total' name,
        sum(salary) sum_sal
      from t)
    select id, name, salary from t
    union all
    select max_id, name, sum_sal from sub_tot
    order by id;
            ID NAME       SALARY
             1 AAAAAA      55000
             2 BBBBB       15430
             3 CCCCC       15430
             4 DDDDD       25430
             5 EEEE        29830
             6 FFFFF        7645
             7 GGGGG        6546
             8 HHHHH        9645
             9 IIIIII       7584
            10 Total      172540
    10 rows selected

  • Need to update column in table from joining the two tables

    Hi
    i want to update a table by joining two table but i m getting the below error
    single row subquery returns more than one value.
    i m using following query
    update table2
    set deposite_date=(select a.deposit_date from table1 a,table2 b
    where a.ban=b.ban and (a.deposit_date between b.cy_start_date and b.due_date))
    table2
    ban due_date cy_start_date deposite_date
    100 5/6/2011 22/05/2011
    101 7/11/2011 22/05/2011
    102 5/25/2011 22/05/2011
    table1
    ban      deposit_date
    100      04/12/2011
    100      04/15/2011
    102      03/25/2011
    101      04/26/2011
    101      05/06/2011
    101      07/26/2011
    can i insert latest deposit_date from table1 which lies between b.cy_start_date and b.due_date
    Thanks

    Hi,
    Welcome to the forum!
    876466 wrote:
    Hi
    i want to update a table by joining two table but i m getting the below error
    single row subquery returns more than one value.Exactly!
    (   SELECT  a.deposit_date
        FROM    ...returns all deposit_dates.
    (   SELECT  MAX (a.deposit_date)
        FROM    ...would return only the latest one.
    Also, you need to correlate the sub-query to the main query, so that it only looks for rows with the same ban.
    i m using following query
    update table2
    set deposite_date=(select a.deposit_date from table1 a,table2 b
    where a.ban=b.ban and (a.deposit_date between b.cy_start_date and b.due_date))
    table2
    ban due_date cy_start_date deposite_date
    100 5/6/2011 22/05/2011
    101 7/11/2011 22/05/2011
    102 5/25/2011 22/05/2011
    table1
    ban      deposit_date
    100      04/12/2011
    100      04/15/2011
    102      03/25/2011
    101      04/26/2011
    101      05/06/2011
    101      07/26/2011
    can i insert latest deposit_date from table1 which lies between b.cy_start_date and b.due_datePerhaps you need something like this:
    UPDATE  table2     b
    SET     deposit_date     =
             (    SELECT  MAX (a.deposit_date)
                   FROM      table1           a
               WHERE      a.ban          = b.ban
               AND      a.deposit_date BETWEEN b.cy_start_date
                               AND     b.due_date
    ;Notice that table1 is the only table in the FROM clause of the sub-query, but the sub-query is correlated to table2, so we can reference columns from table2 in the sub-query.
    Whenever you have a problem, post CREATE TABLE and INSERT statements for your sample data.
    Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
    If you're asking about a DML statement, such as UPDATE, the CREATE TABLE and INSERT statements should re-create the tables as they are before the DML, and the results will be the contents of the changed table(s) when everything is finished.
    Always say which version of Oracle you're using.
    Edited by: Frank Kulash on Aug 1, 2011 1:58 PM

  • Where is the EZUG [ZZMLEEZUG] field in MARA table in SPRO?

    Hello Experts.
    I want to update the MARA table in the field EZUG [ZZMLEEZUG].
    Could you please help me where is this field in SPRO.
    Thanks
    Raghu

    Hello Raghu,
    It seems this field is a custom field. It is not in the SAP standard system. If you need to update this field in the database you will need to create a custom report. You will not be able to update this field from SPRO.
    Best regards,
    Ian

  • The contingency table vi states that it is a 1-sided test.

    In LabVIEW 8.6, the contingency table vi manual states that it is a 1-sided test. Output suggests that it is a 2-sided Chi-square without Yates' correction.  Can someone clarify this?
    Thanks, Bill

    Hi Jared:
    When I check it against the online GraphPad stat calculator, it only matches with the 2-sided Chi-square without Yates' correction. 
    http://www.graphpad.com/quickcalcs/contingency1.cfm
    Try, for instance, the attached vi and compare.
    Thanks, Bill 

  • Query tuning - update with join statement

    Hi,
    I have 2 tables (table1 and table 2) with following condition:
    TABLE 1 - Need to selection a column say staus ! = 'C'
    join emp_id and project_id of TABLE1 and TABLE2
    From join I am selecting minimun and maximum of TABLE2.salary and updating TABLE3 respective column.
    Now as per requirement I have to update required column on TABLE2.EMP_ID = TABLE3.EMP_ID
    Following is the query I have written,
    update TABLE3 T3
    set (T3.MIN_salary, T3.MAX_salary) = (
    select min(c.salary), max(c.salary)
    from TABLE2 t2, TABLE1 t1
    where t2.emp_id = t1.emp_id
    and t2.project_id = t1.project_id
    and t1.status != 'C'
    and t2.emp_id = t3.emp_id)
    The above query takes 7 min to update some 8 lakhs records. Can you please suggest some other optimized method to do so?
    Thanks in advance
    Sandeep

    Hi SBH
    Required info for "Please provide oracle version, indexes on the 3 tables and also stats info for the table from user_tables"
    1) Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit
    2) Index is not there on TABLE3 (It is temporary table)
    Composite index on TABLE 1 - column1, column2 - Index name say table1index1
    Composite index on TABLE 2 - column1, column2 - Index name say table2index1
    TABLE_NAME     NUM_ROWS     BLOCKS     DEGREE     INSTANCES     SAMPLE_SIZE     PARTITIONED
    FXO_CFW     11767341     144930     1     1     11767341     NO
    FXO_RSL_STBL               1     1          NO
    FXO_TRN     4917778     230196     1     1     4917778     NO
    execution plan is:
    Execution Plan
    Plan hash value: 3131833900
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | UPDATE STATEMENT | | 789K| 23M| 2397 (3)| 00:00:29 |
    | 1 | UPDATE | TABLE3 | | | |
    | 2 | TABLE ACCESS FULL | TABLE3 | 789K| 23M| 2397 (3)| 00:00:29 |
    | 3 | SORT AGGREGATE | | 1 | 28 | | |
    | 4 | TABLE ACCESS BY INDEX ROWID | TABLE2 | 1 | 17 | 3 (0)| 00:00:01 |
    | 5 | NESTED LOOPS | | 1 | 28 | 12 (0)| 00:00:01 |
    |* 6 | TABLE ACCESS BY INDEX ROWID| TABLE1 | 1 | 11 | 9 (0)| 00:00:01 |
    |* 7 | INDEX RANGE SCAN | IDX_TABLE1INDEX1 | 6 | | 3 (0)| 00:00:01 |
    |* 8 | INDEX RANGE SCAN | IDX_TABLE2INDEX1 | 1 | | 2 (0)| 00:00:01 |
    Thanks for quick response,
    Sandeep

  • MARA table going DUMP due to append structure

    Hi all,
    I have created the structure and i have Appended  to MARA table. Since then MARA Table is Partially  Active State. So, i tried to delete the structure. But i am unable to delete that Structure, because it was used in MARA Table. Even i tried SE14 Transaction also.Here i did Adjust and Activate table, But it is showing SHORT DUMP. Even if check the Error in SE11, it is showing "No inconvience found, but i activate the table again it is going to dump ".
    How to solve this .
    My requirement is to bring back the MARA table into its origional state. and how to delete the Appended structure in MARA table ?
    Thanks in advance
    KR

    Hi,
       An APPEND structure is a DDIC structure that is assigned to a single DB table. In the ABAP dictionary (SE11) you call the corresponding DB table and create the APPEND structure for this table.
    In which scenario do we create APPEND structures? Obviously, the attributes available in the DB table are not sufficient to meet your requirements. Thus, you append the missing fields to the table.
    http://help.sap.com/saphelp_erp2005/helpdata/en/cf/21eb61446011d189700000e8322d00/frameset.htm
    Regards

  • Two Filter on Two dimensions without constraining the fact table

    Hi All,
    does anybody know how to avoid the fact constraint when creating a report with two filters on different dimensions?
    I have a big fact table with more than 10 Million rows. In the starmodel the is the dimension customer and products. I create a filter on the customer atrribute "Status" and choose the value "Active". Now I add the column "Product Type" from the dimension "Product" to the filter section. When I want to choose a value OBIEE executes a select statement within the fact table. So I have to wait very long to select a value. Is there any way to say OBIEE only to select the dimension table without joining the fact table?
    Thank you very much in Advance.
    Regards,
    Stefan

    Hi Stefan,
    Generally queries on the dimensions (across dimesions also) always go through a fact. In case, you would like the queries not be through fact table, but just the dimension tables right away, you can set up a separate subject area for them.
    You can create a separate subject area based on a dummy fact table to get these prompt values.
    Please refer to http://gerardnico.com/wiki/dat/obiee/presentation_service/obiee_parameter_prompt_subject_area for more details on this setup.
    Hope this helps.
    Thank you,
    Dhar

  • What is the use of at new statement?

    What is the use of at new statement?

    Hi,
    AT - itab
    Syntax
    LOOP AT itab result ...
      [AT FIRST.
       ENDAT.]
        [AT NEW comp1.
         ENDAT.
           [AT NEW comp2.
           ENDAT.
           AT END OF comp2.
           ENDAT.]
         AT END OF comp1.
         ENDAT.]
      [AT LAST.
      ENDAT.]
    ENDLOOP.
    Extras:
    1. ...  FIRST
    2. ... |{END OF} compi
    3. ...  LAST
    Effect
    The statement block of a LOOP loop can contain control structures for control level processing. The respective control statement is AT. The statements AT and ENDAT define statement blocks that are executed at control breaks, that is, when the control structure is changed. The additions to the AT statements determine the control break at which their statement blocks are executed. Within these statement blocks, the statement SUM can be specified to add together the numeric components of a control level. For the output behavior result, the same applies as for LOOP AT.
    The prerequisite for control level processing is that the internal table is sorted in exactly the same sequence as the component of its line type - that is, first in accordance with the first component, then in accordance with the second component, and so on. The line structure and the corresponding sorting sequence gives a group structure of the content of the internal table, whose levels can be evaluated using AT statements. The AT- ENDAT control structures must be aligned one after the other, in accordance with the group structure.
    The statement blocks within the AT- ENDAT control structures are listed if an appropriate control break is made in the current table line. Statements in the LOOP- ENDLOOP control structure that are not executed within an AT- ENDAT control structure are executed in each pass of the loop.
    In order that control level processing is carried out properly, the following rules must be observed:
    After LOOP, a restricting condition cond can only be specified if this selects a consecutive line block of the internal table. Otherwise, the behavior of control level processing is undefined.
    The internal table cannot be modified within the LOOP loop.
    A work area wa specified in the LOOP statement after the addition INTO must be compatible with the line type of the table.
    The content of a work area wa specified after the addition INTO in the LOOP statement must not be modified.
    If the INTO addition is used in the LOOP statement to assign the content of the current line to a work area wa, its content is changed upon entry into the AT-ENDAT control structure as follows:
    The components of the current control key remain unchanged.
    All components with a character-type, flat data type to the right of the current control key are set to character "*" in every position.
    All the other components to the right of the current control key are set to their initial value.
    When the AT-ENDAT control structure is exited, the content of the current table line is assigned to the entire work area wa.
    Addition 1
    ... FIRST
    Effect
    The control level is defined by the first line of the internal table. The control break takes place when this line is read.
    Note
    In the group level AT FIRST, the current group key contains no components and all character-type components of the work area wa are filled with "*" and all remaining components are set to their initial value.
    Addition 2
    ... |{END OF} compi/>
    Effect
    : Control levels are defined by the beginning or end of a group of lines with the same content in the component compi (where i = 1, 2, and so on) and in the components to the left of compi. The control breaks take place when the content of the component compi or another component to the left of compi changes.
    The compi components can be specified as described in Specification of Components, with the limitation that access to object attributes is not possible here.
    Note
    If the INTO or ASSIGNING additions are used in the LOOP statement, a field symbol can be entered after AT |{END OF} outside classes, to which the corresponding component of the work area wa or the field symbol <fs> is assigned. This form of dynamic component specification is obsolete and has been replaced by specification in the format (name).
    Addition 3
    ... LAST
    Effect
    : The control level is defined by the last line of the internal table. The control break takes place when this line is read.
    Note
    In the group level AT LAST, the current group key contains no components and all character-type components of the work area wa are filled with "*" and all remaining components are set to their initial value.
    Regards,
    Prashant

  • Parition issue when selecting from the main table

    I have a partitioned table where i jsut did a partition
    exchange with another temp table.
    when I query the partition it looks good, i.e. the data is there, but when I query the data directly
    on the table no rows are returned.
    for example
    select count(*)
    from sales partition (2007)
    12455
    select count(*)
    from sales
    where year = 2007
    0 rows
    I've reviewed the parition 2007 and esnured the 'where year = ' clause is accurate via previous years.
    why am i not seeing this data in the second query?
    db = 10G R2
    thanks

    create table SALES
    nologging
    parallel
    partition by range (year,fscl_period,channel)
    PARTITION p_200701_5 values less than (2008,200702,6) TABLESPACE SALES_2007_DATA,
    PARTITION p_200701_6 values less than (2008,200702,7) TABLESPACE SALES_2007_DATA,
    PARTITION p_200701_7 values less than (2008,200702,8) TABLESPACE SALES_2007_DATA,
    PARTITION p_200701_8 values less than (2008,200702,9) TABLESPACE SALES_2007_DATA,
    PARTITION p_200701_9 values less than (2008,200702,10) TABLESPACE SALES_2007_DATA,
    PARTITION p_200701_10 values less than (2008,200702,11) TABLESPACE SALES_2007_DATA,
    PARTITION p_200701_11 values less than (2008,200702,12) TABLESPACE SALES_2007_DATA,
    PARTITION p_200701_12 values less than (2008,200702,13) TABLESPACE SALES_2007_DATA,
    PARTITION p_200701_13 values less than (2008,200702,14) TABLESPACE SALES_2007_DATA,
    PARTITION p_200702_5 values less than (2008,200703,6) TABLESPACE SALES_2007_DATA,
    as select * from table...
    note: year,fscl_period,channel are all NUMBER datatype.
    Fiscal period is month bascially
    I am wondering if doing this all this in a range partition, and not a range/list which channel may be better qualified for data wise, is the issue. Or perhaps range by year, sub by month, then list by channel. What will the impact be either way?
    Interestingly, the data will come back on a star query i.e. when the SALES table is joined to the calendar_dim (via a day_id field) and use the 2007 predicate from the calendar_dim rather than the one on SALES (the one used for the part. definition).
    Also, i did the partition exchange originally with the novalidation option. We tried again without that and the exchange failed saying some data doesn't qualify. But reviewing the data it appears it all should.
    We then just did a giant insert statement and it all went through, but i have not had teh chance to validate what partitions the data live in now.
    thanks for any help.
    jeff
    Message was edited by:
    jeffs

  • How to create the custom table?

    Hi, how to create the custom table and how to integrate the table with defferent R/3?
    my requiremnt is i have to create the two tables and those i have to integrate with the existed R/3 and using those R/3 i have to update my custom tables .....can give me some idea?
    Tks
    DPk

    how to create the custom table
    There are two approach in creating a table.
    1. Bottom-up approach
    2. Top-down approach.
    Both are valid and you can choose which approach is suitable for you. I always use the bottom-up approach. Here are the steps to create the tables with this approach.
    1. SE11 will take you to the DDIC and enter the name of the new table to be created. Let us say Zname. Click create.
    2. Enter the short discription of the table and enter the field of the table. If it is primary key and you have to check the box.
    3. Enter the data element and double click it, you will be asked to save and will take you to data element discription page. Enter the short discription of the data element and enter the information of domain like the length of field and type of field.
    4. If you wanted to use the existing domain then its fine, or else, you have to create one. Enter the domain name in the data element page and double click it. Page will ask to save and jump to domain creation page.
    5. In the domain page, you have to save the information which you have already given in the data elements page and check it. Before going to data element page, you have to activate the domain.
    6. Go to data element page and save, check and activate.
    7. Go to main table page and save, check, and activate.
    8. Also, you have to save the technical settings of the table.
    The table is now ready for operation. You can use it in your program or you can use it to enter information.
    Check table: It is the table which will have all the information about the Foreign keys which are the primary keys in the check table.
    It can be created by creating the foreign key from the main table. Click foreign key in the main table and it will take you to a page which will ask for table name and field to which foreign key relation has to be associated. Enter the information and you can create the check table automatically.
    SM30 is used for maintenance of the table, that is to realease the errors occured during the creation of the table.
    how to integrate the table with defferent R/3
    Transport the Table to the another server/client/qas/prd
    Kanagaraja L

Maybe you are looking for