Problem in FOR ALL ENTRIES IN statement

Hi Abaper,
I have a problem in FOR ALL ENTRIES IN statement.
I have a table /ccsht/na_estadi in this table for the particulat date there are 14 records, but my internal table read only 5 record.
Below is my code:
SELECT sociedad
         xhotel_id
    FROM /ccsht/mt_photel
    INTO TABLE it_comp_hotel
   WHERE sociedad IN  p_comp
     AND xhotel_id IN p_hotid.
BREAK-POINT.
SORT it_comp_hotel BY sociedad.
SELECT xhotel_id
         xfecha_id
         xocupacion
         tot_habs_hotel
         xnum_pax1
   FROM /ccsht/na_estadi
   INTO TABLE it_estadi "CORRESPONDING FIELDS OF TABLE it_estadi
    FOR ALL ENTRIES IN it_comp_hotel
  WHERE xhotel_id EQ it_comp_hotel-xhotel_id
    AND xfecha_id IN p_date.
Can any one help me this issue.
Thanks in advance.
Thanks & Regards,
Amit

Hi Amit,
Try below
SELECT sociedad
xhotel_id
FROM /ccsht/mt_photel
INTO TABLE it_comp_hotel
WHERE sociedad IN p_comp
AND xhotel_id IN p_hotid.
BREAK-POINT.
* SORT it_comp_hotel BY sociedad.  "Remove this SORT statement.
SELECT xhotel_id
xfecha_id
xocupacion
tot_habs_hotel
xnum_pax1
FROM /ccsht/na_estadi
INTO TABLE it_estadi
FOR ALL ENTRIES IN it_comp_hotel
WHERE xhotel_id EQ it_comp_hotel-xhotel_id
AND xfecha_id IN p_date.
Note: 1) i didn't find the these tables in my SAP system
         2) If your table is still not fetching the data, tell me is it the Cluster table,. if yes,.. you need to
             maintain the all the primary keys other wise you wont get the data in internal able.
hope this will help you out.
Regards!

