Selecting from bseg misses dupicalte entry

Hi,
i select entries from bkpf/bseg as below:
  select bukrs belnr gjahr budat bldat waers
         into table lt_bkpf
         from bkpf
         where bukrs in s_bukrs
         and   blart in s_blart
         and   bldat in s_bldat
         and   budat in s_budat
  select bukrs belnr hkont wrbtr dmbtr shkzg vbund
         from bseg
         into table lt_bseg
         for all entries in lt_bkpf
         where bukrs =   lt_bkpf-bukrs
         and   belnr =   lt_bkpf-belnr
         and   gjahr =   lt_bkpf-gjahr
         and   hkont in  s_hkont.
this works fine except for a few docs which all have the same 'issue' where there is a duplicate WRBTR value in bseg. e.g.
BUKRS|BELNR|BUZEI|WRBTR|HKONT
1000|12345678|001|1000.00|7777
1000|12345678|002|1355.00|7777
1000|12345678|003|1000.00|7777
1000|12345678|004|9879.00|7777
my select statements output :
1000|12345678|001|1000.00|7777
1000|12345678|002|1355.00|7777
1000|12345678|004|9879.00|7777
Notice that item 3 is not found.
Note 416076 looks kind of related but we are on 470 and that is only for 4.6X.
Any ideas, as I am stumped?
thanks.

This is a trap when using the FOR ALL ENTRIES option on a select.  It is mentioned in the documentation of the command.  It is not related to indexes of the table.
FOR ALL ENTRIES has the same result as a SELECT DISTINCT -- duplicates are removed from the result set.
to get all entries that exist, make sure you specify ALL fields of the table primary key in the list of fields you retrieve.
so add the missing two fields to your internal table and modify your BSEG select to the following.
  select bukrs belnr GJAHR BUZEI hkont wrbtr dmbtr shkzg vbund
         from bseg
         into table lt_bseg
         for all entries in lt_bkpf
         where bukrs =   lt_bkpf-bukrs
         and   belnr =   lt_bkpf-belnr
         and   gjahr =   lt_bkpf-gjahr
         and   hkont in  s_hkont.
This will get all BSEG entries.
To prove this in DEV/Unit Test environment with less data available, try the following:
  select bukrs shkzg
         from bseg
         into table lt_bseg
         for all entries in lt_bkpf
         where bukrs =   lt_bkpf-bukrs
         and   belnr =   lt_bkpf-belnr
         and   gjahr =   lt_bkpf-gjahr
         and   hkont in  s_hkont.
Andrew

