How imrove the peformance of VBFA table in select statements.

Hi,
whenever execute program in production, program execution will taking long time due to below select statement.
Please help me how we imrove performance?
SELECT vbelv vbeln posnn vbtyp_v
FROM vbfa
INTO TABLE l_i_vbfa
FOR ALL ENTRIES IN l_i_bill_cs
WHERE vbeln EQ l_i_bill_cs-vbeln
AND posnn EQ '000010'
AND vbtyp_n IN ('K', 'H'). "MOD-024--
AND vbtyp_v IN ('K', 'H'). "MOD-024++
SORT l_i_vbfa BY vbeln vbtyp_n.
Regards,
Naidu
Moderator message: third time I have to remind you: for performance problems with VBFA table please search for previous discussions of the same topic
Edited by: Thomas Zloch on Nov 9, 2010 12:41 PM

Hi Naidu,
ranges: r_vbtypv type vbfa-r_vbtyp_v.
  CLEAR r_vbtypv.
  r_vbtypv-option = 'EQ'.
  r_vbtypv-sign   = 'I'.
  r_vbtypv-low    = 'K'.
  APPEND r_vbtypv.
  CLEAR r_vbtypv.
  r_vbtypvl-option = 'EQ'.
  r_vbtypv-sign   = 'I'.
  r_vbtypv-low    = 'H'.
  APPEND r_vbtypv.
sort l_i_bill_cs by vbenl.
if not l_i_bill_cs[] is initial.
SELECT vbelv vbeln posnn vbtyp_v
FROM vbfa
INTO TABLE l_i_vbfa
FOR ALL ENTRIES IN l_i_bill_cs
WHERE vbeln EQ l_i_bill_cs-vbeln
AND posnn EQ '000010'
AND vbtyp_v IN r_anlkl.
endif.
SORT l_i_vbfa BY vbeln vbtyp_n.
Thanks,
Nelson

