For all entries on custom tables

i have created 2 custom tables::zhospital_info n zpatient_info..
zhospitalinfo tab fields:::_
doc_name::prim key
patient_name:::prim key
place::prim key
zpatientinfo tab fields::_
         ZDATE ::prim key
         JOINING
         MEDICINE
         PRICE
         QUANTITY
         DOC_NAME ::for key
         PATIENT_NAME::for key
         PLACE ::for key
and inserted some values to the table contents..
this is my logic:::
TYPES: BEGIN OF ZHOSPITAL_INFO,
        DOC_NAME TYPE ZDOC_NAME,
        PATIENT_NAME TYPE ZPATIENT_NAME,
        PLACE TYPE ZPLACE,
       END OF ZHOSPITAL_INFO.
DATA: W_HI TYPE ZHOSPITAL_INFO.
DATA:T_HI TYPE STANDARD TABLE OF ZHOSPITAL_INFO.
TYPES: BEGIN OF ZPATIENTL_INFO,
         ZDATE TYPE ZDATE,
         JOINING TYPE ZJOINING,
         MEDICINE TYPE ZMEDICINE,
         PRICE TYPE ZPRICE,
         QUANTITY TYPE ZQUANTITY,
         DOC_NAME TYPE ZDOC_NAME,
         PATIENT_NAME TYPE ZPATIENT_NAME,
         PLACE TYPE ZPLACE,
       END OF ZPATIENTL_INFO.
DATA: W_PI TYPE ZPATIENTL_INFO.
DATA:T_PI TYPE STANDARD TABLE OF ZPATIENTL_INFO.
TYPES: BEGIN OF FTAB,
        DOC_NAME TYPE ZDOC_NAME,
        PATIENT_NAME TYPE ZPATIENT_NAME,
        PLACE TYPE ZPLACE,
        DATE TYPE ZDATE,
        JOINING TYPE ZJOINING,
        MEDICINE TYPE ZMEDICINE,
        PRICE TYPE ZPRICE,
        QUANTITY TYPE ZQUANTITY,
       END OF FTAB.
DATA: W_FTAB TYPE FTAB,
      T_FTAB TYPE STANDARD TABLE OF FTAB.
SELECT DOC_NAME
       PATIENT_NAME
       PLACE
       INTO TABLE t_hi
       FROM ZHOSPITAL_INFO .
IF NOT t_hi IS NOT INITIAL.
SELECT DOC_NAME
       PATIENT_NAME
       PLACE
       ZDATE
      MEDICINE*
       PRICE
       QUANTITY FROM ZPATIENTL_INFO INTO TABLE t_pi FOR ALL ENTRIES IN
t_hi
       WHERE DOC_NAME = t_hi-doc_name.
ENDIF.
LOOP AT t_pi INTO w_pi.
MOVE-CORRESPONDING: w_pi TO W_FTAB.
READ TABLE t_hi INTO w_hi WITH KEY DOC_NAME = W_FTAB-DOC_NAME.
MOVE: w_hi-patient_name TO W_FTAB-PATIENT_NAME,
      w_hi-place TO W_FTAB-PLACE.
      APPEND W_FTAB TO T_FTAB.
ENDLOOP.
LOOP AT T_FTAB INTO W_FTAB.
   WRITE:/ W_FTAB-DOC_NAME,
           W_FTAB-PATIENT_NAME,
           W_FTAB-PLACE,
           W_FTAB-DATE,
           W_FTAB-JOINING,
           W_FTAB-MEDICINE,
           W_FTAB-PRICE,
           W_FTAB-QUANTITY.
ENDLOOP.
req output:::when i enter doc_name the related info accr to doc_name from the both tables should be display..
m getting no errors but i cant execute my prog..
please check out my code...
thanx in adv..