Similar Messages

  • Select From BSEG

    Hi
    The below mentioned piece of code is throwing a dump in Production system.
    Is there any way of alternate selection.
      IF NOT it_pos[] IS INITIAL.
        SELECT * FROM bseg INTO
                 TABLE it_bseg
                 FOR ALL ENTRIES  IN it_pos
                     WHERE  bukrs IN dd_bukrs
                     AND    belnr = it_pos-belnr
                     AND    gjahr = it_pos-gjahr.
      ENDIF.
    Regards
    Subin.S

    I think you need to post a few more details of the environment and error to assist people in offering solution.
    Questions I think of are:
    - What type of dump are you getting? - Out of Time? Out of Memory? Other?
    - How many entries are in internal table it_pos[] before the BSEG select starts?
    - How many entries are in BSEG approximately?
    - Do you need all the BSEG records to be selected into an internal table at once or can you process them in smaller sets?
    - Do you have a number of other large internal tables in your program?  Can any of these be cleared to free up memory?
    - can you run SQL trace (ST05) against the program to see the execution time for each fetch from BSEG and how many records each fetch returns?
    - why are you doing two selects from BSEG? What is the difference between them? normally better to get all the fields at the same time instead of selecting twice.
    - in Development or Test where there is less data, does tha program run OK?  If so, can you run it in SE30 to see what that transaction highlights as performance or similar issues?
    - what table or tables do you fill table it_pos[] from?  are there any duplicate records in this internal table?
    - what SAP version are you running?  32 bit or 64 bit?  What database?
    To solve an issue like this with a program these and probably dozens of other questions must be asked and answered - and as the person on the site you are the only one able to get the answers. 
    Posting more details will help forum readers to evaluate the issue in light of their experience and to provide further suggestions.  The more information you can give - the more likely that someone will be able to answer.
    thanks
    Andrew

  • Selection from bseg with year

    Hi,
    Iam trying to use bsak-budat with bseg-gjahr.But lengths are not same. I had offsetting with budat.But values are not matching...could any one tell me how to do that?
    points guaranteed
    cheers
    kaki
        select BUKRS LIFNR AUGDT AUGBL GJAHR BELNR  BUZEI BUDAT BLDAT
            CPUDT WAERS BLART BSCHL SHKZG DMBTR WRBTR SGTXT HKONT SKFBT
             from bsak
             into corresponding fields of table t_bsak
              where
              lifnr in s_lifnr and
              BUKRS in s_bukrs and
              budat le s_budat and                          augdt in s_augdt.
    loop at t_bsak.
      l_year = t_bsak-budat(4).
    endloop.
      CHECK NOT t_bsak[] IS INITIAL.
      select BUKRS LIFNR AUGDT AUGBL GJAHR BELNR
           SHKZG DMBTR WRBTR SGTXT SKFBT KOSTL BSCHL HKONT BUZEI
         into corresponding fields of table t_bseg from bseg
                FOR ALL ENTRIES IN t_bsak
                where belnr = t_bsak-belnr and
                      gjahr = l_year and        " xxxxxx
                      bukrs = t_bsak-bukrs.

    Define a field I_YEAR in int table T_BSAK.
    DATA Begin of t_BSAK,
    I_YEAR LIKE BSEG-GJAHR,
    end of t_bsak.
    loop at t_bsak.
    t_bsak-l_year = t_bsak-budat(4).
    modify t_bsak.
    endloop.
    Then
    select BUKRS LIFNR AUGDT AUGBL GJAHR BELNR
    SHKZG DMBTR WRBTR SGTXT SKFBT KOSTL BSCHL HKONT BUZEI
    into corresponding fields of table t_bseg from bseg
    FOR ALL ENTRIES IN t_bsak
    where belnr = t_bsak-belnr and
    gjahr = t_bsak-i_year and " xxxxxx
    bukrs = t_bsak-bukrs.
    Alternatively why not select gjahr from BSAK .
    Cheers .
    Sanjay

  • Selecting from bseg

    Abap Gurus,
    I am fetching belnr dmbtr buzei hkont from bseg
    for all entries from one table say 'TAB'
    where hkont = TAB-hkont
    and koart = 'S'.
    but in in the code inspector check it;s showing error
    The message is
    "Large table BSEG: No field of a table index in WHERE"
    How to optimize a fetch from a larger cluster table BSEG
    rewards if useful.
    Thanks in advance

    Hi,
         Alternatives to Reading BSEG (Accounting Document Segment).
    Since performance is an issue if reading data from BSEG table ( being a cluster table ), maybe you would
    consider using the tables:
              BSAD      Accounting     : Secondary Index for Customers (Cleared Items)
              BSAK      Accounting     : Secondary Index for Vendors (Cleared Items) 
              BSAS      Accounting     : Secondary Index for G/L Accounts (Cleared Items)
              BSID      Accounting     : Secondary Index for Customers
              BSIK      Accounting     : Secondary Index for Vendors    
              BSIS      Accounting     : Secondary Index for G/L Accounts
              instead of BSEG.
              It depends on what your program has to select (if you're only looking for customers
              you can use BSID and BSAD etc.)
              These are normal database tables, not clusters. Normally every record from BSEG
              can be found back in one of these 6 tables and a program which selects data from
              these tables runs faster than from BSEG.
    Reward points if helpful
    Thanks
    Shambhu

  • Selection from BSEG table

    Hi all
    In one of my program i have to use selection from BSEG by using non key fields like anln1, hkont  etc.
    My program run time taking too much time i.e 1.5 to 2hrs
    Is there any criteria to reduce my run time.
    plz help
    thks
    sateesh

    Hi
    If you need a select by field hkont (so G/L account) use the table BSIS (open item) and BSAS (cleared item)  instead of BSEG, just Eric said.
    SELECT * FROM BSAS WHERE BUKRS = BUKRS
                                              AND HKONT = HKONT.
       SELECT SINGLE * FROM BSEG WHERE BUKRS = BSAS-BUKRS
                                                              AND BELNR = BSAS-BELNR
                                                              AND GJAHR = BSAS-GJAHR
                                                              AND BUZEI  = BSAS-BUZEI.
             SELECT SINGLE * FROM BKPF WHERE BUKRS = BSAS-BUKRS
                                                                   AND BELNR = BSAS-BELNR
                                                                   AND GJAHR = BSAS-GJAH.
    Max
    Edited by: max bianchi on Nov 5, 2008 11:03 AM

  • Need to select from BSEG on Non Key fields.

    Hi all,
    I am developing a report on Work Order Cost Analysis. The selection screen has Order Type (AFPO-DAUAT), Plant (AFPO-DWERK), Date range (AFKO-GLTRI) and Part Number (AFKO-PLNBEZ) as the selection criteria. <b>All the orders and their corresponding object numbers (OBJNR) are picked in an internal table</b>, for all orders that fulfill the selection criteria and their Actual Finish Date (AFKO-GLTRI) falls between the entered date range.
    Now comes the problem, <b>corresponding to these Order Numbers I need to pick records from BSEG.</b> Since this is not a key field in BSEG, its not indexed and the report times out on the Development Server itself.
    <b>I also tried using COEP</b> table as the fields that I need are present there as well (Though I am not sure weather it would be give me all the lines of records that I need from BSEG), but that operation also times out.
    LDBs also don't seem to help. Is there any way I can achieve the above?
    <b>PLEASE HELP. REWARDS GUARANTEED.</b>
    Regards,
    Nikhil

    OK - a couple of things:
    In the select from covp, you are retrieving the CO document data not the FI document data, so you need the reference documents.
    Even though OBJNR is the first field of a key it will not be very selective. It would be better if you could specify more fields. Fortunately, some are standard and you can probably figure out what to use. If you can limit this to a single fiscal year, it would be best. Failing that, you should specify any (or all) fiscal years in a range table (using =).
    This is the select that I came up with:
    SELECT refbk refbn refgj refbz
           FROM  covp
           INTO  CORRESPONDING FIELDS OF TABLE it_covp
           FOR ALL ENTRIES IN it_worder
           WHERE lednr = '00'               "Standard ledger
           AND   objnr = it_worder-objnr
           AND   gjahr IN s_gjahr
           AND   wrttp = '04'               "Actuals
           AND   versn = '000'              "Plan/Actual ver.
           AND orgvg = 'RFBU'.              "FI Postings
    I filled s_gjahr with the individual years from 1995 to 2006 and it ran in under 20 minutes. (The first select was wide open and selected all.)
    Rob
    By the way - do you still need to go to BSEG, or can you get everything you need from COVP?
    Message was edited by: Rob Burbank

  • Performance Issue: Select From BSEG & BKPF

    Hi experts,
    Performance issue on the select statements; how can I improve the performance?
    Select Company Code (BUKRS)
    Accounting Document Number (BELNR)
                        Document Type (BLART)
                        Posting Date in the Document (BUDAT)
                        Document Status (BSTAT)
                        Reversal Document or Reversed Document Indicator (XREVERSAL)
               From Accounting Document Header (BKPF)
                 Into I_BKPF
             Where BKPF-BUKRS = I_VBAK-BUKRS_VF
           BKPF-BLART = ‘KI’
                        BKPF-BUDAT = SY-DATUM – 2 days
                        BKPF-BSTAT = Initial
                        BKPF-XREVERSAL <> ‘1’ or ‘2’
    Select Company Code (BUKRS)
                        Accounting Document Number (BELNR)
                        Assignment Number (ZUONR)
                        Sales Document (VBEL2)
                        Sales Document Item (POSN2)
                        P & L Statement Account Type (GVTYP)
                From Accounting Document Segment (BSEG)
                  Into I_BSEG
              Where BSEG-BUKRS = I_VBAK-BUKRS
            BSEG-VBELN = I_VBAK-VBEL2
            BSEG-POSN2 = I_VBAP-POSNR
                 BSEG-BELNR = I_BKPF-BELNR
                         P & L Statement Account Type (GVTYP) = ‘X’

    Hi,
    to improve the performance, you can use the secondary indices viz., BSIK / BSAK, BSID / BSAD, BSIS.
    Hope this helps.
    Best Regards, Murugesh AS

  • How to fetch data from bseg based  on 2 internal tables in 1 select query?

    hi,
    i have bukrs and belnr in one internal table and bukrs and vbeln in another internal table..now if i select from bseg twice using for all entries for fields bukrs vbeln and bukrs belnr twice in 2 select statements its fine..but since bseg is a huge table i want to use select only once..but the problem is that none of the belnrs in the one internal table will have vbeln in another internal table....ie if vbeln is selected from bseg based on belnr in 1 internal table non eof those vbeln will be equal to vbeln on another internal tables..in this scenario even if i take all data from two internal tables into 1 single internal table and then use for all entries on vbeln and belnr of that table ..but i think this will not work because and AND operator will not work because no record will satisfy both vbeln and belnr conditions..even if i use OR operator if the 1st condition satisfies the select clause will not enter into the second clause and all the records will not be fetched...Please help how should i tackle this..

    Hi vijaya,
    no simple select statement solution so far.
    As BSEG is a huge table you should try to get the full key values into another internal table first.
    SAP avoids direct selections from BSEG.
    Pleas consider the use of one of the secondary index tables first:
          BSAD : Accounting: Secondary Index for Customers (Cleared Items)
          BSAK : Accounting: Secondary Index for Vendors (Cleared Items)
          BSAS : Accounting: Secondary Index for G/L Accounts (Cleared Item
          BSEC : One-Time Account Data Document Segment
          BSEG : Accounting Document Segment
          BSID : Accounting: Secondary Index for Customers
          BSIK : Accounting: Secondary Index for Vendors
          BSIS : Accounting: Secondary Index for G/L Accounts
    you may include
          BKPF : Accounting Document Header
    for restrictions about time and document type.
    The last step is a FOR ALL ENTRIES selection from BSEG providing the full key values.
    Although you may have even more selects, the overall performance will be much better.
    Regards,
    Clemens

  • Query is too slow from bseg selection

    SELECT BELNR BLDAT BUDAT XBLNR GJAHR tcode WAERS AWKEY FROM BKPF INTO
      TABLE
      ITBKPF WHERE BUKRS EQ P_BUKRS AND BELNR IN S_BELNR AND BUDAT IN
        P_BUDAT
        AND STBLG = ''
        AND ( TCODE = 'MIRO' OR
                             TCODE = 'MR8M' OR
                             TCODE = 'MB11' OR
                             TCODE = 'MB1B' OR
                            TCODE = 'MIGO_GI' OR
                            TCODE = 'MIGO_TR' OR
                             TCODE = 'MB1A' ).
       IF SY-SUBRC EQ 0.
              SORT itBKPF.
            ELSE.
              MESSAGE 'No data for the relevant date' TYPE 'A'.
             LEAVE LIST-PROCESSING.
            ENDIF.
    SELECT A1LIFNR A1NAME1 A1ORT01 A1STRAS B1~j_1icstno
      INTO TABLE it_werks
      FROM ( LFA1 AS A1 INNER JOIN j_1imocomp AS B1 ON A1werks = B1werks )
    **********************************************this is too slow*************
    SELECT BUKRS BELNR GJAHR BUZEI BUZID BSCHL SHKZG GSBER MWSKZ
            DMBTR HKONT LIFNR LANDL Matnr werks MENGE EBELP xref3
            INTO CORRESPONDING FIELDS OF TABLE ITABBSEG
            FROM BSEG
            FOR ALL ENTRIES IN ITBKPF
            WHERE BELNR = ITBKPF-BELNR
            AND GJAHR = ITBKPF-GJAHR
            AND ( BSCHL = '86' OR BSCHL = '96' or BSCHL = '89' OR BSCHL = '99'  )
            AND WERKS IN S_WERKS
            AND BUZID <> 'F' .
    ****************************************this is too slow
    Moderator message: Please Read before Posting in the Performance and Tuning Forum
    locked by: Thomas Zloch on Aug 5, 2010 2:08 PM

    You should have provided the full key of the cluster file behind BSEG (RFBLG), every key is in BKPF, so add BUKRS
    SELECT bukrs belnr gjahr buzei buzid bschl shkzg gsber mwskz
           dmbtr hkont lifnr landl matnr werks menge ebelp xref3
      INTO CORRESPONDING FIELDS OF TABLE itabbseg
      FROM bseg
      FOR ALL ENTRIES IN itbkpf
      WHERE bukrs = itbkpf-bukrs
        AND belnr = itbkpf-belnr
        AND gjahr = itbkpf-gjahr
        AND ( bschl EQ '86' OR bschl EQ '96' OR bschl EQ '89' OR bschl EQ '99' )
        AND werks IN s_werks
        AND buzid EQ 'F' .
    You could also extract the whole accounting document in the internal table, and then delete record using the not-database-key selections.
    SELECT bukrs belnr gjahr buzei buzid bschl shkzg gsber mwskz
           dmbtr hkont lifnr landl matnr werks menge ebelp xref3
      INTO CORRESPONDING FIELDS OF TABLE itabbseg
      FROM bseg
      FOR ALL ENTRIES IN itbkpf
      WHERE bukrs = itbkpf-bukrs
        AND belnr = itbkpf-belnr
        AND gjahr = itbkpf-gjahr.
    DELETE itabbseg WHERE
      ( bschl NE '86' AND bschl NE '96' AND bschl NE '89' AND bschl NE '99' )
      OR NOT ( werks IN s_werks )
      OR BUZID NE 'F' .
    In both case, perform some tests with tools like SE30 or ST05.
    Regards,
    Raymond

  • Selecting from BKPF and BSEG

    Hi all,
    Can someone help me optimize the performance of this code as i don't know how else to select from BSEG as i cannot use a join coz its a cluster table. I need to find a way to improve the perfomance.Any help would be much appreciated.
    SELECT belnr gjahr bukrs budat stblg awkey blart
             FROM bkpf INTO CORRESPONDING FIELDS OF TABLE t_bkpf
             WHERE belnr IN s_belnr and
                   gjahr = p_gjahr  and
                   bukrs = p_bukrs.
      LOOP AT t_bkpf.
          SELECT belnr gjahr buzei ebeln ebelp
               wrbtr fipos geber fistl fkber
               augbl augdt shkzg
        INTO CORRESPONDING FIELDS OF table t_bseg
        FROM bseg
        WHERE belnr = t_bkpf-belnr
        AND   gjahr = t_bkpf-gjahr
        AND   bukrs = t_bkpf-bukrs.
    Thanks alot
    seema

    Hi Seema,
    You have to avoid the database retrival inside the loop.You can use for all entries.
    This is taken from a link.
    Some of the SAP tables are not transparant, but pooled or clustered. Be aware of this !
    There are a lot of limitations on how such tables can be accessed. You can not include such
    tables in database views and join constructs. The FI-GL table BSEG, which is one of our
    biggest PR1 tables, is an example of a clustered table. At the database-level, there is no table
    called BSEG, but instead RFBLG is being used for the BSEG data. Most of the fields known
    in BSEG are not known in the database table RFBLG, but are compressed in a VARDATA
    field of RFBLG. So tests in the WHERE clause of SELECTs agains BSEG are not used by
    the database (e.g. lifnr = vendor account number, hkont = G/L account, kostl = cost center).
    As a consequence, these tests are done after the facts similar to using the CHECK statement,
    and as already said in tip 1, CHECK statements are worse than tests in the WHERE-clause.
    Check this link also.
    How to Read BSEG Efficiently
    you'll never select table bkpf alone.
    alternatives:
    1) select with header information from bkpf
    2) use secondary index tables
    Re: Tuning cluster table selection
    3) use logical data base e.g.: BRF
    Hope this helps.If so,reward points.Otherwise, get back.

  • Abap query to select a line item # from bseg on basis of following pattern:

    Hello,
    I want to retrieve the line item # from bseg which has the following pattern,
    account type = S
    AND
    gl account starting from 135***** , 136***** , 137*****
    , 138***** , 139*****
    hope i am comprehendable. How do i go on writing the query,
    Thanks..
    Shehryar

    Hi Shehryar,
    This will fetch records with GL A/C starting with <b>13</b> only , if you want 14 and others also write sepearate conditions using <b>LIKE</b> statements.
    REPORT zztest.
    DATA : itab TYPE STANDARD TABLE OF bseg WITH HEADER LINE.
    SELECT * FROM bseg INTO TABLE itab WHERE <b>koart = 'S'
    AND
    hkont LIKE '13%'</b>.
    This will take a lot of DB time for fetching the records, try to include Key Fields(BUKRS and GJAHR .. if possible others).
    Regards,
    Arun Sambargi.
    Regards

  • Regarding Select data from *BSEG

    Hi Experts,
    I am studying the logic of an ABAP in which data has been fetched by a select statement like this
    SELECT * FROM *BSEG
    When i double clicked on *BSEG, system says *BSEG does not exist. Also, there is no table as *BSEG in ABAP dictionary.
    Please let me know what does *BSEG signifies and what it is ?
    Thanks in advance,
    Akash Sawant

    Hi Akash,
    If you declare *BSEG  means its acts as a structure for the corresponding DB table.
    Check this sample code,
    tables : mara, *mara.
    DATA : ITAB LIKE TABLE OF *MARA WITH HEADER LINE.
    SELECT * FROM *MARA INTO TABLE ITAB.
    LOOP AT ITAB.
    WRITE : ITAB-MATNR.
    ENDLOOP.
    Thanks,
    reward If Helpful.

  • Select ... for all entries problem

    Hi,
    I'm making select statements to BKPF and BSEG, but I can't do an inner join between this two table because BSEG it's a cluster table so I have to do a SELECT... FOR ALL ENTRIES, but in SE16 I make the same query that I have writen in my program as shown below,
    SELECT BUKRS BELNR GJAHR BUDAT MONAT
    FROM BKPF INTO CORRESPONDING FIELDS OF TABLE it_bkpf
    WHERE  BUKRS  = 'XXX'
    AND        GJAHR  = '2005'
    AND        BELNR  = '0000000250'. "just for proof
    AND        MONAT = '10'
    The above query returns me 1 row in program and in SE16 and then I make the next query for BSEG to do the join
    SELECT BUKRS BELNR GJAHR BSCHL SHKZG WRBTR HKONT
    FROM BSEG INTO CORRESPONDING FIELDS OF TABLE IT_BSEG
    FOR ALL ENTRIES IN it_bkpf
    WHERE bukrs = it_bkpf-bukrs
    and gjahr = it_bkpf-gjahr
    and belnr = it_bkpf-belnr.
    this query returns 897 rows and in SE16 this same query returns 901 rows
    Why SELECT...FOR ALL ENTRIES brings me less rows affected by the query in SE16
    Thanks for your help!!

    Hi,
      Please use the following code for selcting the exact number of rows.
    IF it_bkpf[] IS NOT INITIAL.
      SELECT *
      FROM BSEG INTO CORRESPONDING FIELDS OF   TABLE    IT_BSEG
    FOR ALL ENTRIES IN it_bkpf
    WHERE bukrs = it_bkpf-bukrs
    and gjahr = it_bkpf-gjahr
    and belnr = it_bkpf-belnr.
    ENDIF.
    Instead of * ,you can specify the exact fields required along with all the key fields as selection fields.Also it is must to check the condition it_bkpf[] IS NOT INITIAL before using the statement FOR ALL ENTRIES IN it_bkpf.Suppose if this condition is not used and if it_bkpf is initial,it will fetch all entries from the table.
    Reward if helpful.
    Regards,
    Aravind

  • Problem while selecting BELNR from BSEG

    Hi Experts,
    I have a report performance problem while fetching BELNR from BSEG table.
    I have to print latest BELNR from BSEG where BUZID = ‘M’ but at the time of execution of report, It is taking too much time (More that hour and sometimes it gets hanged).
    I have also gone through the comments provided by experts for previous problems asked in this forum e.g. BSEG is a cluster table that is why data retrieval takes long time etc.
    Can any one has any other idea or suggestion  or any other way to solve this problem
    Regards,
    Neeraj

    Hi,
    1) Try to create an index on BUZID field
    2) Don't use SELECT/ENDSELECT statement. Instead of that extract all the concerned entries from BSEG into an internal table :
    select belnr from bseg appending table itab where buzid = 'M'.
    then do this :
    sort itab by belnr.
    describe itab lines n.
    read table itab index n.
    Please reward if helpful.
    Regards,
    Nicolas.

  • Performance problem with selecting records from BSEG and KONV

    Hi,
    I am having performance problem while  selecting records from BSEG and KONV table. As these two tables have large amount of data , they are taking lot of time . Can anyone help me in improving the performance . Thanks in advance .
    Regards,
    Prashant

    Hi,
    Some steps to improve performance
    SOME STEPS USED TO IMPROVE UR PERFORMANCE:
    1. Avoid using SELECT...ENDSELECT... construct and use SELECT ... INTO TABLE.
    2. Use WHERE clause in your SELECT statement to restrict the volume of data retrieved.
    3. Design your Query to Use as much index fields as possible from left to right in your WHERE statement
    4. Use FOR ALL ENTRIES in your SELECT statement to retrieve the matching records at one shot.
    5. Avoid using nested SELECT statement SELECT within LOOPs.
    6. Avoid using INTO CORRESPONDING FIELDS OF TABLE. Instead use INTO TABLE.
    7. Avoid using SELECT * and Select only the required fields from the table.
    8. Avoid nested loops when working with large internal tables.
    9. Use assign instead of into in LOOPs for table types with large work areas
    10. When in doubt call transaction SE30 and use the examples and check your code
    11. Whenever using READ TABLE use BINARY SEARCH addition to speed up the search. Be sure to sort the internal table before binary search. This is a general thumb rule but typically if you are sure that the data in internal table is less than 200 entries you need not do SORT and use BINARY SEARCH since this is an overhead in performance.
    12. Use "CHECK" instead of IF/ENDIF whenever possible.
    13. Use "CASE" instead of IF/ENDIF whenever possible.
    14. Use "MOVE" with individual variable/field moves instead of "MOVE-
    CORRESPONDING" creates more coding but is more effcient.

Maybe you are looking for

  • Ios 8 photos app won't stop syncing

    Recently upgraded to an iPhone 6 and iOS 8.  When I open the Photos app, it always has a Syncing..... indicator at the bottom and won't stop.  I have tried disabling Photo Stream and iCloud photo albums and doing a hard restart.  I also deleted out m

  • HR-ABAP - By using PNPCE - LDB.

    hi, I want to add the fields values of table pa0033. The fields are (Aus01, Aus02,Aus03----Aus20). But these are character fields. kindly guide me.

  • Freight costs per PO

    Hi gurus, is it possible to automatically determine freight costs on header level of a PO? I can enter freight costs on item level (condition types FRA1, FRB1 etc.) and create condition records for them in info records. But on header level, none of t

  • Delete Constraint is displayed but record is still removed from the VO

    Scenario (ADF UIX Struts): I select a record in my table and then the delete button. In the Entity Object's doDML method I catch the database foreign key constraint violation and throw a new JboException with a user friendly message to display on my

  • Manage files on my ipod

    I bought a used 5th generation ipod classic.  I need a little help with managing the files.  I put audiobooks on it.  I change the media type to audiobook to seperate it out from the music.  When I have the ipod connected to iTunes, it shows up corre