For all entries.. with agregate functions....help

Hi ppl,
I want to put this select query outside loop using for all entries but it doesnt support group by neither aggregate funstions like sum.
its not giving correct results if i use collect or sum even using control break statements .
plz help..
LOOP AT T_UNITS.
    V_TABIX = SY-TABIX.
     get GLPCA postings
    SELECT AWTYP AWORG RACCT REFDOCNR SUM( HSL ) FROM GLPCA "1062
        INTO TABLE T_GLPCA
        WHERE RPRCTR = T_UNITS-UNIT
        AND   RACCT  IN S_HKONT
        AND   KOKRS = V_KOKRS
        AND   RYEAR = P_GJAHR
        AND   POPER  <= P_MONAT
        GROUP BY  AWTYP AWORG RACCT REFDOCNR.               "GK_166118
    SORT T_GLPCA BY AWTYP AWORG REFDOCNR.                   "1062
     process GLPCA postings
    LOOP AT T_GLPCA.
endloop.
some code
endloop.
thanks
Archana

... FOR ALL ENTRIES IN itab WHERE cond
Effect
Only selects the records that meet the logical condition cond when each replacement symbol itab-f is replaced with the value of component f of the internal table itab for at least one line of the table. SELECT ... FOR ALL ENTRIES IN itab WHERE cond returns the union of the solution sets of all SELECT statements that would result if you wrote a separate statement for each line of the internal table replacing the symbol itab-f with the corresponding value of component f in the WHERE condition.Duplicates are discarded from the result set. If the internal table itab does not contain any entries, the system treats the statement as though there were no WHERE cond condition, and selects all records (in the current client).
Example
Displaying the occupancy of flights on 28.02.2001:
TYPES: BEGIN OF ftab_type,
         carrid TYPE sflight-carrid,
         connid TYPE sflight-connid,
       END OF ftab_type.
DATA:  ftab TYPE STANDARD TABLE OF ftab_type WITH
                 NON-UNIQUE DEFAULT KEY INITIAL SIZE 10,
       free TYPE I,
       wa_sflight TYPE sflight.
Suppose FTAB is filled as follows:
CARRID  CONNID
LH      2415
SQ      0026
LH      0400
SELECT * FROM sflight INTO wa_sflight
    FOR ALL ENTRIES IN ftab
    WHERE CARRID = ftab-carrid AND
          CONNID = ftab-connid AND
          fldate = '20010228'.
  free = wa_sflight-seatsocc - wa_sflight-seatsmax.
  WRITE: / wa_sflight-carrid, wa_sflight-connid, free.
ENDSELECT.
The statement has the same effect as:
SELECT DISTINCT * FROM sflight INTO wa_sflight
    WHERE ( carrid = 'LH'   AND
            connid = '2415' AND
            fldate = '20010228' ) OR
          ( carrid = 'SQ'   AND
            connid = '0026' AND
            fldate = '20010228' ) OR
          ( carrid = 'LH'   AND
            connid = '0400' AND
            fldate = '20010228' ).
  free = wa_sflight-seatsocc - wa_sflight-seatsmax.
  WRITE: / wa_sflight-carrid, wa_sflight-connid, free.
ENDSELECT.
Notes
You can only use ... FOR ALL ENTRIES IN itab WHERE cond in a SELECT statement.
In the logical condition cond, the symbol itab-f is always a replacement symbol, and should not be confused with the component f of the header line of the internal table itab. The internal table itab does not need to have a header line.
Each component of the internal table that occurs in a replacement symbol in the WHERE condition must have exactly the same type and length as the corresponding component in the database table.
You cannot use replacement symbols in comparisons in LIKE, BETWEEN, or IN expressions.
If you use FOR ALL ENTRIES IN itab, you cannot use ORDER BY f1 ... fn in the ORDER-BY clause.
If you use FOR ALL ENTRIES IN itab, you cannot use a HAVING clause as well.
Sameer

Similar Messages

  • For all entries with 2 internal table

    HI experts.
    How to use  2 for all entries in a select statement.
    Below refer to my below code.
    select vbeln matnr lfimg vgbel posnr from lips into corresponding fields of table
      it_lips for all entries in  it_likp   where
                  vbeln = it_likp-vbeln and
                  matnr = it_mara-matnr.
    I want to add another for all entries it_mara.
    Please help me .Thanks in advanced.

    hi,
    it is possible....
    use this query...
    declare another internal table of the same type as it_lips.
    data : it_lips_final like it_lips.
    select vbeln matnr lfimg vgbel posnr from lips into corresponding fields of table
    it_lips for all entries in it_likp where
    vbeln = it_likp-vbeln .
    loop at it_lips.
      read table it_mara into it_mara with key matnr = it_lips-matnr.
      if sy-subrc = 0.
        append it_lips to it_lips_final.
      endif.
    endloop.
    refresh it_lips[].
    it_lips[] = it_lips_final[]
    what the above code does is selects all the entries of vbeln from lips and filters it in the loop reading it from mara checking for matnr value and finally
    all the entries according to your requirement is there in it_lips_final which we move it to it_lips again...
    this is something similar to writing a for all entries for 2 table.... but in another fashion
    Regards
    Siddarth

  • 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 with inner join

    Hi All,
    I found some unusual thing.
    i have written INNERJOIN along with FOR ALL ENTRIES and also INNERJOIN in loop..endloop. I have tested both programs with around 1000 records, i found that INNERJOIN with FOR ALL ENTRIES is taking more time compared to the other one. As we know FOR ALL ENTRIES with SIMPLE SELECT takes less time compared to select in loop..endloop. Anybody tell me is there any specific reason for this
    thanks in advance
    rajavardhana reddy

    Have a look at this weblog by Dharmaveer Singh:
    https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/2986 [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken]
    Sudha

  • Select For all entries with multiple keys

    Dear Developers,
    im writing a program which reads the last the last mseg entry with bwart 101 and bwart 201 an writes it into different fields of a table. In dependance of the bwart the max-value of mkpf-budat should be moved into field wedat or wadat.
    At the moment i use this coding:
    loop at gt_daten assigning <fs_daten>.
        select distinct max( budat ) from wb2_v_mkpf_mseg2 into <fs_daten>-wedat
          where matnr_i = <fs_daten>-matnr
            and werks_i = <fs_daten>-werks
            and lgort_i = <fs_daten>-lgort
            and bwart_i = '101'.
        select distinct max( budat ) from wb2_v_mkpf_mseg2 into <fs_daten>-wadat
        where matnr_i = <fs_daten>-matnr
          and werks_i = <fs_daten>-werks
          and lgort_i = <fs_daten>-lgort
          and bwart_i = '201'.
      endloop.
    wb2_v_mkpf_mseg2 is a view combining mkpf an mseg by primary keys.
    Searching the internet i read, using FOR ALL ENTRIES should be prefered to selectstatements in loops.
    So i tried:
    *selectstatement
    select budat matnr_i werks_i lgort_i bwart_i from wb2_v_mkpf_mseg2 into table lt_mseg for all entries in gt_daten
        where matnr_i = gt_daten-matnr
          and werks_i = gt_daten-werks
          and lgort_i = gt_daten-lgort
          and ( bwart_i = '101' or bwart_i = '201' )
    *Substitute the MAX( )-Function
      sort lt_mseg descending by matnr werks lgort bwart budat.
      delete adjacent duplicates from lt_mseg comparing matnr werks lgort bwart.
    *Differ between wedat and wadat
      loop at gt_daten assigning <fs_daten>.
        loop at lt_mseg assigning <fs_mseg>
          where matnr = <fs_daten>-matnr
            and werks = <fs_daten>-werks
            and lgort = <fs_daten>-lgort.
          case <fs_mseg>-bwart.
            when '101'.
              <fs_daten>-wedat = <fs_mseg>-budat.
            when '201'.
              <fs_daten>-wadat = <fs_mseg>-budat.
          endcase.
        endloop.
    Even in the dev-system this takes twice the time of the "nested" selects.
    Imho this is because of the internal OR interpretation of the FOR ALL ENTRIES-statement and the size of the result.
    Can somebody give me a hint, how to tune this code?
    Select Inner join should be difficult because the target field differs, dependent of the value in bwart...
    Thanks in advance!

    I understand that you are trying to capture the maximum value of posting date MKPF-BUDAT for movement types 101 and 201 for each combination of material, plant and storage location.
    Few things, that makes the below coding more efficient at both application and database level and I confirmed this on an IDES sandbox
    1. Along with MKPF and MSEG, there is another table WBGT, in the view WB2_V_MKPF_MSEG join and also WBGT has select condition restrictions imposed on its fields. So if this restriction impacts your selection you may want to do a INNER JOIN of MSEG with MKPF only (with MSEG as leading table, as it has an active secondary index with MATNR, WERKS, LGORT and BWART ) and also there won't be overhead from the unnecessary join with WBGT table whose fields you are not using.
    2. The below SORT on lt_mseg will ensure that the record having greatest BUDAT will be at the top of all rows (least index) for each combination of MATNR, WERKS, LGORT and BWART.
    3. DELETE ADJACENT DUPLICATES will ensure that only the top row (having greatest BUDAT) remains in the table lt_mseg for each combination of MATNR, WERKS, LGORT and BWART. This will ensure that subsequent READs with BINARY SEARCH will always and efficiently read the row with maximum value of BUDAT for each unique combination of MATNR, WERKS, LGORT and BWART.
    4. The below logic will require more memory (even though it is more efficient performance wise) compared to direct SELECT with MAX for each MATNR, WERKS, LGORT and BWART in a LOOP the way you were doing before. So if the size of lt_mseg is causing memory issues, your logic with aggregate function MAX at database level will be your only option.
    So, I propose you revise your coding like below for most optimal results
    CHECK NOT gt_daten[] IS INITIAL.
    *selectstatement
    *SELECT budat matnr_i werks_i lgort_i bwart_i
    *  FROM wb2_v_mkpf_mseg2
    *  INTO TABLE lt_mseg
    *    FOR ALL ENTRIES IN gt_daten
    *    WHERE matnr_i = gt_daten-matnr
    *      AND werks_i = gt_daten-werks
    *      AND lgort_i = gt_daten-lgort
    *      AND ( bwart_i = '101' OR bwart_i = '201' ).
    * The below SELECT is more economical than the one commented above
    SELECT mkpf~budat mseg~matnr mseg~werks mseg~lgort mseg~bwart
      FROM mseg INNER JOIN mkpf
        ON mseg~mblnr = mkpf~mblnr AND
           mseg~mjahr = mkpf~mjahr
        INTO TABLE lt_mseg
          FOR ALL ENTRIES IN gt_daten
            WHERE mseg~matnr = gt_daten-matnr
              AND mseg~werks = gt_daten-werks
              AND mseg~lgort = gt_daten-lgort
              AND ( mseg~bwart = '101' OR mseg~bwart = '201' ).
    *Substitute the MAX( )-Function
    SORT lt_mseg BY matnr werks lgort bwart DESCENDING budat.
    DELETE ADJACENT DUPLICATES FROM lt_mseg COMPARING matnr werks lgort bwart.
    *Differ between wedat and wadat
    LOOP AT gt_daten ASSIGNING <fs_daten>.
      READ TABLE lt_mseg ASSIGNING <fs_mseg>
        WITH KEY matnr = <fs_daten>-matnr
                 werks = <fs_daten>-werks
                 lgort = <fs_daten>-lgort
                 bwart = '101' BINARY SEARCH.
      IF sy-subrc = 0.
        <fs_daten>-wedat = <fs_mseg>-budat.
      ENDIF.
      READ TABLE lt_mseg ASSIGNING <fs_mseg>
        WITH KEY matnr = <fs_daten>-matnr
                 werks = <fs_daten>-werks
                 lgort = <fs_daten>-lgort
                 bwart = '201' BINARY SEARCH.
      IF sy-subrc = 0.
        <fs_daten>-wadat = <fs_mseg>-budat.
      ENDIF.
    ENDLOOP.

  • Inner join and select for all entries with respect to performance

    Hi Friends,
    I just want to know which is more efficient with respect to performance the Inner join or select for all entries?which is more efficient? and how? can you explain me in detail ?
    Regards,
    Dinesh

    INNER JOIN->
    The data that can be selected with a view depends primarily on whether the view implements an inner join or an outer join. With an inner join, you only get the records of the cross-product for which there is an entry in all tables used in the view. With an outer join, records are also selected for which there is no entry in some of the tables used in the view.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21ec77446011d189700000e8322d00/content.htm
    FOR ALL ENTRIES->
    Outer join can be created using this addition to the where clause in a select statement. It speeds up the performance tremendously, but the cons of using this variation are listed below
    Duplicates are automatically removed from the resulting data set. Hence care should be taken that the unique key of the detail line items should be given in the select statement.
    If the table on which the For All Entries IN clause is based is empty, all rows are selected into the destination table. Hence it is advisable to check before-hand that the first table is not empty.
    If the table on which the For All Entries IN clause is based is very large, the performance will go down instead of improving. Hence attempt should be made to keep the table size to a moderate level.
    Not Recommended
    Loop at int_cntry.
    Select single * from zfligh into int_fligh
    where cntry = int_cntry-cntry.
    Append int_fligh.
    Endloop.
    Recommended
    Select * from zfligh appending table int_fligh
    For all entries in int_cntry
    Where cntry = int_cntry-cntry.

  • VBAK,VBRP,VBRK for all entries on I_VRPMA:Please help

    Hi,
    I need to join 3 tables VBRK,VBAK,VBRP Tables.Actually to improve the performance first i retrieved matnr and belnr(billing records) from VRPMA Table into I_VRPMA where s_vkorg,s_fkdat,s_fkart.(selection screen)
    Now i need to fetch billing records from vbrk join with vbrp and join with vbak tables into internal table I_VBRP for all records fetched from I_VRPMA with billing documents.
    Key Fields are:sales doc order type-AUART. To join VBRP with VBAK i am using VBRP-AUBEL = VBAK = VBELN.
    Fields which will transfer from VBAK are AUART,AUDAT,and AUGRU
    Fields which will transfer from VBRK are: FKART,FKDAT,WAERK.
    Fields which will tansfer from VBRP are: VBELN,POSNR,FKIMG,VRKME,MEINS,UMVKZ,WAVWR
    Please help me how can i write inner join on this one.
    Thanks
    Shakeer

    Shakeer,
    I believe it is OK to use VRPMA table as it has VKORG, FKDAT etc in your key which matches your selection-screen.
    Select vbeln posnr F2 F3 AUBEL from vbrp into table lt_vbrp
                                          for all entries in VRPMA
                                          where vbeln = VRPMA-vbeln
                                           and posnr = VRPMA-posnr.
    select * from vbfa into table lt_vbfa
                         for all entries in lt_vbrp
                         where vbelv = lt_vbrp-aubel
                               and vbeln = lt_vbrp-vbeln
                               and vbtyp_n in ( 'M', 'N', 'O' ....billing types you are using) .
    lt_vbfa is a combined table having active links with vbelv as sales order and vbeln as billing docs.
    Add more conditions wherever possible for your case.
    Regards,
    Diwakar

  • 2 for all entries with different condition

    Hi
    i have an internal 2 internal table which have the following field
    ITAB1 : Stock category, plant, storage location , SKU code   (those value are given though flat file)
    ITAB2 : Grid value , meterial NO, SKU code  (those values are determine through a FM where we export the SKU code and it will retreive the matnr and grid value in an ITAB2)
    I have to do select FROM database MCHB
    with the condition Grid value , material NO , Stock category, plant, storage location
    Note that gris value and matnr are found in two different internal table i was thinking of doing for all entries but
    is it possible to do for all entries from 2 internal table
    SELECT FOROM MCHB
    FOR ALL ENTRIES in ITAB1
    FOR ALL ENTRIES in ITAB2
    WHERE
    grid value = itab2-gridvalue
    matnr = itab2-matnr
    stock cat = itab1-stock cat
    plant = itab1-plant
    storage location = itab1-storage location
    Please help on how to tackle this?

    Hi,
    You have to create a new third internal table with the fields matnr, grid value, stock category, plant and storage location....
    Then process the itab1 and get the process the itab2 for the corresponding SKU Code (which I believe is the common field for both of the internal tables) and then populate the third internal table itab3...
    Then use the itab3 for the FOR ALL ENTRIES.
    Thanks
    Naren

  • Want to Avoid Loop for all entries with select query !!

    Hi Guru's  !
    This is my following code . I want to avoid loop  to improve the performance of program.
    data: lt_cuhd type HASHED TABLE OF /sapsll/cuhd WITH UNIQUE key guid_cuhd,
          ls_cuhd type /sapsll/cuhd.
    data: lt_comments type STANDARD TABLE OF zss_comments,
          ls_comments type zss_comments.
    data: lv_objkey type string.
    select * from /sapsll/cuhd into table lt_cuhd.
    loop at lt_cuhd  into ls_cuhd.
      CONCATENATE ls_cuhd-corder '%' into lv_objkey. " Example 'Mum%'
      select * from zss_comments into table lt_comments
                where objkey like lv_objkey
                 AND guid_cuhd = ls_cuhd-guid_cuhd
                  AND event_id <> ''.
    endloop.
    I want
    New code should be...using all entries no loop required.
      *select * from zss_comments into table lt_comments
                where objkey like lv_objkey
                 AND guid_cuhd = ls_cuhd-guid_cuhd
                  AND event_id <> ''.*

    why dont you add the object key also to  lt_cuhd and once you fetch the data to lt_cuhd loop it and add the '%'
    when looping use field symbols so that you dont have to use  modify.
    then use for all entries using lt_cuhd
    i don't you can find a better way to add the % mark apart from looping but by this way only one select query will be done for
    zss_comments
    Thanks
    Nafran

  • Inner join and select for all entries with respect to performance in SAP

    Hi Friends,
    I just want to know which is more efficient with respect to performance the Inner join or select for all entries?which is more efficient?
    Regards,
    Dinesh

    I did some testing a while ago and found that a JOIN is usually a bit more efficient than FOR ALL ENTRIES. This wasn't always the case though, so the best thing to do is to write it both ways and see which is faster.
    Rob

  • For all entries with large sets

    Hello All,
    Does for all entries have restriction that the itab should not exceed the maximum entries? Look at code below:
      select pernr raufpl raplzl catshours
             from catsdb
             into corresponding fields of table lit_catshrs
             for all entries in itab
             where pernr = itab-pernr
               and status in ('10', '20', '30')
               and workdate in s_date.
    if itab have 7000 entries in production system, will the select statement cause a short dump such as DBIF_RSQL_INVALID_RSQL?
    Thanks,
    Alex M

    Hi,
    check the sequence of the fields in the internal table lit_catshrs
    Because RSQL error occurs because of this.
    and Whenevr you use for all entries of some Internal Table it is a must to check that
    IF not ITAB[] Is initial.
    < write the select>
    endif.
    Other performance related thing w.r.t to ABAP are
    1) Dont use nested seelct statement
    2) If possible use for all entries in addition
    3) In the where addition make sure you give all the primary key
    4) Use Index for the selection criteria.
    5) You can also use inner joins
    6) You can try to put the data from the first select statement into an Itab and then in order to select the data from the second table use for all entries in.
    7) Use the runtime analysis SE30 and SQL Trace (ST05) to identify the performance and also to identify where the load is heavy, so that you can change the code accordingly
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/5d0db4c9-0e01-0010-b68f-9b1408d5f234
    reward if useful
    regards,
    Anji

  • FOR ALL ENTRIES... with FIELD SYMBOL

    Is it possible to use FOR ALL ENTRIES with a FIELD-SYMBOL that points to a data reference of type STANDARD TABLE ?
    I have the following:
      SELECT * FROM mara
        INTO TABLE table
        FOR ALL ENTRIES IN another_table
        WHERE matnr EQ another_table-matnr.
    The code above is what exists, (working), but I'm improving the program and one of the improvements is to allow dynamic querying by providing a field symbol instead of a hard-coded table like "another_table". But I get the message "the specified type has no structure and therefore no component called "MATNR".
    My code just have the field symbol that points to a previously data reference created for a table passed as a parameter (this is working, having checked via debugging) replacing "another_table" and <fs>-matnr instead of "another_table-matnr".
    What solutions would you guys suggest ?
    Thanks
    Avraham

    Why is that that the commented line doesn't work, but under debugging I can reach <ls_items>-matnr ?
    Everything is fine with <lt_items>, it contains 8 lines, and debugging shows <ls_items> receiving one line each loop pass, just as expected. I wanted to understand why/when does this error of "has no structure therefore there is no component"... appears.
    LOOP AT <lt_items> INTO <ls_items>.
    *    SELECT SINGLE * INTO ls_mara FROM mara WHERE mara~matnr = <ls_items>-matnr.
        IF sy-subrc = 0.
          APPEND ls_mara TO lt_mara.
        ENDIF.
      ENDLOOP.

  • Using delete and FOR ALL ENTRIES

    Hi,
    We have a error message regarding the following code :
    Delete FROM TABLE FOR ALL ENTRIES IN lt_TABLE WHERE
    TABLE_KEY1  = LT_TABLE_KEY1
    Could we use the For All entries with "Select" ?
    For information, the error message is "Unable to interpret "FOR". Possible causes: Incorrect spelling or comma error.
    Thank you.

    Hi,
    Check the below syntax, if you want to delete from database
    DELETE FROM sflight
    WHERE  carrid = p_carrid AND
           fldate = sy-datum AND
           seatsocc = 0.
    Just a suggestion. May be from next time you can use F1 help for syntax:
    1. Place the cursor on the delete keword in your program and press F1 - You willl get all the possible syntax for delete statement
    2. Else open the transaction ABAPDOCU, Click Keyword Help, Enter the required keyword(delete in this case) and press cont.. You will get the syntax.
    Hope thsi will help you.
    Regards,
    Swarna Munukoti.

  • 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

  • Offset in where clause of for all entries

    Hi ,
    I need to fetch VBELN from VBKD table based on Purchase order no which is fetched from a Z-table.So I am using for all entries with where condition as VBKD-BSTKD_M = Ztable-PONumber  and fetching values from VBKD .But at times PO number in VBKD table can have additional things attached to it .
    Eg Ztable-PO number = 12345678 , VBKD-BSTKD_M = 12345678-001 so I need to ignore the '-001' part and still fetch data from VBKD.So how can I do that.
    Pls let me know if you have any ideas.
    Thanks in advance,
    Rajasekaran

    Hi ,
    We cannot use offset directly in where as it will result in syntax error as the field length for both fields have to match .In my case the length of both Ztable -PO number field and vbkd-bstkd_m are 35 characters.So cannot use offset directly in where clause of for all entries.
    Pls let me know if you have any other ideas.
    Thanks in advance,
    Rajsekaran