Hi,
The problem is in the select statement:
SELECT DOC_NAME
PATIENT_NAME
PLACE
ZDATE
MEDICINE
PRICE
QUANTITY FROM ZPATIENTL_INFO INTO TABLE t_pi FOR ALL ENTRIES IN
t_hi
WHERE DOC_NAME = t_hi-doc_name.
Change this to SELECT DOC_NAME PATIENT_NAME PLACE ZDATE MEDICINE PRICE QUANTITY FROM ZPATIENTL_INFO INTO CORRESPONDING FIELDS OF TABLE t-pi FOR ALL ENTRIES IN t_hi WHERE DOC_NAME = t_hi-doc_name.
I hope the above code will help you...
Also i hope to tell the following for performance issues and also a good programming practice:
LOOP AT t_pi INTO w_pi.
MOVE-CORRESPONDING: w_pi TO W_FTAB.
READ TABLE t_hi INTO w_hi WITH KEY DOC_NAME = W_FTAB-DOC_NAME.
MOVE: w_hi-patient_name TO W_FTAB-PATIENT_NAME,
w_hi-place TO W_FTAB-PLACE.
APPEND W_FTAB TO T_FTAB.
ENDLOOP.
Please do a sy-subrc check after READ statement always...
LOOP AT t_pi INTO w_pi.
MOVE-CORRESPONDING: w_pi TO W_FTAB.
READ TABLE t_hi INTO w_hi WITH KEY DOC_NAME = W_FTAB-DOC_NAME.
If sy-subrc = 0.
MOVE: w_hi-patient_name TO W_FTAB-PATIENT_NAME,
w_hi-place TO W_FTAB-PLACE.
clear w_hi.
Endif.APPEND W_FTAB TO T_FTAB.
ENDLOOP.
Please revert back for clarifications.
Best Regards,
Suresh