Similar Messages

  • Picking the right values from tables - SQL (select statement)

    Hi everyone,
    I'm facing the litlle(?) problem in Oracle environment.
    Let me explain:
    I have two tables.
    TABLE 1
    Id1 | Val1 | Id2 | Val2
    A | 44 | B | 36
    B | 36 | A | 44
    TABLE 2
    Id | Name
    A | New York
    B | Seattle
    I need to get from those tables, using SQL statement, result like this:
    Id1 | Val1 | Name1 | Id2 | Val2 | Name2
    A | 44 | New York | B | 36 | Seattle
    NOTE !! Very important!! If in table 1 we have crossed the same values in fields IdX and ValX in two rows (like in example)- just one of them should be presented as a result.
    I'm afraid it's a bit too complex. You, guys are my last hope.
    Looking forward for any solutions.
    Thanks in advance!

    jeneesh wrote:
    This can give you a startJaneesh, the OP specified that the duplication was across the ID and the VAL columns, but your solution only checks the ID's..
    SQL> ed
    Wrote file afiedt.buf
      1  with t1 as (select 'A' as id1, 44 as val1, 'A' as id2, 36 as val2 from dual union all
      2              select 'A', 36, 'A', 36 from dual)
      3      ,t2 as (select 'A' as id, 'New York' as name from dual union all
      4              select 'B', 'Seattle' from dual)
      5  -- END OF TEST DATA
      6  select distinct greatest(id1,id2) id1,
      7         case when id1 > id2 then val1 else val2 end val1,a.name name1,
      8         least(id1,id2) id2,
      9         case when id1 < id2 then val1 else val2 end val2,b.name name2
    10  from t1 t,t2 a,t2 b
    11  where greatest(id1,id2) = a.id
    12* and least(id1,id2) = b.id
    SQL> /
    I       VAL1 NAME1    I       VAL2 NAME2
    A         36 New York A         36 New York
    SQL>With this data I would have expected both rows to be returned as there is a difference in the val columns..
    SQL> ed
    Wrote file afiedt.buf
      1  with t1 as (select 'A' as id1, 44 as val1, 'A' as id2, 36 as val2 from dual union all
      2              select 'A', 36, 'A', 36 from dual)
      3      ,t2 as (select 'A' as id, 'New York' as name from dual union all
      4              select 'B', 'Seattle' from dual)
      5  -- END OF TEST DATA
      6      ,t3 as (select distinct id1, val1, id2, val2
      7              from
      8                (
      9                 select decode(switch,1,id2,id1) as id1
    10                       ,decode(switch,1,val2,val1) as val1
    11                       ,decode(switch,1,id1,id2) as id2
    12                       ,decode(switch,1,val1,val2) as val2
    13                 from (select id1, val1, id2, val2
    14                             ,case when id1||val1 > id2||val2 then 1 else 0 end as switch
    15                       from t1)
    16                )
    17             )
    18  --
    19  select t3.id1, t3.val1, t2_1.name
    20        ,t3.id2, t3.val2, t2_2.name
    21  from   t3 join t2 t2_1 on (t2_1.id = t3.id1)
    22*           join t2 t2_2 on (t2_2.id = t3.id2)
    SQL> /
    I       VAL1 NAME     I       VAL2 NAME
    A         36 New York A         36 New York
    A         36 New York A         44 New York

  • How to get the sum in BSEG table using select statement

    hai all
    i made the internal tale "itab1" .. i want to get the som  feild of  DMBTR in BSG table my code is here but its not working gave som error massage (Aggregate functions and the addition DISTINCT are not supported in field lists for pooled and cluster tables.)  plz tel me how should i do it..... i want to get the som of that feild....          
    loop at itab1
         SELECT sum( DMBTR  ) from bseg INTO itab1-DMBTR141_45
             where GJAHR = itab1-GJAHR
             and   BELNR = itab1-BELNR.
    endloop.
    regard
    nawa

    SELECT BELNR GJAHR SHKZG DMBTR
                 from bseg
                 INTO table it_bseg
                 for all entries in itab1
                 where GJAHR = itab1-GJAHR
                   and BELNR = itab1-BELNR.
    loop at it_bseg.
        IF it_bseg-shkzg = 'H'.
          it_bseg-dmbtr = it_bseg-dmbtr * ( -1 ).
        ELSE.
          it_bseg-dmbtr = it_bseg-dmbtr.
        ENDIF.
        MODIFY it_bseg.
    endloop.
    loop at it_bseg.
    READ TABLE itab1 with key belnr = it_bseg-belnr
                               gjahr = it_bseg-gjahr.
    if sy-subrc = 0.
    collect it_bseg into it_bseg_amount.
    endif.
    endloop.
    U can use the collect statement
    Regards
    Gopi

  • How enter the values in to table when create entries option is not working

    hi everyone,
         can u please tell me How enter the values in to table when create entries option is not working.
    it's urgent.
    thanking u all

    Hi Shree,
    how many entries u want to insert ,,
    is it a ztable or custom table ..
    just tell me ur clear requirement ..
    clarify the same ..
    if no options avaliable then if its less entries or some value u can do it through debugging ..
    if its bulk entries then u can write a program ..
    just let me know ..
    regards,
    VIjay

  • How to find the number of fetched lines from select statement

    Hi Experts,
    Can you tell me how to find the number of fetched lines from select statements..
    and one more thing is can you tell me how to check the written select statement or written statement is correct or not????
    Thanks in advance
    santosh

    Hi,
    Look for the system field SY_TABIX. That will contain the number of records which have been put into an internal table through a select statement.
    For ex:
    data: itab type mara occurs 0 with header line.
    Select * from mara into table itab.
    Write: Sy-tabix.
    This will give you the number of entries that has been selected.
    I am not sure what you mean by the second question. If you can let me know what you need then we might have a solution.
    Hope this helps,
    Sudhi
    Message was edited by:
            Sudhindra Chandrashekar

  • Using plsql tables in select statement of report query

    Hi
    Anyone have experience to use plsql table to select statement to create a report. In otherwords, How to run report using flat file (xx.txt) information like 10 records in flat files and use this 10 records to the report and run pdf files.
    thanks in advance
    suresh

    hi,
    u can use the utl_file package to do that using a ref cursor query in the data model and u can have this code to read data from a flat file
    declare
    ur_file utl_file.file_type;
    my_result varchar2(250);
    begin
    ur_file := UTL_FILE.FOPEN ('&directory', '&filename', 'r') ;
    utl_file.get_line(ur_file, my_result);
    dbms_output.put_line(my_result);
    utl_file.fclose(ur_file);
    end;
    make sure u have an entry in ur init.ora saying that your
    utl_file_dir = '\your directory where ur files reside'
    cheers!
    [email protected]

  • FETCHING VALUES IN MULTI RECORD BLOCK FROM ANOTHER TABLE USING SELECT STATEMENT.

    Hi,
    I have one multi record block in which i want to fetch values
    (more then one record) from another table using select statement
    IN KEY NEXT ITEM.I am getting following error.
    ORA-01422: exact fetch returns more than requested number of rows
    Thanks in advance.

    In your case I see no reason to use non-database block and to try to populate it from a trigger with a query, instead of using the default forms functionality where you can associate the block and the fields with table, create where clause using bind variables and simply use execute_query() build-in to populate the block. The power of the forms is to use their build-in functionality to interact with the database.
    Also, you can base your block on a query, not on a table and you dynamically change this query using set_block_property() build-in. You can use any dynamic queries (based on different data sources) and you simply need to control the column's data type, the number of the columns and their aliases. Something like creating inline views as a block data source.
    However, you can replace the explicit cursor with implicit one like
    go_block('non_db_block_name');
    first_record();
    FOR v_tab IN (SELECT *
    FROM tab
    WHERE col_name = :variable)
    LOOP
    :non_db_block_name.field1 := v_tab.col1;
    :non_db_block_name.field2 := v_tab.col2;
    next_record();
    END LOOP;

  • How are execution plan created with tables of stale stats

    Hello
    I would like to ask the group
    1. How oracle handels the execution plan with table joins where some tables have stale stats
    2. How would oracle handel execution plan where the table has histogram but the stats are stale.
    Database version 11.1.0.7.0
    Thanks
    Arun

    ALTER SESSION SET EVENTS='10053 trace name context forever, level 1';
    by doing above before executing the SQL, you can see what & how CBO arrives at the actual execution plan

  • How can i retrieve the output of procedure using a select statement ?

    Hi every one.
    this mite be dumm ?
    how can i use the output of the a procedure containing multiple rows of data in a select statement ?

    This is not  a SQL Developer question. You should ask it in the SQL and PL/SQL forum.
    The short answer is you can't.  Sounds is if you are trying to use MSSQL techniques in oracle. Learn oracle techniques

  • 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

  • Dynamic table in select statement

    Hi All,
    I have a requirement where i have a select option in which the input is table name , i need to use this input in my select statement and fetch entries in the table where bname is eq to ' ' or uname eq ' '.
    the challenge that i am facing is not all the tables have both the fields (uname and Bname).
    Request your help on how to code the above requirements.
    Thanks,
    Bhanu.

    Bhanu,
    I don't know what exactly is your requirement but I don't see any reason why a business user enters a table name as input in the selection screen.
    MANDT NAME                           TYPE NUMB SIGN OPTI   LOW    HIGH
    223   ZPROGNAME                       P    0001     I        EQ    XXX      ZTABLENAME
    You can maintain an entry like the above in TVARVC table and get the table name using a select query on TVARVC and then use the table as below
    SELECT SINGLE * FROM (l_tabname)
               into g_wa_tab2
               WHERE quosrc   EQ g_wa_tab1-quosrc  AND
                     quotyp   EQ g_wa_tab1-quotyp  AND
                     quotno   EQ g_wa_tab1-quotno  AND
                     quotdate EQ g_wa_tab1-quotdate.
    Funda is using TAVRVC to maintain the table names and determine the table based on a condition and the using the table in the select query.
    Thanks,
    K.Kiran.

  • How can I create "Sub Queries" in a select statement?

    Hi all,
    I need to create reports, which are not based on a single table but on several "sub-queries".
    This would be the code, but I don't know how to solve that problem...
    SELECT OGBI.*
    FROM
    (((select "OSSRALL"."FORECAST_OWNER", sum
    ("OSSRALL"."TOTAL_OPPORTUNITY_AMOUNT")
    from "#OWNER#"."OSSRALL" "OSSRALL",
    "#OWNER#"."TEAM_MAIN" "TEAM_MAIN",
    "#OWNER#"."MA_MAIN" "MA_MAIN"
    group by "OSSRALL"."FORECAST_OWNER")OGBI.APPSME1)
    where "OSSRALL"."OPP_CLASS" = (EX_OTHERS)),
    -- more are following
    "#OWNER#"."OSSRALL" "OSSRALL",
    "#OWNER#"."TEAM_MAIN" "TEAM_MAIN",
    "#OWNER#"."MA_MAIN" "MA_MAIN"
    WHERE
    ("MA_MAIN"."MA_NAME"||', '||"MA_MAIN"."MA_FIRST_NAME"||' Mr'
    like "OSSRALL"."FORECAST_OWNER" or
    "MA_MAIN"."MA_NAME"||', '||"MA_MAIN"."MA_FIRST_NAME"||' Mrs'
    like "OSSRALL"."FORECAST_OWNER" or
    "MA_MAIN"."MA_NAME"||', '||"MA_MAIN"."MA_FIRST_NAME"
    like "OSSRALL"."FORECAST_OWNER") and
    ("OSSRALL"."SALES_GROUP"="TEAM_MAIN"."NAME") and
    ("MA_MAIN"."MA_ID"=:P17_VB1)
    thx a lot for your help.
    kind regards Jan
    Message was edited by:
    Jan Rabe

    Jan
    Please can you post the full select statement and the DDL to create the tables? Or, provide someone access to the app on the Oracle server.
    We can probably make these much more readable using table aliases and removing the owner unless you are doing this across schemas or via a wizard?
    It looks like you are missing joins in your query - is this what you mean by subqueries? It is a good idea to move the join up before the WHERE clause if you can as this makes the query easier to manage.
    Phil

  • How to re-arrange columns when outputting a SELECT statement?

    Assume a table holds a lot of columns: A, B, C, D, E,......., Z
    When outputting the result auf a SELECT statement the columns should be re-arranged as follows:
    The first column should be E, then the second column should be C and then all remaining columns should
    follows in a order as if there would be no re-ordering. How can I do this in SQL WITHOUT having to list all
    columns individually like in:
    SELECT E,C, A, B,D,F,.....,Z FROM .....
    Furthermore the first and second column should not re-appear again (twice) as in a statement like
    SELECT E, C, * FROM .....;
    How can I achieve this?
    Peter

    Hi,
    Welcom to the forum!
    Posting your own question in someone else's thread is called "hijacking".
    More people will read (and answer) your question if you start your own thread.
    You can include a link to this thread, if you think that will help people. See the "Plain Text Help" on the right side of the "Edit Message" screen to learn how.
    If you have more output than will fit on one line, then you can
    (1) Increase the size of the line, or
    (2) Decrease the size of the output
    or both.
    Display issues like this always depend on your front-end.
    For example, in SQL*Plus you can use SET LINESIZE to make lines bigger, and COLUMN to reduce wasted space within the lines.
    When you start your own thread, be sure to mention your front-end tool and version.

  • Doing a Trace on the ARXADLMT Approval Limits form No Select statement i

    Hi I want to see the all the SQL statements executed when I open the AR Approval Limits form(ARXADLMT). So I enabled the TRACE from the Menu(supplying password) , then opened then form and did a Query-> Execute. (The base table for the block is AR_APPROVAL_USER_LIMITS.Then I turned off the trace exited applications and went to the USER_DUMP_DEST directory of the database. From here tkprofed the latest trace file .When I look at the output file I cant see any Select statements at all. At least I should be seeing a select on the base table AR_APPROVAL_USER_LIMITS. Maybe I havent understood this process well enough- what am I doing wrong.Why is the trace not containing the select statement?
    Edited by: [email protected] on 13/06/2010 03:18

    >
    ... From here tkprofed the latest trace file ...
    >
    Pl post details of your OS and EBS versions. The latest trace file may not be the correct one. Pl search the trace files for "AR_APPROVAL_USER_LIMITS" to find the right trace file.
    How To Trace From Form, Report, Program And Others In Oracle Applications (Doc ID 130182.1)
    https://supporthtml.oracle.com/ep/faces/secure/km/DocumentDisplay.jspx?id=130182.1&h=Y
    HTH
    Srini

  • How to use column name as variable in select statement

    hi,
    i want to make a sql query where in select statement using variable as a column name. but its not working plz guide me how can i do this.
    select :m1 from table1;
    regards

    Hi,
    Is this what you want..
    SQL> select &m1 from dept;
    Enter value for m1: deptno
    old   1: select &m1 from dept
    new   1: select deptno from dept
        DEPTNO
            10
            20
            30
            40
    SQL> select &m1 from dept;
    Enter value for m1: dname
    old   1: select &m1 from dept
    new   1: select dname from dept
    DNAME
    ACCOUNTING
    RESEARCH
    SALES
    OPERATIONS
    SQL> select &&m1 from dept;
    Enter value for m1: loc
    old   1: select &&m1 from dept
    new   1: select loc from dept
    LOC
    NEW YORK
    DALLAS
    CHICAGO
    BOSTON
    SQL> select &&m1 from dept;
    old   1: select &&m1 from dept
    new   1: select loc from dept
    LOC
    NEW YORK
    DALLAS
    CHICAGO
    BOSTONIf you use single '&' then each time you fire the query, It will ask for the new value..
    But if you will use double '&&' the value of m1 will be persistent across the session..
    Twinkle

Maybe you are looking for

  • Adobe reader cannot extract embedded font after pdf sent via outlook

    We have some pdf files that open fine in Adobe Reader 9.1.3.  Once we send them via e-mail (we use Outlook 2003), they will not open properly with the error message: "Cannot extract the embedded font 'TWDWSP+TradeGothic-Light.  Some characters may no

  • Can i share the screen of ibook running 9.2 classic?

    I need to run Photoshop on System 9 iBook and would like to share the screen from my iMac running Mtn Lion. Is that possible?

  • Advise for iPad car installation please

    I just purchased a Nissan Cube. I declined the audio system so there is a blank plate where the stereo would normally fit. I want to install and use my G3 iPad in the car to listen to music, etc. I don't want the standard audio systems with radio, cd

  • UPGRADE THE PLM SYSTEM FROM NWBC 731 TO NWBC 740

         Hello,      We want to Upgrade our PLM system from NWBC 731 to NWBC 740, for this it is better to have a SANBOX system to upgrade there first the NWBC740 and do some tests. And if everything is in order to Upgrade in the same time the DEV and TE

  • My mail trash bin disappeared

    So... My mail application has an Inbox folder, a Sent folder and I used to have a trash icon there too, and it disappeared. My email service is comcast.net and now when I delete any message it's just gone no questions asked. The question is two-fold: