Selection query problem

hi all.....
i want to setct some data from table vbrp ,vbrk and vbfa .
on selection screen i have vbrk-vbeln and vbfa-erdat i hav written one code for tht but thts not working can nybdy plz help me in this..
parameter : p_vbeln type vbrk-vbeln ,
            p_erdat type vbfa-erdat  .
*--start of selection events
start-of-selection.
*--SELECTING THE DATA FROM DATABASE INTO INTERNAL TABLE
SELECT v1~vbeln AS vbeln
        v1~kunag AS kunag
        v1~vkorg AS vkorg
        v1~netwr AS netwr
        v2~ntgew AS ntgew
        v2~matnr AS matnr
        v3~erdat AS erdat
        INTO CORRESPONDING fields of table it_data1
    FROM vbrk AS v1
    INNER JOIN vbrp AS v2
       ON v1vbeln = v2vbeln
    INNER JOIN vbfa AS v3
       ON v1vbeln = v3vbeln
        WHERE v1~vbeln eq p_vbeln .
   loop at it_data1 into wa_data where erdat ne p_erdat.
   delete it_data1 from wa_data.
endloop.
end-of-selection.
thanks in advance.....

How have you defined your itab ?
You query looks perfectly ok , even if you use vbeln or vbelv it wont matter , it depends on the requirement.
So have you defined your itab correctly ?
for example :
data : begin of itab occurs 0,
         vbeln like vbrk-vbeln,
         kunag like vbrk-kunag,
         netwr like vbrk-netwr,
         ntgew like vbrp-ntgew,
         matnr like vbrp-matnr,
         erdat like vbfa-erdat,
         end of itab.
regards,
Advait