Similar Messages

  • For All Entries with two tables

    Hi All,
             Can we use FOR ALL ENTRIES with two tables. for example
    SELECT * FROM MKPF INTO TABLE T_MKPF
             WHERE BUDAT IN S_BUDAT.
    SELECT * FROM MARA INTO TABLE T_MARA
             WHERE MTART IN S_MTART AND
                            MAKTL IN S_MAKTL.
    SELECT * FROM MSEG INTO TABLE T_MSEG
           FOR ALL ENTRIES IN  "T_MKPF AND T_MARA"
                  WHERE MBLNR EQ T_MKPF-MBLNR AND
                                 MATNR EQ T_MARA-MATNR.
    can we do it like this or any other way to do this plz tell. I waitting for your responce.
    Thanks
    Jitendra

    Hi,
    u cannot do like this....chek some documentation on it..
    1. duplicate rows are automatically removed
    2. if the itab used in the clause is empty , all the rows in the source table will be selected .
    3. performance degradation when using the clause on big tables.
    Say for example you have the following abap code:
    Select * from mara
    For all entries in itab
    Where matnr = itab-matnr.
    If the actual source of the material list (represented here by itab) is actually another database table, like:
    select matnr from mseg
    into corresponding fields of table itab
    where ….
    Then you could have used one sql statement that joins both tables.
    Select t1.*
    From mara t1, mseg t2
    Where t1.matnr = t2.matnr
    And T2…..
    So what are the drawbacks of using the "for all entires" instead of a join ?
    At run time , in order to fulfill the "for all entries " request, the abap engine will generate several sql statements (for detailed information on this refer to note 48230). Regardless of which method the engine uses (union all, "or" or "in" predicates) If the itab is bigger then a few records, the abap engine will break the itab into parts, and rerun an sql statement several times in a loop. This rerun of the same sql statement , each time with different host values, is a source of resource waste because it may lead to re-reading of data pages.
    returing to the above example , lets say that our itab contains 500 records and that the abap engine will be forced to run the following sql statement 50 times with a list of 10 values each time.
    Select * from mara
    Where matnr in ( ...)
    Db2 will be able to perform this sql statement cheaply all 50 times, using one of sap standard indexes that contain the matnr column. But in actuality, if you consider the wider picture (all 50 executions of the statement), you will see that some of the data pages, especially the root and middle-tire index pages have been re-read each execution.
    Even though db2 has mechanisms like buffer pools and sequential detection to try to minimize the i/o cost of such cases, those mechanisms can only minimize the actual i/o operations , not the cpu cost of re-reading them once they are in memory. Had you coded the join, db2 would have known that you actually need 500 rows from mara, it would have been able to use other access methods, and potentially consume less getpages i/o and cpu.
    In other words , when you use the "for all entries " clause instead of coding a join , you are depriving the database of important information needed to select the best access path for your application. Moreover, you are depriving your DBA of the same vital information. When the DBA monitors & tunes the system, he (or she) is less likely to recognize this kind of resource waste. The DBA will see a simple statement that uses an index , he is less likely to realize that this statement is executed in a loop unnecessarily.
    Beore using the "for all entries" clause and to evaluate the use of database views as a means to:
    a. simplify sql
    b. simplify abap code
    c. get around open sql limitations.
    check the links
    http://www.thespot4sap.com/articles/SAPABAPPerformanceTuning_ForAllEntries.asp
    The specified item was not found.
    Regards,
    Nagaraj

  • FOR ALL ENTRIES - CDHDR / CDPOS Tables

    Hi,
    I know there have been a lot of threads concerning the "for all entries" statement. Nevertheless I got a problem downloading the change document tables CDHDR/CDPOS with this statement and I haven't found anything in this forum regarding this special issue.
    While trying the for all entries statement in the below manner for downloading first CDHDR and then the CDPOS for all entries of the selected CDHDR it took 3 days and didn't finish, so we aborted the ABAP. The JOIN statement doesn't work in a 4.6c environment for the Cluster tables, hence this isn't an option.
    Can you give me some advise of how to improve downloading those tables in this way:
    1. Download CDHDR with limitation of fields OBJECTCLAS and UDATE
    2. Then Download CDPOS for all CHANGENR out of the first selection of CDHDR
    This was the way I tried it:
    SELECT
    ACT_CHNGNO  CHANGE_IND  CHANGENR  MANDANT  OBJECTCLAS  OBJECTID  PLANCHNGNR  TCODE  UDATE  USERNAME  UTIME  WAS_PLANND APPENDING CORRESPONDING FIELDS OF TABLE T_CDHDR FROM CDHDR WHERE UDATE IN  s_UDAT1 AND OBJECTCLAS IN  s_OBJE0.
    ENDSELECT.
    SELECT
    CHANGENR  CHNGIND  CUKY_NEW  CUKY_OLD  FNAME  MANDANT  OBJECTCLAS  OBJECTID  TABKEY  TABNAME  UNIT_NEW  UNIT_OLD  VALUE_NEW  VALUE_OLD INTO gs_CDPOS FROM CDPOS CLIENT SPECIFIED for all entries in  T_CDHDR WHERE OBJECTCLAS IN  s_OBJE2 AND MANDANT EQ  T_CDHDR-MANDANT AND OBJECTCLAS EQ  T_CDHDR-OBJECTCLAS AND CHANGENR EQ  T_CDHDR-CHANGENR.
    ENDSELECT.

    THis prg might b usefull to u
    *  Mass display or print Purchase Order History
    *  You can request report by :
    *  1.  Change date
    *  2.  User Name
    *  3.  Purchase Order Number
    *  4.  Vendor Code
    * Written by : SAP Basis, ABAP Programming and Other IMG Stuff
    *              http://www.sap-img.com
    REPORT ZPOCHANGE LINE-SIZE 132 NO STANDARD PAGE HEADING
                     LINE-COUNT 065(001)
                     MESSAGE-ID VR.
    TABLES: DD04T,
            CDHDR,
            CDPOS,
            DD03L,
            DD41V,
            T685T,
            VBPA,
            TPART,
            KONVC,
            EKKO.
    SELECT-OPTIONS: XUDATE FOR CDHDR-UDATE,
                    XNAME  FOR CDHDR-USERNAME,
                    XEBELN FOR EKKO-EBELN,
                    XLIFNR FOR EKKO-LIFNR.
    SELECTION-SCREEN SKIP.
    * TEXT-001 - Sorting Sequence
    SELECTION-SCREEN BEGIN OF BLOCK BLK1 WITH FRAME TITLE TEXT-001.
    PARAMETERS: SUDATE RADIOBUTTON GROUP R1,
                SNAME  RADIOBUTTON GROUP R1,
                SOBID  RADIOBUTTON GROUP R1.
    SELECTION-SCREEN END OF BLOCK BLK1.
    DATA: WFLAG,
          WCHANGENR LIKE CDHDR-CHANGENR.
    DATA: INDTEXT(60) TYPE C.
    DATA: BEGIN OF ICDHDR OCCURS 50.
            INCLUDE STRUCTURE CDHDR.
    DATA: END OF ICDHDR.
    DATA: BEGIN OF ICDSHW OCCURS 50.
            INCLUDE STRUCTURE CDSHW.
    DATA: END OF ICDSHW.
    DATA: BEGIN OF EKKEY,
            EBELN LIKE EKET-EBELN,
            EBELP LIKE EKET-EBELP,
            ETENR LIKE EKET-ETENR,
          END OF EKKEY.
    DATA: BEGIN OF ITAB OCCURS 50,
            BEGIN OF EKKEY,
              EBELN LIKE EKET-EBELN,
              EBELP LIKE EKET-EBELP,
              ETENR LIKE EKET-ETENR,
            END OF EKKEY,
            CHANGENR LIKE CDHDR-CHANGENR,
            UDATE    LIKE CDHDR-UDATE,
            UTIME    LIKE CDHDR-UTIME,
            USERNAME LIKE CDHDR-USERNAME,
            CHNGIND  LIKE CDSHW-CHNGIND,
            FTEXT    LIKE CDSHW-FTEXT,
            OUTLEN   LIKE CDSHW-OUTLEN,
            F_OLD    LIKE CDSHW-F_OLD,
            F_NEW    LIKE CDSHW-F_NEW,
          END OF ITAB.
    DATA: OLD_OBJECTID LIKE CDHDR-OBJECTID.
    FIELD-SYMBOLS: <F_OLD>, <F_NEW>.
    SELECT * FROM EKKO WHERE EBELN IN XEBELN AND
                             LIFNR IN XLIFNR.
      CLEAR CDHDR.
      CLEAR CDPOS.
      CDHDR-OBJECTCLAS = 'EINKBELEG'.
      CDHDR-OBJECTID   = EKKO-EBELN.
      PERFORM GETCHGDOCS.
    ENDSELECT.
    IF SUDATE = 'X'.
      SORT ITAB BY UDATE EKKEY-EBELN CHANGENR EKKEY-EBELP
                   EKKEY-ETENR.
    ELSEIF SNAME = 'X'.
      SORT ITAB BY USERNAME EKKEY-EBELN CHANGENR EKKEY-EBELP
                   EKKEY-ETENR.
    ELSE.
      SORT ITAB BY EKKEY-EBELN CHANGENR EKKEY-EBELP EKKEY-ETENR.
    ENDIF.
    LOOP AT ITAB.
      CLEAR: INDTEXT, EKKEY.
      CASE ITAB-CHNGIND.
        WHEN 'U'.
            INDTEXT(50) = ITAB-FTEXT.
            INDTEXT+51  = TEXT-020.
            CONDENSE INDTEXT.
        WHEN 'D'.
            INDTEXT = TEXT-021.
        WHEN 'E'.
            INDTEXT(5) = ITAB-FTEXT.
            INDTEXT+51 = TEXT-021.
            CONDENSE INDTEXT.
          WHEN 'I'.
            INDTEXT = TEXT-022.
        ENDCASE.
        RESERVE 4 LINES.
        IF WCHANGENR NE ITAB-CHANGENR.
          WCHANGENR = ITAB-CHANGENR.
          EKKEY = ITAB-EKKEY.
          WRITE:/ ITAB-UDATE UNDER 'Change Date',
                  ITAB-UTIME UNDER 'Time',
                  ITAB-USERNAME UNDER 'User Name',
                  ITAB-EKKEY-EBELN UNDER 'PO No',
                  ITAB-EKKEY-EBELP UNDER 'Item',
                  ITAB-EKKEY-ETENR UNDER 'Sch No',
                  INDTEXT     UNDER 'Changes'.
        ELSEIF ITAB-EKKEY NE EKKEY.
          WRITE:/ ITAB-EKKEY-EBELP UNDER 'Item',
                  ITAB-EKKEY-ETENR UNDER 'Sch No',
                  INDTEXT     UNDER 'Changes'.
        ENDIF.
        CASE ITAB-CHNGIND.
          WHEN 'U'.
            ASSIGN ITAB-F_OLD(ITAB-OUTLEN) TO <F_OLD>.
            ASSIGN ITAB-F_NEW(ITAB-OUTLEN) TO <F_NEW>.
            WRITE: / TEXT-023  UNDER 'Changes',
                     <F_OLD>.
            WRITE: / TEXT-024 UNDER 'Changes',
                     <F_NEW>.
          WHEN 'E'.
            ASSIGN ITAB-F_OLD(ITAB-OUTLEN) TO <F_OLD>.
            WRITE: TEXT-023 UNDER 'Changes',
                   <F_OLD>.
        ENDCASE.
        SKIP.
    ENDLOOP.
    TOP-OF-PAGE.
    WRITE:/ SY-DATUM,SY-UZEIT,
           50 'P U R C H A S E  O R D E R   H I S T O R Y',
          120 'Page', SY-PAGNO.
    WRITE: / SY-REPID,
             60 'Purchase Orders Changes'.
    SKIP.
    ULINE.
    IF SUDATE = 'X'.
      WRITE:/001 'Change Date',
             014 'Time',
             024 'User Name',
             038 'PO No',
             050 'Item',
             057 'Sch No',
             065 'Changes'.
    ELSEIF SOBID = 'X'.
      WRITE:/001 'PO No',
             013 'Item',
             020 'Sch No',
             028 'Change Date',
             041 'Time',
             051 'User Name',
             065 'Changes'.
    ELSE.
      WRITE:/001 'User Name',
             015 'Change Date',
             028 'Time',
             038 'PO No',
             050 'Item',
             057 'Sch No',
             065 'Changes'.
    ENDIF.
    ULINE.
    FORM GETCHGDOCS.
      CALL FUNCTION 'CHANGEDOCUMENT_READ_HEADERS'
           EXPORTING
                DATE_OF_CHANGE    = CDHDR-UDATE
                OBJECTCLASS       = CDHDR-OBJECTCLAS
                OBJECTID          = CDHDR-OBJECTID
                TIME_OF_CHANGE    = CDHDR-UTIME
                USERNAME          = CDHDR-USERNAME
           TABLES
                I_CDHDR           = ICDHDR
           EXCEPTIONS
                NO_POSITION_FOUND = 1
                OTHERS            = 2.
      CHECK SY-SUBRC EQ 0.
      DELETE ICDHDR WHERE CHANGE_IND EQ 'I'.
      CHECK NOT ICDHDR[] IS INITIAL.
      LOOP AT ICDHDR.
        CHECK ICDHDR-UDATE IN XUDATE.
        CHECK ICDHDR-USERNAME IN XNAME.
        CALL FUNCTION 'CHANGEDOCUMENT_READ_POSITIONS'
                     EXPORTING  CHANGENUMBER       = ICDHDR-CHANGENR
                     IMPORTING  HEADER             = CDHDR
                     TABLES     EDITPOS            = ICDSHW
                     EXCEPTIONS NO_POSITION_FOUND  = 1
                                OTHERS             = 2.
        CHECK SY-SUBRC EQ 0.
        LOOP AT ICDSHW.
          CHECK ICDSHW-TEXT_CASE EQ SPACE.
          MOVE-CORRESPONDING ICDSHW TO ITAB.
          MOVE-CORRESPONDING ICDHDR TO ITAB.
          MOVE ICDSHW-TABKEY+3 TO ITAB-EKKEY.
          APPEND ITAB.
        ENDLOOP.
      ENDLOOP.
    ENDFORM.
    * END OF PROGRAM

  • For all entries from 2 tables that have no common key

    Hello
    I have the next querry that i want to write in abap
    AUFK -
    >aufk-aufnr = afko- aufnr----> AFKO        
    AUFK---->aufk-pspel = afvc-projn -
    >AFVC      
    AFKO-----> afko-rsnum = resb-rsnum   -
    > RESB
    AFVC-----> afvc-aufpl = resb-aufpl       -
    > RESB
    AFVC-----> afvc-vornr = resb-vornr      -
    > RESB
    So that i have to start with AUFK and from there i read AFKO and AFVC  and with the entries from AFKO and AFVC i have to do a select on RESB.
    How can i do this
    select from RESB
    for all entries in AFKO
       where ...
    for all entries in AFVC
       where...  ?
    I do not have any common key between AFVC and AFKO. How can i select the correct entries from RESB?
    I have to mention that i have 1-1 entries for AUFK and AFKO
                                           and 1-N entries for AUFK and AFVC
    Thank you

    Why don't you use afko-aufpl = afvc-aufpl ?
    Regards,
    Raymond

  • How to use dynamic internal table with FOR ALL ENTRIES

    Hello SDNers,
    I am having a dynamic internal table & want to use FOR ALL ENTRIES(FAE) using this dyn. table.
    This works fine for me:
    IF <lt_tmp> IS NOT INITIAL. "<lt_tmp> is my dyn. internal table
            SELECT field1 field2
              FROM TABLE ztable
              INTO TABLE itab "Itab is a static table
              FOR ALL ENTRIES IN <lt_tmp>
              WHERE (lv_dynwhere). "lv_dynwhere -> dynamic where clause
          ENDIF.
    SAP documentation says:
    "The logical expression sql_cond of the WHERE condition can be comprised of several logical expressions using AND and OR. However, if FOR ALL ENTRIES is specified, there must be at least one comparison with a column of the internal table itab that can be specified statically or dynamically. "
    How do we specify the column of the internal table dynamically ? Can we do something like this:
    IF <lt_tmp> IS NOT INITIAL. "<lt_tmp> is my dyn. internal table
            SELECT field1 field2
              FROM TABLE
              INTO TABLE itab "Itab is a static table
              FOR ALL ENTRIES IN <lt_tmp>
              WHERE key_field1 = (dynamic token for column1 of <lt_tmp>)
                           key_field2 = (dynamic token for column2 of <lt_tmp>)
          ENDIF.
          ENDIF.
    Let me know if i am not clear about my requirement.
    BR,
    Suhas

    Hello Thomas,
    What i meant was something like this:
    WHERE key_field1 = ('<LT_TMP-COL1>') AND
          key_field2 = ('<LT_TMP-COL2>')
    I am confused by what SAP means with "dynamic representation of internal table columns" in FAE ?
    @Rob: I was referring to SAPNW 7.0 documentation & the phrase (release 6.40 & higher) is missing. Anyways fyi i am on ECC5.0 ABAP release 6.40.
    @Subhankar: This is what Marcin had proposed in For all entries and dynamic table.
    Thanks,
    Suhas
    Edited by: Suhas Saha on Apr 6, 2010 11:53 AM

  • For all entries query

    Hi,
    can we do a for all entries with a table type parameter.
    select * from <tablename> for all entries in <internal table> (importing parameter in an FM a table type parameter)....where <cond>

    go thrugh this and check dynamic select it may help you
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/840ad679-0601-0010-cd8e-9989fd650822#q-16">https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/840ad679-0601-0010-cd8e-9989fd650822#q-16</a>
    regards
    shiba dutta

  • Issue with FOR ALL ENTRIES

    Hi All,
    I have used FOR ALL ENTRIES statement in while selecting data based on some other internal table (to avoid select within loop).
    While using FOR ALL ENTRIES, the target table (internal table in which data is getting stored) is getting affected.
    The other fields are becoming zero and several rows gets delerted from the internal table after performing select query.
    How to avoid this bug?
    Kindly help me out....
    Regards
    Pavan

    hi after the for all entries statement did you used the read statement .
    if not you will not get any data ..check this program..
    tables:mara,marc.
    data:begin of itab occurs 0,
         matnr like mara-matnr,
         end of itab.
    data:begin of itab1 occurs 0,
         matnr like marc-matnr,
         werks like marc-werks,
         end of itab1.
    select   matnr
          from mara
          into corresponding fields of  table itab.
          if   itab is initial.
          select  matnr
                  werks
                 from marc
                 into  table itab1
                 for all entries in itab
                 where matnr = itab-matnr.
                 loop at itab1.
                 read table itab with key matnr = itab-matnr.
                 write:/ itab1-matnr,itab1-werks.
                 endloop.
                 endif.

  • 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.

  • How to use single buffered table with FOR ALL ENTRIES KEYWORD

    Hai,
    I'm Using TJ02T Database table, It is single buffered table but at the same time I want to use FOR ALL ENTRIES KEYWORD , Please Help me.
    Regards,
    S.Janani

    Hi,
    FOR ALL ENTRIES will not depend on the buffering nature of the table. The single buffered table will only only buffer one record into memory. You can still use the statement to query the values, but it may have performance problems if the data volume is high since the records are not completely buffered into memory, the time will spent in getting data from DB.
    Thanks..
    Preetham S

  • Max no of records in for all entries table

    Hello all,
    Hi have used for all entries in a select statement in BW extractor. This extractor is working fine for the test data. When i moved this code to pre-production for testing, there this extractor has to deal with thousands of records. In pre-prod , this select statement is not picking up all the records available in DB. Can any one give any idea on behavior of for all entries for large number of records. and is the any max limit for for all entries table.
    Thank you..correct answer will be rewarded.
    Regards
    Sravan

    Moderator message - Please search before asking and do not offer rewards (particularly since as far as I can see, you've awarded a total of two points in the last two years - post locked
    Rob

  • Using for all entries of two internal tables in where clause of the select

    Hi experts,
    My requirement is, need to select Marc-minbe and wrpl-sobst, for all the entries of the two internal tables it_mara , and it_t001w.
    here is the select queries i have used,
    select matnr normt from  mara into it_mara for all entries in it_data where normt = it_data-normt.
    select konnr werks from t001w into it_t001w for all entries in it_data where konnr = it_data-konnr.
    now i need to select minbe of marc table and sobse of wrpl table for all the entries of above internal tables, it_mara and it_t001w, using both matnr of it_mara and werks of it_t001w in where condition.
    Pls advise how i can do it.
    Thanks.
    Moderator message: very basic, please work on this yourself first, these forums are not a substitute for ABAP training.
    Edited by: Thomas Zloch on Dec 6, 2010 9:38 AM

    Hi
    call SE16 with table TFTIT in order to get a full list (it will be long...)
    A list of FMs with parameters can be found in table FUNCT.
    Finally go to sm37rsdf4
    that will give you all the function modules with description
    Here is the list:
    http://www.erpgenie.com/abap/functions.htm
    hope this helps...
    Regards
    CSM Reddy

  • Dynamic Select Query including Dynamic Tables with For all Entries

    Hello everyone,
    I need to create a select query which involves using of Dynamic Tables.
    Suppose I have a dynamic table <d1> which consist of let say 10 records.
    Now i need to make a select query putting data into another dynamic table <d2>
    CONCATENATE keyfield '=' '<d1>' INTO g_condition SEPARATED BY space.
    CONCATENATE g_condition '-' keyfield INTO g_condition.
    SELECT * FROM (wa_all_tables-name) INTO CORRESPONDING FIELDS OF TABLE <d1>
            FOR ALL ENTRIES IN <d1>
    WHERE (g_condition).
    But it is giving dump.
    Please help me on this....

    Short text
        A condition specified at runtime has an unexpected format.
    What happened?
        Error in the ABAP Application Program
        The current ABAP program "ZNG_CUSTOMWRITE" had to be terminated because it has
        come across a statement that unfortunately cannot be executed.
    Error analysis
        An exception occurred that is explained in detail below.
        The exception, which is assigned to class 'CX_SY_DYNAMIC_OSQL_SEMANTICS', was
         not caught in
        procedure "WRITE_ARCHIVE_PROD" "(FORM)", nor was it propagated by a RAISING
         clause.
        Since the caller of the procedure could not have anticipated that the
        exception would occur, the current program is terminated.
        The reason for the exception is:
        The current ABAP program has tried to execute an Open SQL statement
        which contains a WHERE, ON or HAVING condition with a dynamic part.
        The part of the WHERE, ON or HAVING condition specified at runtime in
        a field or an internal table, contains the invalid value "ZCOURIER-ZCOURIERID".
    CONCATENATE keyfield '=' g_header INTO g_condition SEPARATED BY space.
    CONCATENATE g_condition '-' keyfield INTO g_condition.
    SELECT * FROM (wa_all_tables-name) INTO CORRESPONDING FIELDS OF TABLE <dyn_table1>
    FOR ALL ENTRIES IN <dyn_table>
      WHERE (g_condition).

  • For all entries table handled by Tables parameter of Subroutine!

    Hi....
    See my code...
    Dont leave as it seems very big code... Actually its very small one...
    In sourse code of function module...
    data:itab1  type standard table of <local structure of top include> with header line,
                     itab2 type standrad table of knvp with header line.
    perform routine_data tables  itab1
                          using    p_var
    Subroutine code, saved in F include of that function group...
    form routine_data  tables itab1 type standard table
                               using    p_var
      select * from <db table>
                  into corresponding fields of table itab
                  where <keyfield> = p_var.
    endform.
    Back to source cod eof Function module..
    if sy-subrc is = 0.
        select parvw kunn2 kunnr from knvp
                            into corresponding fields of table itab2 for all entries in itab1
                             where kunnr = itab1-kunnr
                             and ( parvw = 'WE' or parvw = 'RE' or parvw = 'RG').
    endif.
    This code is working fine......
    ==================Now coming to my problem==========================
    In source code of function module...
    data:itab1  type standard table of <local structure of top include> with header line,
                     itab2 type standrad table of knvp with header line.
    perform routine_data tables  itab1
                                   using    p_var
    Subroutine code, saved in F include of that function group...
    form routine_data  tables itab1 type standard table
                               using    p_var
      select * from <db table>
                  into corresponding fields of table itab
                  where <keyfield> = p_var.
    endform.
    Function module source code...
    perform routine2_data tables itab1
                                     itab2.
    F include coding part for above subroutine....
    form routine2_data  tables itab1 type standard table
                                          itab2 type standard table
        select parvw kunn2 kunnr from knvp
                            into corresponding fields of table itab2 for all entries in itab1
                             where kunnr = itab1-kunnr                                         <-----causing error
                             and ( parvw = 'WE' or parvw = 'RE' or parvw = 'RG').
    endform.
    Giving error message....
    >>> The specified type has no structure and therefore no component called 'KUNNR".....
    So here the problem is there is a incorrect way to declare parameters....
    Plz remind that SUBROUTINES OF FUNCTION MODULES SAVING IN INCLUDE PROGRAMS, because they making some deffenrce with normal external subroutines...
    also...
    Here for all entries is mandatory!
    And Two sub routines are mandatory!
    Thanks for your attention...
    Naveen Inuganti.

    Hi ,
    Use the below  syntax to pass the tables as parameters
    *The below perform is in the source code of the F.M
    PERFORM goods_movement_post TABLES itab1
                                       itab2
                                       itab3
                                   USING ls_goodsmvt_header
                                         g_mov_code.
    suppose u are using the itab1 & itab2 tables data to get the itab3 Data 
    And The below code is in the Frms include
    FORM goods_movement_post
                      TABLES
                         pt_itab1 STRUCTURE vbak
                         pt_itab2 STRUCTURE vbap
                         pt_itab3 STRUCTURE bapiret2
                      USING
                         p_ls_goodsmvt_header STRUCTURE bapi2017_gm_head_01
                         p_g_mov_code.
    ENDFORM
    Thanks & Reagrds
    Mallikharjuna Reddy

  • FOR ALL ENTRIES IN with two tables

    Hi Guy's,
    I have two int. tables, gt_likp, gt_lips.
    I need to use "FOR ALL ENTRIES IN" with this two tables.
      SELECT matnr
             vkorg
             vtweg
             ypcogsl
        FROM mvke
        INTO TABLE gt_mvke
    <b>    "FOR ALL ENTRIES IN gt_likp gt_lips"</b>
        WHERE matnr = gwa_liefpos_tab-matnr
        AND vkorg = gt_likp-vkorg
        AND vtweg = gt_lips-vtweg.
    How to do this?
    Please Help.
    Thanks in Advance.

    Hi,
    Fill gt_likp-vkorg values in a range(r_vkorg). Use gt_lips in FOR ALL ENTRIES.
    Basically you can use only 1 internal table with FOR ALL ENTRIES statement.
    SELECT matnr
    vkorg
    vtweg
    ypcogsl
    FROM mvke
    INTO TABLE gt_mvke
    FOR ALL ENTRIES IN gt_lips
    WHERE matnr = gwa_liefpos_tab-matnr
    AND       vkorg in r_vkorg
    AND       vtweg = gt_lips-vtweg.
    - SRao

  • Join table SUM using for all entries

    Dear All,
                Will anyone pls. tell me what is the problem in this query, it is not working.
        SELECT aufnr SUM( menge )
         INTO CORRESPONDING FIELDS OF TABLE itab_aufnr
         FROM mkpf
         INNER JOIN mseg ON msegmblnr EQ mkpfmblnr AND mkpfmjahr EQ msegmjahr
         FOR ALL ENTRIES IN itab_rework
          WHERE mseg~aufnr = itab_rework-aufnr
          GROUP BY aufnr.
    Regards,
    Moderator message: please search for available information before asking, "it's not working" is not a proper error description.
    Edited by: Thomas Zloch on Dec 6, 2010 9:41 AM

    When I have used it in loop it is taking so much time to execute.
    That depends upon the amount of data you are processing and the set of codes written inside the loop. For sum you have to use collect statement or a SUM statement inside a control break statement.

Maybe you are looking for

  • Mac Book pro slow to wake from sleep

    Hi , Sometimes when I leave my mac book pro and it goes to sleep (screen goes black when lid open) it takes a while to wake from sleep again - sometimes up to 30-40 seconds? This seems very odd for an expensive machine that is around 6 months old and

  • Bootcamp trouble with new hardrive

    After i got a new harddrive, due to the defective harddrives in the 2009-11 iMacs and Apple had to exchange them free of charge, I've been having trouble installing bootcamp in my Windows 7. Everything went smoothly with the partitioning and the inst

  • I'm having trouble with Premiere Pro CC...

    I cannot use the timeline at all, I have tried everything that I can think of I have used older versions of Premiere.  I have just upgreaded from CS3 to the full service of creative cloud.  Help me please 

  • IPad - Export original size

    I am uploading my 10Mpx photos from the camera to the iPad. I then, flag the best shots, create a journal and export them to iTunes. But the photos get to the computer as 3Mpx instead of the original 10Mpx. Is this the correct workflow? How can I fix

  • ANNOUNCEMENT: Oracle XQuery Is Now in Beta

    As we are getting ready to roll out Oracle XQuery in the next production release of Oracle Database 10g, we have removed the outdated preview download from the OTN website. In the meantime, if you are interested in beta testing Oracle XQuery, please