Maybe you are looking for

  • Problem with JavaScript in my PDF Form buttons

    I am trying to have my user click on a button in my form on my website and e-mail the form data to me. I am using the following JavaScript with my form button: this.mailForm(false, "[email protected]", "", "", "Subject", "Message Body"); Protected mo

  • Activites can't be deleted

    Hello SAP gurus, Could you please help me with following problem: we need to enable activities deletion in CRM 2007, but we can't delete some activities. (not all) and we are not able to find any criteria what activities can't be deleted. Could you g

  • Persistent HDTV Settings?

    I have an old macbook C2D connected to an HDTV via a Mini DVI-HDMI adapter. I'm trying to use it in mirror mode. In order to make that happen, I have to do the following: 1. Turn on the TV 2. Run "Detect Displays" After running "Detect Displays" the

  • JVM crash upon webapp deployment to WebLogic 9.1

    I have been tasked with taking a web application that has been working under WebLogic 6.1 and getting it to compile and run under WebLogic 9.1 (using Sun JDK/JRE 1.5). I resolved a few compile problems in Java sources (and commented out a few lines o

  • Cannot Create A New Project In imovie

    When i want to create a new project in I movie, i cant because it says "Please check the disk to esure there is enough free space and you have permission to write projects" ive got plenty of space so what is the problem??? please help!!!!!!!!!!!!