Similar Messages

  • Problem with FOR ALL ENTRIES statement

    Hi all
    please find the problem in the select statement.
    SELECT vbbe~vbeln
             vbap~vstel
             marc~dispo
             vbbe~matnr
             vbbe~kunnr
             vbbe~werks
             vbbe~mbdat
             vbbe~omeng
      INTO TABLE l_t_dvbeln
      FROM vbbe
      INNER JOIN vbak
      ON
      vbbe~vbeln = vbak~vbeln
      inner join vbap
      on
      vbbe~vbeln = vbap~vbeln and
      vbbe~matnr = vbap~matnr
      inner join marc
      on
      vbbe~matnr = marc~matnr and
      vbbe~werks = marc~werks
      FOR ALL entries IN g_t_stock
      WHERE vbbe~matnr = g_t_stock-matnr
      AND   vbbe~werks = g_t_stock-werks
      AND   vbak~vkorg = g_t_stock-vkorg
      AND   vbak~vtweg = g_t_stock-vtweg
      AND   vbbe~kunnr = g_t_stock-kunnr
      AND   vbbe~mbdat IN r_mbdat.
    g_t_stock is having only one record i.e.,
    g_t_stock-vstel = 'DF01'.
    g_t_stock-dispo = 'DEI'.
    g_t_stock-matnr = '00100833'.
    g_t_stock-maktx = 'SAC (300X400)'.
    g_t_stock-kunnr = '0000600431'.
    g_t_stock-werks = 'PF71'.
    g_t_stock-labst = '7727'.
    g_t_stock-vkorg = 'SF71'.
    g_t_stock-vtweg = 'IC'.
    and r_mbdat has the date range as
    r_mbdat-sign = I
    r_mbdat-option = BT
    r_mbdat-low = 15.05.2008
    r_mbdat-high =  08.06.2008
    In vbak vbap & marc tables i have only one record as per the above selection criteria.
    in VBBE table i have 7 records which satisfies the above criteria. But the select staement retrieves only 5 records.
    if we remove for all entries and hardcode the values in the select statement then it retrieves all 7 records.
    can anybody help me.
    what is the reason it is showing only 5 records.

    Hi all
    actually it has to retrieve the following records
    VBELN      MATNR    KUNNR WERKS  MBDAT    LABST
    30001417     00100833     600431  PF71   15.05.2008   20.000
    30001417     00100833     600431  PF71   15.05.2008   20.000
    30001417     00100833     600431  PF71   22.05.2008   5.000
    30001417     00100833     600431  PF71   22.05.2008   7.000
    30001417     00100833     600431  PF71   27.05.2008  10.000
    30001417     00100833     600431  PF71   27.05.2008  10.000
    30001417     00100833     600431  PF71   29.05.2008  10.000
    But it is retrieving only 5 records as below
    VBELN      MATNR    KUNNR WERKS  MBDAT    LABST
    30001417     00100833     600431  PF71   15.05.2008   20.000
    30001417     00100833     600431  PF71   22.05.2008   5.000
    30001417     00100833     600431  PF71   22.05.2008   7.000
    30001417     00100833     600431  PF71   27.05.2008  10.000
    30001417     00100833     600431  PF71   29.05.2008  10.000
    Please give the reason

  • Performance Problems with "For all Entries" and a big internal table

    We have big Performance Problems with following Statement:
    SELECT * FROM zeedmt_zmon INTO TABLE gt_zmon_help
      FOR ALL ENTRIES IN gt_zmon_help
        WHERE
        status = 'IAI200' AND
        logdat IN gs_dat AND
        ztrack = gt_zmon_help-ztrack.
    In the internal table gt_zmon_help are over 1000000 entries.
    Anyone an Idea how to improve the Performance?
    Thank you!

    >
    Matthias Weisensel wrote:
    > We have big Performance Problems with following Statement:
    >
    >  
    SELECT * FROM zeedmt_zmon INTO TABLE gt_zmon_help
    >   FOR ALL ENTRIES IN gt_zmon_help
    >     WHERE
    >     status = 'IAI200' AND
    >     logdat IN gs_dat AND
    >     ztrack = gt_zmon_help-ztrack.
    >
    > In the internal table gt_zmon_help are over 1000000 entries.
    > Anyone an Idea how to improve the Performance?
    >
    > Thank you!
    You can't expect miracles.  With over a million entries in your itab any select is going to take a bit of time. Do you really need all these records in the itab?  How many records is the select bringing back?  I'm assuming that you have got and are using indexes on your ZEEDMT_ZMON table. 
    In this situation, I'd first of all try to think of another way of running the query and restricting the amount of data, but if this were not possible I'd just run it in the background and accept that it is going to take a long time.

  • Problem with for all entries

    Hi all,
       When i was trying to use for all entries, i am not able to pull records inside my internal table. Though both of the tables have the common key fields between them(and ofcourse have entries in that). Now what i have analyzed was, the first table is having 7 primary keys and the one i am using for 'for all entries' comes 6th. Does this gives any impact in pulling records inside my internal table?.Else please give me a possible solution for this. The alternate statement(a normal select query with * ) that i had used for this reserved my dialog processor for a while. Which resulted in 'time exceeded' short dump.

    Hi,
    The WHERE clause of the SELECT statement has a special variant that allows you to derive conditions from the lines and columns of an internal table:
    SELECT ... FOR ALL ENTRIES IN <itab> WHERE <cond> ...
    <cond> may be formulated as described above. If you specify a field of the internal table <itab> as an operand in a condition, you address all lines of the internal table. The comparison is then performed for each line of the internal table. For each line, the system selects the lines from the database table that satisfy the condition. The result set of the SELECT statement is the union of the individual selections for each line of the internal table. Duplicate lines are automatically eliminated from the result set. If <itab> is empty, the addition FOR ALL ENTRIES is disregarded, and all entries are read.
    The internal table <itab> must have a structured line type, and each field that occurs in the condition <cond> must be compatible with the column of the database with which it is compared. Do not use the operators LIKE, BETWEEN, and IN in comparisons using internal table fields. You may not use the ORDER BY clause in the same SELECT statement.
    You can use the option FOR ALL ENTRIES to replace nested select loops by operations on internal tables. This can significantly improve the performance for large sets of selected data.
    Hope this is useful
    Reema

  • Alternative for / Problems with: "For all entries in data_package"

    Hi Guys
    I doing some ABAP in a Start Rotine in BW and would like to do the following:
      select * from /BI0/PMATERIAL into table 0mat
      for all entries in DATA_PACKAGE
      where material = DATA_PACKAGE-/bic/zmaterial.
    But I get the following error:
    E:When using the addition "FOR ALL ENTRIES IN itab", the fields "MATERIAL" and "DATA_PACKAGE-/BIC/ZMATERIAL" must have the same type and length. and length.
    ZMATERIAL:
    - Length: 28
    - Type: CHAR - Character String
    ZMATERIAL:
    - Length: 18
    - Type: CHAR - Character String
    According to the error message "For all entries" cannot be used in this case since the lengths are not identical, but is there an alternative way to do what I would like to do?
    Thanks in advance, kind regards,
    Torben

    Hi
    one thing you can try like this define one variable in other itab of same type
    then loop at the first table and assign it to new field and modify the itab
    then use this field with for all entries
    Regards
    Shiva

  • Problem with FOR ALL ENTRIES IN

    This is my simple source code.
    TABLES: stpo.
    DATA:  t_stpo      LIKE  stpo  OCCURS 0 WITH HEADER LINE,
    t_stpo_itm      LIKE  stpo  OCCURS 0 WITH HEADER LINE,
    t_stpo-stlnr = '00000058'.
    t_stpo-stlkn = '00000003'.
    append t_stpo.
    t_stpo-stlnr = '00000058'.
    t_stpo-stlkn = '00000007'.
    append t_stpo.
    SELECT * FROM stpo INTO TABLE t_stpo_itm
    FOR ALL ENTRIES IN t_stpo
    WHERE stlnr =  t_stpo-stlnr        " BOM No.
      AND stlkn <> t_stpo-stlkn.       " BOM item node number
    The output from this source including BOM item node number 00000003, 00000007 but at SQL stlkn <> t_stpo-stlkn doesn't effected.
    Could Anyone please tell me why?
    Are there something wrong?
    Thank you in advance.

    Hi,
    You can also Use ranges for Stlnr and Stlkn fields, instead of int table.
    TABLES: stpo.
    DATA: begin of  t_stpo OCCURS 0.
                  stlnr like stpo-stlnr,
                  stlkn  like stpo-stlkn,
                  end of t_stpo.
    data t_stpo_itm LIKE stpo OCCURS 0 WITH HEADER LINE.
    t_stpo-stlnr = '00000058'.
    t_stpo-stlkn = '00000003'.
    append t_stpo.
    clear t_stpo.
    t_stpo-stlnr = '00000058'.
    t_stpo-stlkn = '00000007'.
    append t_stpo.
    clear t_stpo.
    if not t_stpo[] is initial.
    SELECT * FROM stpo INTO TABLE t_stpo_itm
    FOR ALL ENTRIES IN t_stpo
    WHERE stlnr = t_stpo-stlnr " BOM No.
    AND stlkn <> t_stpo-stlkn. " BOM item node number
    endif.
    or you can simply write a select for STPO like this:
    SELECT * FROM stpo INTO TABLE t_stpo_itm
    WHERE stlnr = '00000058' " BOM No.
    AND ( stlkn <> '00000007' or stlkn <>  '00000003' ). " BOM item node number
    regards,
    Anji

  • Problem with for all entries in select querry

    hi,
    Hi,
    I am using select queery like this
    SELECT  version  COUNT( * ) 
    from ztbi_default_va4
    INTO  CORRESPONDING FIELDS OF TABLE   lit_new 
    FOR ALL ENTRIES IN lit_new1
    WHERE network = lit_new1-network GROUP BY version.
    this is not working showing error as:
    The addition "FOR ALL ENTRIES" excludes all aggregate functions with          
    the exception of "COUNT( * )" as the single element of the SELECT     clause.     
    I am using only count(*) ,not using othes like max,min etc,,,,,,,,,
    please suggest any missing in syntax,,,,attach relavant code using count(*) with for all entreis
    any help appriciated,,,,,
    Thanks in advance,,,,

    Hi,
    Try this -
    TYPES: begin of t_data,
                 version TYPE version,
                 count    type i,
                 end of t_data.
    DATA: i_data TYPE STANDARD TABLE OF t_data,
               wa_data TYPE t_data.
    DATA: l_version TYPE version,
               l_count TYPE i.
    SELECT  version  COUNT( * ) 
    from ztbi_default_va4
    INTO  CORRESPONDING FIELDS OF TABLE   lit_new 
    FOR ALL ENTRIES IN lit_new1
    WHERE network = lit_new1-network.
    SORT lit_new.
    LOOP AT lit_new INTO lwa_new.
        IF lwa_new EQ l_version.
          l_count = l_count + 1.
        ELSE.
          wa_data-version = l_version.
          wa_data-count = l_count + 1.
          APPEND wa_data TO i_data.
          CLEAR: wa_data.
          CLEAR: l_count.
        ENDIF.
        l_version = lwa_new-version.
        CLEAR: lwa_new.
    I hope this will do.
    Make any necessary changes.
    Regards,
    Harsh Bansal

  • FOR ALL ENTRIES IN Problem

    Hello,
    probably it is a silly problem, but can anybody tell me why this FOR ALL ENTRIES IN statement does not fill all the columns of my internal table?
    At the end of the report only the columns LGOBE contains values.
    data itab type zmm_t_alv.
    select mardmatnr mardwerks mardlgort mardlabst
      maktspras maktmaktx
      into corresponding fields of table itab
      from mard inner join makt
        on mardmatnr = maktmatnr
    where makt~spras = 'D'.
    select lgobe
      into corresponding fields of table itab
      from t001l
      for all entries in itab
      where t001l~werks = itab-werks.
    break-point.
    Thanks,
    Manuel

    Please read the documentation aboutr for all entries
    For all entries selects all records from a db table which correspond to the entries in an internal table, the result must be stored in a different table.
    Otherwise use a loop at itab.
       select single ...
       modify itab
       endloop
    Be careful with empty For all entries tables, it behave like a ranges table, no entry means no restriction and you get all records from the db table. That is a different behavior than the loop above.
    Use   field1 field2 ... in corresponding fields of ....
    If you specify only one field then you get only one result.
    If you want one the field 'lgobe' then use into wa-lgobe and not the much slower into corresponding!
    Siegfried

  • Nested statement "for all entries in"

    Hi,
    is ist possiple to nest "for all entries in" statements ?
    At the moment I have the following SELECT-Statement:
    select * from /rtc/tm_inusk
              appending table gt_zrtc4inusk
              for all entries in lt_trkorrdesti
                where trkorr = lt_trkorrdesti-trkorr and
                      objname in lv_selk_copy.
    Sometimes the statement dumps because the range table "lv_selk_copy" is to big.
    In another thread I was told to use "for all entries in" instead of a range when the range is to big.
    If do so I have to use two "for all entries in" statements in my select. But I think this is not possible.
    So any idea ?
    Thanks
    Arnfried

    Hi,
    Using two for all entries in not possible... Its better that you split up your range into smaller chunks..
    or..
    select * from /rtc/tm_inusk
    appending table gt_zrtc4inusk
    for all entries in lt_trkorrdesti
    where trkorr = lt_trkorrdesti-trkorr .
    Once you have selected delete the records where objname Not in lv_selk_copy.

  • Queries for FOR ALL ENTRIES IN

    1. If I use For all entries in inspite of loop within loop , wil it help in   
        increasing processing time ??
    2. There is one problem in For all entries in , it is not fetching all 
         entries but it left entries having same data so is it like that only
    Please dont pass any link.
    Ankesh.

    Hi,
    SELECT ... FOR ALL ENTRIES IN <itab> WHERE <cond> ..<cond>
    If you specify a field of the internal table <itab>
    as an operand in a condition, you address all lines of the internal table. The comparison is then performed for each line of the internal table. For each line, the system selects the lines from the database table that satisfy the condition. The result set of the SELECT statement is the union of the individual selections for each line of the internal table. Duplicate lines are automatically eliminated from the result set. If <itab> is empty, the addition FOR ALL ENTRIES is disregarded, and all entries are read. The internal table <itab> must have a structured line type, and each field that occurs in the condition <cond> must be compatible with the column of the database with which it is compared. Do not use the operators LIKE, BETWEEN, and IN in comparisons using internal table fields. You may not use the ORDER BY clause in the same SELECT statement. You can use the option FOR ALL ENTRIES to replace nested select loops by operations on
    internal tables. This can significantly improve the performance for large sets of selected data.
    It is also possible to avoid nested SELECT loops by placing the selection from the outer loop in an internal table and then running the inner selection once only using the FOR ALL ENTRIES addition. This technique stems from the time before joins were allowed in the FROM clause. On the other hand, it does prevent redundant data from being transferred from the database.
    Answers for your question is :
    1. If I use For all entries in inspite of loop within loop , wil it help in  increasing processing time ?? : It will Improve your performance.
    2. There is one problem in For all entries in , it is not fetching all entries but it left entries having same data so is it like that only : True it preventsredundant data from being transferred from the database.
    Hope this solves your doubt.
    Plz reward if helpful.
    Thanks,
    Dhanashri.

  • Performance issue with select query and for all entries.

    hi,
    i have a report to be performance tuned.
    the database table has around 20 million entries and 25 fields.
    so, the report fetches the distinct values of two fields using one select query.
    so, the first select query fetches around 150 entries from the table for 2 fields.
    then it applies some logic and eliminates some entries and makes entries around 80-90...
    and then it again applies the select query on the same table using for all entries applied on the internal table with 80-90 entries...
    in short,
    it accesses the same database table twice.
    so, i tried to get the database table in internal table and apply the logic on internal table and delete the unwanted entries.. but it gave me memory dump, and it wont take that huge amount of data into abap memory...
    is around 80-90 entries too much for using "for all entries"?
    the logic that is applied to eliminate the entries from internal table is too long, and hence cannot be converted into where clause to convert it into single select..
    i really cant find the way out...
    please help.

    chinmay kulkarni wrote:Chinmay,
    Even though you tried to ask the question with detailed explanation, unfortunately it is still not clear.
    It is perfectly fine to access the same database twice. If that is working for you, I don't think there is any need to change the logic. As Rob mentioned, 80 or 8000 records is not a problem in "for all entries" clause.
    >
    > so, i tried to get the database table in internal table and apply the logic on internal table and delete the unwanted entries.. but it gave me memory dump, and it wont take that huge amount of data into abap memory...
    >
    It is not clear what you tried to do here. Did you try to bring all 20 million records into an internal table? That will certainly cause the program to short dump with memory shortage.
    > the logic that is applied to eliminate the entries from internal table is too long, and hence cannot be converted into where clause to convert it into single select..
    >
    That is fine. Actually, it is better (performance wise) to do much of the work in ABAP than writing a complex WHERE clause that might bog down the database.

  • For all entries against Ranges

    Hi,
    I have a question regarding a Select query where I have to select some data and then store it in table and refer it for the 2nd Select.
    eg: Select from table 1
          into itab1.
        select from table 2
       into itab2
       for all entries in itab1.
    My question is should I use a Range for the 1st select instead of an itab.The itab1 will be containing max 50 records.
    The problem with for all entries is that I cannot use 'UP TO ROWS' as it only deletes extra entries at application level and not database level. I will be selecting 1000 rows even if I want only 100 rows.
    Please let me know ur views

    From a performance perspective ranges perform better than FOR ALL ENTRIES however the number of records you can use in your range is limited. You will get a run time dump if your range size increases beyond the allowable. If you are very confident that you have not more than 50 entries in your range, I would recommend that you use the range instead of FOR ALL ENTRIES.
    An even better option would be to use a join of two tables. If you can provide specifics I could help you further.

  • About for all entries in itab usage issue

    hi
    i will get a lot of material information first.
    the next i will get inforamtion about table MARC AND MBEW.
    one statement i use sap function to get MARC:
      CALL FUNCTION 'MARC_ARRAY_READ'
        EXPORTING
          KZRFB                = ' '
          NEUFLAG              = ' '
          SPERRMODUS           = ' '
          STD_SPERRMODUS       = ' '
          EXCEPTION_ON_LOCK    = ' '
        IMPORTING
          RETC                 = ret
        TABLES
          IPRE01               = ipre
          MARC_TAB             = disp
        EXCEPTIONS
          ENQUEUE_MODE_CHANGED = 1
          LOCK_ON_MARC         = 2
          LOCK_SYSTEM_ERROR    = 3
          OTHERS               = 4.
    two statement if i use:
        select matnr dispo ekgrp plifz
      into table disp
      from marc
      for all entries in ipre
      where werks = ipre-werks and
            matnr = ipre-matnr.
    which one will get better performce.
    and
    if ipre table have a lot of data, so in sap what about for all entries of Limit?
    and will lose data to use for all entries of statements?
    have function in sap to get data like 'MARC_ARRAY_READ' about MEBW.
    THANK YOU!

    thank you!
    what about for all entries of Limit?
    and will lose data to use for all entries of statements?
    exist function about get MEBW ARRAY??

  • For all entries problem

    Hi experts,
    I have a below statement in my code
    "SELECT on EKPO for all entries on ITAB (which is having 4 hundread thousand recods )"
    giving dump saying "MEMORY_PGFREE_FAILED"  and "Error releasing memory block in paging"
    i need your suggestion to avoid the memory problem
    "MEMORY_PGFREE_FAILED" ?
    can we go ahead with EXTRACT logic, does this solve the memory problem?
    thoughts will be appriciated,
    Thanks,
    Shaik bhasha

    See the example code :
    REPORT  ZSPFLI  LINE-SIZE 132 LINE-COUNT 65(3)
                                                 NO STANDARD PAGE HEADING.
    TABLES:SPFLI,SCARR, SFLIGHT, SBOOK.
    SELECT-OPTIONS: MYCARRID FOR SPFLI-CARRID.
    FIELD-GROUPS: HEADER, SPFLI_FG, SFLIGHT_FG, SBOOK_FG.
    INSERT:
            SPFLI-CARRID
            SPFLI-CONNID
            SFLIGHT-FLDATE
            SBOOK-BOOKID
           INTO HEADER,
            SPFLI-CARRID
            SPFLI-CONNID
            SPFLI-CITYFROM
            SPFLI-AIRPFROM
            SPFLI-CITYTO
            SPFLI-AIRPTO
            SPFLI-DEPTIME
            SCARR-CARRNAME
          INTO SPFLI_FG,
            SFLIGHT-FLDATE
            SFLIGHT-SEATSMAX
            SFLIGHT-SEATSOCC
            SFLIGHT-PRICE
          INTO SFLIGHT_FG,
            SBOOK-BOOKID
            SBOOK-CUSTOMID
            SBOOK-CUSTTYPE
            SBOOK-SMOKER
           INTO SBOOK_FG.
    SELECT * FROM SPFLI WHERE CARRID IN MYCARRID.
      SELECT SINGLE * FROM SCARR WHERE CARRID = SPFLI-CARRID.
      EXTRACT SPFLI_FG.
      SELECT * FROM SFLIGHT
       WHERE CARRID = SPFLI-CARRID AND  CONNID = SPFLI-CONNID.
        EXTRACT SFLIGHT_FG.
        SELECT * FROM SBOOK
               WHERE CARRID = SFLIGHT-CARRID AND
               CONNID = SFLIGHT-CONNID AND FLDATE = SFLIGHT-FLDATE.
          EXTRACT SBOOK_FG.
          CLEAR SBOOK.
        ENDSELECT.
        CLEAR SFLIGHT.
      ENDSELECT.
      CLEAR SPFLI.
    ENDSELECT.
    SORT.
    LOOP.
      AT SPFLI_FG.
        FORMAT COLOR COL_HEADING.
        WRITE: / SCARR-CARRNAME,
                 SPFLI-CONNID, SPFLI-CITYFROM,
                 SPFLI-AIRPFROM, SPFLI-CITYTO, SPFLI-AIRPTO, SPFLI-DEPTIME.
        FORMAT COLOR OFF.
      ENDAT.
      AT SFLIGHT_FG.
        WRITE: /15 SFLIGHT-FLDATE, SFLIGHT-PRICE, SFLIGHT-SEATSMAX,
                   SFLIGHT-SEATSOCC.
      ENDAT.
      AT SBOOK_FG.
        WRITE: /30 SBOOK-BOOKID, SBOOK-CUSTOMID,
                     SBOOK-CUSTTYPE, SBOOK-SMOKER.
      ENDAT.
    ENDLOOP.

  • I have a problem in using  for all entries

    Hi i have a problem in using <b>for all entries</b>
    i have declared the two internal tables as below
      DATA: BEGIN OF ITAB OCCURS 10,
              EBELN LIKE EKKO-EBELN,
              LIFNR LIKE EKKO-LIFNR,
              EBELP LIKE EKBE-EBELP,
              BELNR LIKE EKBE-BELNR,
    *          MATNR LIKE EKPO-MATNR,
    *          TXZ01 LIKE EKPO-TXZ01,
              VGABE LIKE EKBE-VGABE,
              GJAHR LIKE EKBE-GJAHR,
              KNUMV LIKE EKKO-KNUMV,
         END OF ITAB.
    DATA: BEGIN OF ITAB1 OCCURS 10,
              EBELN LIKE EKPO-EBELN,
              MATNR LIKE EKPO-MATNR,
              TXZ01 LIKE EKPO-TXZ01,
              WERKS LIKE EKPO-WERKS,
              NETWR LIKE EKPO-NETWR,
              MENGE LIKE EKPO-MENGE,
              MWSKZ LIKE EKPO-MWSKZ,
              LIFNR LIKE EKKO-LIFNR,
              EBELP LIKE EKBE-EBELP,
              BELNR LIKE EKBE-BELNR,
          END OF ITAB1.
    <b>and now i have tried to move the values in those internal tables using these statements</b>
       SELECT  A~EBELN A~LIFNR A~KNUMV B~VGABE B~EBELP B~GJAHR B~BELNR
            FROM  EKKO AS A
            INNER JOIN EKBE  AS B ON  B~EBELN = A~EBELN
            INTO  CORRESPONDING
            FIELDS OF TABLE ITAB WHERE B~VGABE = '2'.
       SELECT EKPO~EBELN EKPO~MATNR EKPO~TXZ01 EKPO~WERKS EKPO~NETWR
              EKPO~MENGE EKPO~MWSKZ
          FROM EKPO
          INTO CORRESPONDING FIELDS OF TABLE ITAB1
          FOR ALL ENTRIES IN ITAB
          WHERE EBELN = ITAB-EBELN.
          LOOP AT ITAB1.
           READ TABLE ITAB WITH KEY EBELN = ITAB-EBELN.
           ITAB-EBELN = ITAB1-EBELN.
           ITAB1-LIFNR = ITAB-LIFNR.
           ITAB1-EBELP = ITAB-EBELP.
           ITAB1-BELNR = ITAB-BELNR.
           ITAB1-EBELP = ITAB-EBELP.
           APPEND ITAB1.
          ENDLOOP.
    But when i was using loop then it was displaying values in debugging mode but while i was trying to execute it was taking a lot of time i thought that it was due to more information in the already declared internal table so i have tried to remove the previous entries but it was showing an error while i was removing the old entries
    and when i  remove the loop at itab1 then i'll get output directly but it was displaying the itab fields which is my 1st internal table but not the values of itab1 can u explain me what is the possible error for that
    Regards ,
    Pavan

    before using for all entries in, u need to check whether the driver internal table is empty, if it is empty, u should not enter into select statement.
    if u wont use this check means, when the driver internal table is empty, the second select will take all the entires from the tables.
    SELECT  AEBELN ALIFNR AKNUMV BVGABE BEBELP BGJAHR B~BELNR
            FROM  EKKO AS A
            INNER JOIN EKBE  AS B ON  BEBELN = AEBELN
            INTO  CORRESPONDING
            FIELDS OF TABLE ITAB WHERE B~VGABE = '2'.
    if itab[] is not initial.
       SELECT EKPOEBELN EKPOMATNR EKPOTXZ01 EKPOWERKS EKPO~NETWR
              EKPOMENGE EKPOMWSKZ
          FROM EKPO
          INTO CORRESPONDING FIELDS OF TABLE ITAB1
          FOR ALL ENTRIES IN ITAB
          WHERE EBELN = ITAB-EBELN.
    endif.
    I hope this will help u.
    else,
    Sujatha.

Maybe you are looking for