Similar Messages

  • Select query problem in JDBC sender adapter

    Hello Experts,
    We have a problem with PI sender adapter that PI has started to miss records in database some database records are missing and we are using the below selet query :
    SELECT * FROM [database name].[dbo].[Material_Movement] WHERE [Process_Order_Number] = (Select TOP 1 [Process_Order_Number] FROM [database name].[dbo].[Material_Movement] WHERE ([PI_Read_Date] IS NULL AND [Movement_Type] = (SELECT TOP 1 [Movement_Type] FROM [database name].[dbo].[Material_Movement] WHERE [Transaction_Code] = 'xyz' AND [PI_Read_Date] IS NULL ORDER BY Created_Date ASC))) AND [Transaction_Code] = 'xyz' AND [Movement_Type] = (SELECT TOP 1 [Movement_Type] FROM [database name].[dbo].[Material_Movement] WHERE [Transaction_Code] = 'xyz' AND [PI_Read_Date] IS NULL ORDER BY Created_Date ASC) AND [PI_Read_Date] IS NULL ORDER BY [Transaction_ID] ASC
    I am weak in select query could you please check and suggest how the query can be modified to avoid this issue .
    Thanks,
    Somenath

    Hi ,
    After looking into These Query .. I found ...
    Your Query Will run such Kind of scenario ..
    1.)   Movement Type will be fetched from from below Query
            SELECT TOP 1 Movement_Type
            FROM database name.dbo.Material_Movement
            WHERE Transaction_Code = 'xyz'
           AND PI_Read_Date IS NULL
            ORDER BY Created_Date ASC
    2.) on the  basis of abovr fetched  moment code . your Query will fetch 1 Process Order number
    Select TOP 1 Process_Order_Number
    FROM database name.dbo.Material_Movement
    WHERE ( PI_Read_Date IS NULL
                  AND Movement_Type =  Moment Type will be same as 1.
    3.)
    After  Getting 1 and 2 . Query will fetch Data  from table " dbo.Material_Movement "
    On the basis of ..
    Movement_Type = value from 1.
    Process_order_type = value from 2.
    Transaction_Code = 'xyz'
    ORDER BY Transaction_ID ASC
    So check Missed record Fullfill this Condition or not ....................
    If not ... You will get why they are not picked by your given Query ...........
    Hope it helps ..
    regards
    Prabhat Sharma.

  • Select Query Problem

    Hi Experts,
    I am having a select query in which I am using a variable in the where condition but it is giving error. Please suggest how to use variable in the select query.
    The query I am using is a s below.
    select * from zexc_rec into table it_ZEXC_REC
          where
           LIFNR in S_LIFNR and
          DOCNO in S_DOCNO and
          DOCTYP in doc_typ and
          DATE1 in S_DATE1 and
          MATNR in S_MATNR.
    Here doc_typ is a variable.
    Thanks.

    Rahul,
    use RANGES type variable instead of variable . It acts as a select-options variable. Thn use this variable in SELECT query with IN.
    Eg :
    RANGES r_t510 FOR t510-lgart.
        r_t510-low = '1600'. 
        APPEND r_t510.
        r_t510-low = '3190'. 
        APPEND r_t510.
    Note  : can be use SIGN, OPTIONS properties too in RANGES type.
    More deatils go through on HELP of RANGES
    Rgds,
    Ranjith

  • Multiple Schema select Query problem

    Hi everyone,
    when I tried to execute a select query as following,
    select A.field1, B.field2 from S1.table1 A, S2.table2 B
    in a session bean, it gives an exception as follows
    " An illegal attempt to use multiple resources that have only one-phase capability has occurred within a global transaction"
    Can anyone pls help me in this regard.
    Thanking you
    D. Suresh Kumar

    This is the query i thought of executing
    SELECT * FROM SCH2.AP_TRANSACTION_EPS A, TRANSACTION_TYPES B WHERE C_FUND_CODE = '" + fundCode + "'AND D_TRADE_DATE = to_date('" + date + "','yyyy-mm-dd') AND A.C_TRANS_CODE = B.C_TRANS_CODE " + " AND B.C_TRANS_TYPE = '" + transType + "' ";
    where "fundCode", "date","transType" are java variables.
    The error message is
    [8/1/03 12:38:49:688 IST] 491a6a5 TransactionIm E WTRN0062E: An illegal attempt to use multiple resources that have only one-phase capability has occurred within a global transaction.
    [8/1/03 12:38:49:750 IST] 491a6a5 ConnectO A CONM6014I: Received exception (IllegalStateException) in method (enlist). Issuing new exception (IllegalTransactionStateException). The original exception's stack trace was: java.lang.IllegalStateException
    Thanking you

  • Sql select query problem

    hi friends,
    i've a view called "risk_efforts" with fields user_id,user_name,wknd_dt,week_day,prod_efforts,unprod_efforts.
    Name Type
    ROW_ID NUMBER
    USER_ID VARCHAR2(14)
    USER_NAME VARCHAR2(50)
    WKND_DT VARCHAR2(8)
    WEEK_DAY VARCHAR2(250)
    PROD_EFFORTS NUMBER
    UNPROD_EFFORTS NUMBER
    data is like this:
    when there is some data in prod_efforts, unprod_efforts will be null
    when there is some data in unprod_efforts, prod_efforts will be null
    for example:
    USER_ID     USER_NAME     WKND_DT     WEEK_DAY     PROD_EFFORTS     UNPROD_EFFORTS
    G666999     GTest     20100403     TUE     null 3
    G666999     GTest     20100403     TUE     14     null
    now i want to combine these 2 rows into 1 row i.e o/p should be like this
    USER_ID     USER_NAME     WKND_DT     WEEK_DAY     PROD_EFFORTS     UNPROD_EFFORTS
    G666999     GTest     20100403     TUE     14 3
    i've tried all combinations but couldn't get the query. Please help me with the exact SQL select query.
    thanks,
    Girish

    Welcome to the forum.
    First read this:
    Urgency in online postings
    Secondly, it's always helpful to provide the following:
    1. Oracle version (SELECT * FROM V$VERSION)
    2. Sample data in the form of CREATE / INSERT statements.
    3. Expected output
    4. Explanation of expected output (A.K.A. "business logic")
    5. Use \ tags for #2 and #3. See FAQ (Link on top right side) for details.
    You have provided #3 and #4. However with no usable form of sample data forum members will often not respond as quickly as they could if you provided #2.
    I'm just wagering a guess here but what about this:SELECT ROW_ID
    , USER_ID
    , WKND_DT
    , WEEK_DAY
    , MAX(PROD_EFFORTS) AS PROD_EFFORTS
    , MAX(UNPROD_EFFORTS) AS UNPROD_EFFORTS
    FROM RISK_EFFORTS
    GROUP BY ROW_ID
    , USER_ID
    , WKND_DT
    , WEEK_DAY                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • SELECT query - problem with SORT

    Hi,
    Same select query behaves different way on development and quality server
    on Development it returns unsorted and Quality returns sorted
    it can be resolved by SORT but why does it behave differently
    Do you know what is setting in database
    thanks

    From F1 on SELECT:
    Orders the records in a SELECT statement. Without the ORDER-BY clause, the order
    in which the selected lines are supplied is undefined. This means that two similar SELECT
    statements may produce lines in a different order.
    Rob

  • Abap select query problem

    This report will take delivery document number and delivery date from user and fetches details from delivery table and fetches
    corresponding sales order details and billing details  and displays sales order details with ALV list.
    << Please only post the relevant portions of your code >>
    i just want to know that is this way of fetching the data into internal table okay ?are there any better ways of fetching the data into the internal table ? why  is it looping in work area of lips, why not in likp?
    (plz dont use field-symbols or oo abap or macros) I WANT TO USE PLAIN AND SIMPLE ABAP STATEMENTS LIKE ABOVE..
    By using "vbeln type lips-vbeln" are we refering to the field or data element? plz suggest.
    P.S.           [my approach was to inner join likp and lips into itab(my internal table).
    select data from kna1, vbak,vbap,vbrp into respective internal tables like it_kna1,it_vbak etc.
    then using individual loops into the tables, i would use read table to insert data into itab(my final internal table) plz suggest which method wud be more efficient? ]
    Edited by: Rob Burbank on Jun 8, 2009 11:54 AM

    ok i am posting the select queries once again.
    i want to know why are we looping in t_lips and why not t_likp? bcoz tlikp is the header table, if we loop thru it and then read the rest tables then what will be the problem? plz clarify with examples._
    [my idea was to loop at t_likp then read t_lips.append the lips data into t_order(main internal table).then do read table on t_kna1,t_vbap etc indexing t_order. so plz suggest whether my approach was write or wrong?if wrong why?plz site any other ways of doing this query.
    types: begin of ty_vbap,
           vbeln type vbap-vbeln,
           posnr type vbap-posnr, .....
    does the declaration statement in types refer to tables or data elements? what is the difference if we declare it like:
       types: begin of ty_vbap,
           vbeln type vbeln,
           posnr type posnr, .....
    select-options:
    s_deldoc FOR likp-vbeln, " Delivery
    s_dldate FOR likp-lfdat. " Delivery Date
    Get delivery document number,delivery date,customer number from
    delivery header table
    SELECT vbeln " Delivery
    lfdat " Delivery Date
    kunnr " Customer Number 1
    FROM likp
    INTO TABLE t_likp
    WHERE vbeln IN s_deldoc
    AND lfdat IN s_dldate.
    IF sy-subrc EQ 0.
    Get Customer name for customer numbers from Customer master table
    SELECT kunnr " Customer Number 1
    name1 " Name 1
    FROM kna1
    INTO TABLE t_kna1
    FOR ALL ENTRIES IN t_likp
    WHERE kunnr EQ t_likp-kunnr.
    IF sy-subrc EQ 0.
    Get delivery item number,sales document number,sales item number,
    delivery quantity from delivery item table
    SELECT vbeln " Delivery
    posnr " Delivery Item
    vgbel " Document number of
    " reference document
    vgpos " Item number of reference item
    lfimg " Actual quantity delivered
    vrkme " Sales unit
    FROM lips
    INTO TABLE t_lips
    FOR ALL ENTRIES IN t_likp
    WHERE vbeln EQ t_likp-vbeln.
    IF sy-subrc EQ 0.
    Get sales document number,item number,material,material description,
    ordered quantity from sales item table
    SELECT vbeln " Sales Document
    posnr " Sales Document Item
    matnr " Material Number
    arktx " Short text for sales order
    " item
    kwmeng " Cumulative Order Quantity
    vrkme " Sales unit
    FROM vbap
    INTO TABLE t_vbap
    FOR ALL ENTRIES IN t_lips
    WHERE vbeln EQ t_lips-vgbel
    AND posnr EQ t_lips-vgpos.
    IF sy-subrc EQ 0.
    Get sales document number ,created date,purchase order number from
    sales header table
    SELECT vbeln " Sales Document
    erdat " Date on Which Record Was" Created
    aufnr " Order Number
    FROM vbak
    INTO TABLE t_vbak
    FOR ALL ENTRIES IN t_lips
    WHERE vbeln EQ t_lips-vgbel.
    IF sy-subrc EQ 0.* Get billing document number,billing item,reference delivery document
    number,delivery item number,billing item from billing item table
    SELECT vbeln " Billing Document
    posnr " Billing item
    vgbel " Document number of the
    " reference document
    vgpos " Item number of the" reference" item
    fklmg " Billing quantity in" stockkeeping unit
    vrkme " Sales unit
    FROM vbrp
    INTO TABLE t_vbrp
    FOR ALL ENTRIES IN t_lips
    WHERE vgbel EQ t_lips-vbeln
    AND vgpos EQ t_lips-posnr.
    ENDIF. " IF SY-SUBRC EQ 0
    ENDIF. " IF SY-SUBRC EQ 0
    ENDIF. " IF SY-SUBRC EQ 0
    ENDIF. " IF SY-SUBRC EQ 0
    ELSE.
    Display message if records are not found for entered values
    MESSAGE S000.
    EXIT.
    ENDIF. " IF SY-SUBRC EQ 0
    Looping Delivery item internal table to assign values to order
    internal table
    LOOP AT t_lips INTO fs_lips.
    Get delivery date and customer number for delivery document number
    from delivery header internal table
    READ TABLE t_likp WITH KEY vbeln = fs_lips-vbeln
    INTO fs_likp.
    Get customer name for customer number from customer master internal
    table
    IF sy-subrc EQ 0.
    READ TABLE t_kna1 WITH KEY kunnr = fs_likp-kunnr
    INTO fs_kna1.
    Get sales document number,item number,ordered quantity for delivery
    document number,item number from sales item internal table
    IF sy-subrc EQ 0.
    READ TABLE t_vbap WITH KEY vbeln = fs_lips-vgbel
    posnr = fs_lips-vgpos INTO fs_vbap.
    Get goods issue date and purchase order number for sales document
    number from sales header internal table
    IF sy-subrc EQ 0.
    READ TABLE t_vbak WITH KEY vbeln = fs_vbap-vbeln INTO fs_vbak.
    IF sy-subrc EQ 0.
    Get billing document number,billing item,billing quantity for delivery
    document number,delivery item number from billing item internal table
    READ TABLE t_vbrp WITH KEY vgbel = fs_lips-vbeln
    vgpos = fs_lips-posnr INTO fs_vbrp.
    Assign sales,delivery,billing fields into respective fields of sales
    order internal table
    IF sy-subrc EQ 0.
    fs_order-vbeln = fs_vbap-vbeln.
    fs_order-posnr = fs_vbap-posnr.
    fs_order-erdat = fs_vbak-erdat.
    fs_order-kunnr = fs_likp-kunnr.
    fs_order-name1 = fs_kna1-name1.
    fs_order-aufnr = fs_vbak-aufnr.
    fs_order-matnr = fs_vbap-matnr.
    fs_order-arktx = fs_vbap-arktx.
    fs_order-kwmeng = fs_vbap-kwmeng.
    fs_order-vrkme = fs_vbap-vrkme.
    fs_order-vbeln1 = fs_lips-vbeln.
    fs_order-posnr1 = fs_lips-posnr.
    fs_order-lfimg = fs_lips-lfimg.
    fs_order-vrkme1 = fs_lips-vrkme.
    fs_order-vbeln2 = fs_vbrp-vbeln.
    fs_order-posnr2 = fs_vbrp-posnr.
    fs_order-fklmg = fs_vbrp-fklmg.
    fs_order-vrkme2 = fs_vbrp-vrkme.
    APPEND fs_order TO t_order.
    CLEAR fs_order.
    ENDIF. " IF SY-SUBRC EQ 0
    ENDIF. " IF SY-SUBRC EQ 0
    ENDIF. " IF SY-SUBRC EQ 0
    ENDIF. " IF SY-SUBRC EQ 0
    ENDIF. " IF SY-SUBRC EQ 0
    ENDLOOP. " LOOP AT T_LIPS INTO FS_LIPS

  • Reg select query problem

    hi all,
    hope all r doing fine?
    anyway i have a query which is mentioned below:-
    select field1,.....fieldn
             from <dbtable1>
             into corresponding fields of table itab
             where <condition>.
    select field1,...fieldn
              from <dbtable2>
             appending corresponding fields of table itab
            where <condition>.
    the above two select stmts retrieve same set of  fields from two different database tables into same internal table itab..
    now my question is ...........is any other way to change 2nd select statement without using appending correspondin fields
    but the functionality should remain the same as it is after changing..................
    bcos appending corresponding is causing performance problem in data retrieval.
    thanx alot in advance.
    for sure points will be given for all the helpful answers
    Jack

    Hi,
    You can use like that:
    select field1,.....fieldn
    from <dbtable1>
    into corresponding fields of table itab1
    where <condition>.
    select field1,...fieldn
    from <dbtable2>
    appending corresponding fields of table itab2
    where <condition>.
    now u use:
    loop at itab2 into w_itab2.
    read table itab1 into w_itab1 with key w_itab1-<primary field> = w_itab2-<Primary field>.
    if sy-subrc = 0.
      append w_final into i_final.
    else continue.
    endif.
    endloop.
    *i_final table having all data ( i.e itab2 & itab1 data)

  • Select Query problem....too urgent

    Hi all!
    I am running oracle 8i.
    I have a table named taxsuamry. I want to arrange the data by exepenses in desc order and after sorting, i want to select first 50 records.
    I supplied the follwoing query:
    select expenses from taxsuamry
    where rownum<51
    order by expenses desc;
    but it selects 50 records first and then sorts them...i want sorting first and then top 50 rerods from sorted data.
    Can anybody help me plz

    hello,riaz
    If it is optimization kind of problem for your sorting first ...then u can go for following way...
    select /*+ index(empid) */ empid from emp where rownum <51 order by empid desc
    .........where empid is attribute where u have index on it....
    null

  • Select Query Problem-need help

    hi,
    Help me out from this problem.
    Actually i have a table and the data in it as follows:
    Department Name Job Name
    Accounts Sr. Accountant
    Accounts Jr. Accountant
    Accounts Cleark
    But i dont want the repeated Department Name.. and i want the same output as follows.
    Department Name Job Name
    Accounts Sr. Accountant
    Jr. Accountant
    Cleark
    Without using sql reports and Sql Plus additional commands.
    The same output should come from a sql query only.
    Thanks in Advance
    Md Anwer Ali

    I shouldn't try to code before I have had at least three cups of coffee. The actual answer is:
    select decode(department,lag(department) over (order by department),null,department)
    , job
    from departments
    order by department.
    I ran this:
    select decode(job,lag(job) over (order by job),null,job)
    , ename
    from emp
    order by job
    and got this result:
    SQL> /
    DECODE(JO ENAME
    ANALYST SCOTT
    FORD
    CLERK SMITH
    ADAMS
    MILLER
    JAMES
    MANAGER JONES
    CLARK
    BLAKE
    PRESIDENT KING
    SALESMAN ALLEN
    MARTIN
    TURNER
    WARD
    14 rows selected.

  • Problem with select query

    Hi All,
    i_dfkkko-xblnr
      IF NOT i_dfkkko[] IS INITIAL       .
        SELECT opbel
               belnr
               FROM erchc
               INTO TABLE i_erchc1
               FOR ALL ENTRIES IN i_dfkkko
               WHERE opbel EQ i_dfkkko-xblnr.
      ENDIF.
    I am using the above select query.problem is when i put the value
    of i_dfkkko-xblnr by going to the table erchc i am getting the record.But this qury is not resulting any value.
    i have checked in debug mode copied the value of xblnr of i_dfkkko
    and went to erchc table and passed to opbel of erchc i got the reords.
    can anybody pls help..
    Rgds,
    Sai

    Hi,
    The database would be having the value with leading zeroes.
    Use FM "CONVERSION_EXIT_ALPHA_INPUT" to conver the values & then pass to select query.
    _dfkkko-xblnr
    IF NOT i_dfkkko[] IS INITIAL .
    loop at i_dfkkko.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
    VALUE(INPUT) = i_dfkkko-xblnr
    IMPORITNG
    VALUE(OUTPUT) = i_dfkkko-xblnr.
    modify i_dfkkko.
    endloop.
    SELECT opbel
    belnr
    FROM erchc
    INTO TABLE i_erchc1
    FOR ALL ENTRIES IN i_dfkkko
    WHERE opbel EQ i_dfkkko-xblnr.
    ENDIF.

  • Select query for 6 different tables with vbeln as same selction criteria

    Hi,
    I have a query..
    I am using 6 differnet tables with vbeln being the same primary key on the basis of which i have to match the data.
    I have assign vbeln with different name but in the select query it gives me the error that vbeln2 is not the correct field.
    Can anyone please suggest how can i use the different field name and read the data from the table.

    hi,
    Use alias name for fields / tables in select query, problem will solve
    Regards,
    Praveen Savanth.N

  • Mind bender select query condition

    I posted a thread called very interesting select query problem. Because I am new I did not set the question as unanswered. The question is :
    I have selected some material documents from bkpf into i_bkpf. then by looping on it I broke down the AWKEY into mblnr and mjahr and modified the same internal table. Then I created a data base view YMCSKS joining MKPF and MSEG.
    I want to write a select query which does not select mblnr and mjahr from YMCSKS which are already there in i_bkpf
    sort of like this
    select.......
    from VIEW (YMCSKS)
    where MBLNR <> i_bkpf-mblnr

    Manas
    PK is correct.  You've had the same question rejected twice yesterday - do you read your email?    You've really not provided enough information, and so the problem looks very much like you are wanting other people to do your work.  This is no "mind bender".  If you can't do it, then you need to be very clear about what you've already tried - newbies are welcome here, but evidence of effort is expected.
    Rudeness is not tolerated, so please keep the conversation civil.
    If you would like to give more information about what you've tried, and where you are struggling, then I shall leave the thread open.  I'm inviting you to restate your question.
    mâtt

  • How can i use index in select query.. facing problem with the select query.

    Hi Friends,
    I am facing a serious problem in one of the select query. It is taking a lot of time to fetch data in Production Scenario.
    Here is the query:
      SELECT * APPENDING CORRESPONDING FIELDS OF TABLE tbl_summary
        FROM ztftelat LEFT JOIN ztfzberep
         ON  ztfzberep~gjahr = st_input-gjahr
         AND ztfzberep~poper = st_input-poper
         AND ztfzberepcntr  = ztftelatrprctr
        WHERE rldnr  = c_telstra_accounting
          AND rrcty  = c_actual
          AND rvers  = c_ver_001
          AND rbukrs = st_input-bukrs
          AND racct  = st_input-saknr
          AND ryear  = st_input-gjahr
          And rzzlstar in r_lstar                            
          AND rpmax  = c_max_period.
    There are 5 indices present for Table ZTFTELAT.
    Indices of ZTFTELAT:
      Name   Description                                               
      0        Primary key( RCLNT,RLDNR,RRCTY,RVERS,RYEAR,ROBJNR,SOBJNR,RTCUR,RUNIT,DRCRK,RPMAX)                                          
      005    Profit (RCLNT,RPRCTR)
      1        Ledger, company code, account (RLDNR,RBUKRS, RACCT)                                
      2        Ledger, company code, cost center (RLDNR, RBUKRS,RCNTR)                           
      3        Account, cost center (RACCT,RCNTR)                                        
      4        RCLNT/RLDNR/RRCTY/RVERS/RYEAR/RZZAUFNR                        
      Z01    Activity Type, Account (RZZLSTAR,RACCT)                                        
      Z02    RYEAR-RBUKRS- RZZZBER-RLDNR       
    Can anyone help me out why it is taking so much time and how we can reduce it ? and also tell me if I want to use index number 1 then how can I use?
    Thanks in advance.

    Hi Shiva,
    I am using two more select queries with the same manner ....
    here are the other two select query :
    ***************1************************
    SELECT * APPENDING CORRESPONDING FIELDS OF TABLE tbl_summary
        FROM ztftelpt LEFT JOIN ztfzberep
         ON  ztfzberep~gjahr = st_input-gjahr
         AND ztfzberep~poper = st_input-poper
         AND ztfzberepcntr  = ztftelptrprctr
        WHERE rldnr  = c_telstra_projects
          AND rrcty  = c_actual
          AND rvers  = c_ver_001
          AND rbukrs = st_input-bukrs
          AND racct  = st_input-saknr
          AND ryear  = st_input-gjahr
          and rzzlstar in r_lstar             
          AND rpmax  = c_max_period.
    and the second one is
    *************************2************************
      SELECT * APPENDING CORRESPONDING FIELDS OF TABLE tbl_summary
        FROM ztftelnt LEFT JOIN ztfzberep
         ON  ztfzberep~gjahr = st_input-gjahr
         AND ztfzberep~poper = st_input-poper
         AND ztfzberepcntr  = ztftelntrprctr
        WHERE rldnr  = c_telstra_networks
          AND rrcty  = c_actual
          AND rvers  = c_ver_001
          AND rbukrs = st_input-bukrs
          AND racct  = st_input-saknr
          AND ryear  = st_input-gjahr
          and rzzlstar in r_lstar                              
          AND rpmax  = c_max_period.
    for both the above table program is taking very less time .... although both the table used in above queries have similar amount of data. And i can not remove the APPENDING CORRESPONDING. because i have to append the data after fetching from the tables.  if i will not use it will delete all the data fetched earlier.
    Thanks on advanced......
    Sourabh

  • Select query join problem

    hey guys,
    i've used a select query to get details from KNA1, KNVV, ADRC, KNVP, pa0002. tables by joining. but i'm getting only about 170 records. there are more than 3000 records in the database. for each tables. here is my select query
    SELECT KNA1KUNNR KNA1NAME1 KNA1NAME2 ADRCSTR_SUPPL1 ADRCSTR_SUPPL2 ADRCSTR_SUPPL3 ADRCCITY1 KNVVVWERK KNVPPERNR PA0002VORNA PA0002NACHN KNVVVKBUR KNVVKDGRP KNA1STCD1 KNA1~STCEG
        INTO CORRESPONDING FIELDS OF TABLE IT_FINAL FROM KNA1
        INNER JOIN KNVV ON KNA1KUNNR = KNVVKUNNR
        INNER JOIN ADRC ON KNA1ADRNR = ADRCADDRNUMBER
        INNER JOIN KNVP ON KNA1KUNNR = KNVPKUNNR
        INNER JOIN PA0002 ON KNVPPERNR = PA0002PERNR
        WHERE KNA1KUNNR IN S_KUNNR AND KNVVVWERK in P_VWERK AND PA0002PERNR IN S_PERNR AND KNVVVKBUR IN S_VKBUR AND KNVV~KDGRP IN S_KDGRP.
    can anyone tell me the problem in the above query.
    thanks.

    Hi
    you are using tables KNA1, KNVV, ADRC, KNVP, pa0002.
    Create internal table for each table mentioned above with all the primary keys and find the links between them
    then select data in one table and select data from another table into your internal table for all the entries exists in firs internal table.
    go for below links.
    http://www.sapdev.co.uk/abap/commands/select_forallentries.htm
    http://wiki.sdn.sap.com/wiki/display/ABAP/FORALLENTRIES-Home+page
    http://help.sap.com/abapdocu_70/en/ABENWHERE_LOGEXP_ITAB.htm
    Thanks
    lalit

Maybe you are looking for

  • Invoice verification is hitting Asset

    Hi Folks, I have a issue with GR IR Clearing. I have posted one purchase order for purchase of one asset. 1) The GR Document has been posted as below: Posting key   account                              Amount 70          140000 (ASSET)               

  • What are the advantages of CRM 2007 version

    Hi Experts, Presently my client using CRM 4.0 version so the requirement is I want impress the client for upgrade the version into CRM 2007. Please give some brief interdiction and what are facilities are available in CRM 2007 or 5.o version compare

  • Question about EWS - The operation has timed out

    hi everyone, I'm developing a solution which uses public folder database in Exchange Server to store tasks: - We use 1 account to access to public folder database by using EWS. - Currently, this public folder database contains 60000 tasks and they ar

  • Safari CONSTANTLY quitting

    for at least the past two months now, I have Safari either quit or freeze on my twice a week. It's quit at least 10 times in 6 weeks and have gave apple a piece of my mind in every "crash report" I've sent including how many times it's crashed. In ad

  • Retrieve accessibility parameter.

    Hi everyone, I have to retrieve the accessibilty parameter of user so I can display or not some button in webdynpro. If I set parameter ID ACCESSIBILITY_MODE with the value X in SU01, when I call method GET_IS_ACCESSIBLE in IF_WD_APPLICATION return v