OO ABAP + Performance

Hi all…
I have recently started working in an organization as an ABAP programmer. Earlier, as part of my curriculum, I have designed a couple of systems using UML and coded the same in JAVA. Having worked on OO systems, I have a few questions to ask about ABAP and Web AS.
1) Does a company implementing SAP 6.0/ECC 6 have to decide in advance whether it will be coding its business logic/applications in JAVA or ABAP? Or Wes AS can process both languages once installed.
2) If a program is written in OO ABAP as well as in JAVA for a given business scenario (using the same OO (UML) structure) and executed on a Web AS, which one will perform better? Why?
3) Why is it that organizations, in spite of the visible benefits of OO programming, are unwilling to let go of procedural ABAP and adapt OO ABAP? Anyways, they don’t have to convert their existing code but just to begin any new development using OO concepts. Is it because programs written in ABAP are usually not that complex to be modeled in OO concepts or there are not many people who know both ABAP and OO concepts.
Regards,
Anoop Sahu

1) If a company is implementing ECC, it is all written in ABAP.  THe R/3(ECC) backend system is comprised entirely in ABAP,  so there is no decision,  if you want to develop an application in ECC(R/3), you use ABAP.  If you want to develop a java based application to access the ECC backend, you may do so using tools like jCo and JCA, and the webdynpro java environment supplies tools for you to access the backend.  You can not directly access the ABAP backend data/tables from a java application, you must use the data access tools mentioned.  Of course you need the java add on, or a standalone java application server to do this.
3)  A lot of shops are used to the procedural ABAP model and have not yet had a need to implement an application using OO concepts,  there are advantages, but an application does not have to use it.  In some cases, it is a better way to go, but really it is all about the design,  using ABAP OO is really not worth it without a good design.  It is advantagious for ABAPers to imbraced ABAP OO concepts as this will be the design paradigm of future developments in ECC. In order to understand how a standard program works, they will need to know OO concepts.
Regards,
Rich Heilman

Similar Messages

  • ABAP Performance standards good piece

    ABAP Performance Standards
    Following are the performance standards need to be following in writing ABAP programs:
    <b>1. Unused/Dead code</b>
    Avoid leaving unused code in the program. Either comment out or delete the unused situation. Use program --> check --> extended program to check for the variables, which are not used statically.
    <b>2. Subroutine Usage</b>
    For good modularization, the decision of whether or not to execute a subroutine should be made before the subroutine is called. For example:
    This is better:
    IF f1 NE 0.
    PERFORM sub1.
    ENDIF.
    FORM sub1.
    ENDFORM.
    Than this:
    PERFORM sub1.
    FORM sub1.
    IF f1 NE 0.
    ENDIF.
    ENDFORM.
    <b>3. Usage of IF statements</b>
    When coding IF tests, nest the testing conditions so that the outer conditions are those which are most likely to fail. For logical expressions with AND , place the mostly likely false first and for the OR, place the mostly likely true first.
    Example - nested IF's:
    IF (least likely to be true).
    IF (less likely to be true).
    IF (most likely to be true).
    ENDIF.
    ENDIF.
    ENDIF.
    Example - IF...ELSEIF...ENDIF :
    IF (most likely to be true).
    ELSEIF (less likely to be true).
    ELSEIF (least likely to be true).
    ENDIF.
    Example - AND:
    IF (least likely to be true) AND
    (most likely to be true).
    ENDIF.
    Example - OR:
    IF (most likely to be true) OR
    (least likely to be true).
    <b>4. CASE vs. nested Ifs</b>
    When testing fields "equal to" something, one can use either the nested IF or the CASE statement. The CASE is better for two reasons. It is easier to read and after about five nested IFs the performance of the CASE is more efficient.
    <b>5. MOVE statements</b>
    When records a and b have the exact same structure, it is more efficient to MOVE a TO b than to MOVE-CORRESPONDING a TO b.
    MOVE BSEG TO *BSEG.
    is better than
    MOVE-CORRESPONDING BSEG TO *BSEG.
    <b>6. SELECT and SELECT SINGLE</b>
    When using the SELECT statement, study the key and always provide as much of the left-most part of the key as possible. If the entire key can be qualified, code a SELECT SINGLE not just a SELECT. If you are only interested in the first row or there is only one row to be returned, using SELECT SINGLE can increase performance by up to three times.
    <b>7. Small internal tables vs. complete internal tables</b>
    In general it is better to minimize the number of fields declared in an internal table. While it may be convenient to declare an internal table using the LIKE command, in most cases, programs will not use all fields in the SAP standard table.
    For example:
    Instead of this:
    data: t_mara like mara occurs 0 with header line.
    Use this:
    data: begin of t_mara occurs 0,
    matnr like mara-matnr,
    end of t_mara.
    <b>8. Row-level processing and SELECT SINGLE</b>
    Similar to the processing of a SELECT-ENDSELECT loop, when calling multiple SELECT-SINGLE commands on a non-buffered table (check Data Dictionary -> Technical Info), you should do the following to improve performance:
    o Use the SELECT into <itab> to buffer the necessary rows in an internal table, then
    o sort the rows by the key fields, then
    o use a READ TABLE WITH KEY ... BINARY SEARCH in place of the SELECT SINGLE command. Note that this only make sense when the table you are buffering is not too large (this decision must be made on a case by case basis).
    <b>9. READing single records of internal tables</b>
    When reading a single record in an internal table, the READ TABLE WITH KEY is not a direct READ. This means that if the data is not sorted according to the key, the system must sequentially read the table. Therefore, you should:
    o SORT the table
    o use READ TABLE WITH KEY BINARY SEARCH for better performance.
    <b>10. SORTing internal tables</b>
    When SORTing internal tables, specify the fields to SORTed.
    SORT ITAB BY FLD1 FLD2.
    is more efficient than
    SORT ITAB.
    <b>11. Number of entries in an internal table</b>
    To find out how many entries are in an internal table use DESCRIBE.
    DESCRIBE TABLE ITAB LINES CNTLNS.
    is more efficient than
    LOOP AT ITAB.
    CNTLNS = CNTLNS + 1.
    ENDLOOP.
    <b>12. Performance diagnosis</b>
    To diagnose performance problems, it is recommended to use the SAP transaction SE30, ABAP/4 Runtime Analysis. The utility allows statistical analysis of transactions and programs.
    <b>13. Nested SELECTs versus table views</b>
    Since releASE 4.0, OPEN SQL allows both inner and outer table joins. A nested SELECT loop may be used to accomplish the same concept. However, the performance of nested SELECT loops is very poor in comparison to a join. Hence, to improve performance by a factor of 25x and reduce network load, you should either create a view in the data dictionary then use this view to select data, or code the select using a join.
    <b>14. If nested SELECTs must be used</b>
    As mentioned previously, performance can be dramatically improved by using views instead of nested SELECTs, however, if this is not possible, then the following example of using an internal table in a nested SELECT can also improve performance by a factor of 5x:
    Use this:
    form select_good.
    data: t_vbak like vbak occurs 0 with header line.
    data: t_vbap like vbap occurs 0 with header line.
    select * from vbak into table t_vbak up to 200 rows.
    select * from vbap
    for all entries in t_vbak
    where vbeln = t_vbak-vbeln.
    endselect.
    endform.
    Instead of this:
    form select_bad.
    select * from vbak up to 200 rows.
    select * from vbap where vbeln = vbak-vbeln.
    endselect.
    endselect.
    endform.
    Although using "SELECT...FOR ALL ENTRIES IN..." is generally very fast, you should be aware of the three pitfalls of using it:
    Firstly, SAP automatically removes any duplicates from the rest of the retrieved records. Therefore, if you wish to ensure that no qualifying records are discarded, the field list of the inner SELECT must be designed to ensure the retrieved records will contain no duplicates (normally, this would mean including in the list of retrieved fields all of those fields that comprise that table's primary key).
    Secondly, if you were able to code "SELECT ... FROM <database table> FOR ALL ENTRIES IN TABLE <itab>" and the internal table <itab> is empty, then all rows from <database table> will be retrieved.
    Thirdly, if the internal table supplying the selection criteria (i.e. internal table <itab> in the example "...FOR ALL ENTRIES IN TABLE <itab> ") contains a large number of entries, performance degradation may occur.
    <b>15. SELECT * versus SELECTing individual fields</b>
    In general, use a SELECT statement specifying a list of fields instead of a SELECT * to reduce network traffic and improve performance. For tables with only a few fields the improvements may be minor, but many SAP tables contain more than 50 fields when the program needs only a few. In the latter case, the performace gains can be substantial. For example:
    Use:
    select vbeln auart vbtyp from table vbak
    into (vbak-vbeln, vbak-auart, vbak-vbtyp)
    where ...
    Instead of using:
    select * from vbak where ...
    <b>16. Avoid unnecessary statements</b>
    There are a few cases where one command is better than two. For example:
    Use:
    append <tab_wa> to <tab>.
    Instead of:
    <tab> = <tab_wa>.
    append <tab> (modify <tab>).
    And also, use:
    if not <tab>[] is initial.
    Instead of:
    describe table <tab> lines <line_counter>.
    if <line_counter> > 0.
    <b>17. Copying or appending internal tables</b>
    Use this:
    <tab2>[] = <tab1>[]. (if <tab2> is empty)
    Instead of this:
    loop at <tab1>.
    append <tab1> to <tab2>.
    endloop.
    However, if <tab2> is not empty and should not be overwritten, then use:
    append lines of <tab1> [from index1] [to index2] to <tab2>.
    Hope this will help you all in writing the ABAP program.<b></b>

    ABAP Performance Standards
    Following are the performance standards need to be following in writing ABAP programs:
    <b>1. Unused/Dead code</b>
    Avoid leaving unused code in the program. Either comment out or delete the unused situation. Use program --> check --> extended program to check for the variables, which are not used statically.
    <b>2. Subroutine Usage</b>
    For good modularization, the decision of whether or not to execute a subroutine should be made before the subroutine is called. For example:
    This is better:
    IF f1 NE 0.
    PERFORM sub1.
    ENDIF.
    FORM sub1.
    ENDFORM.
    Than this:
    PERFORM sub1.
    FORM sub1.
    IF f1 NE 0.
    ENDIF.
    ENDFORM.
    <b>3. Usage of IF statements</b>
    When coding IF tests, nest the testing conditions so that the outer conditions are those which are most likely to fail. For logical expressions with AND , place the mostly likely false first and for the OR, place the mostly likely true first.
    Example - nested IF's:
    IF (least likely to be true).
    IF (less likely to be true).
    IF (most likely to be true).
    ENDIF.
    ENDIF.
    ENDIF.
    Example - IF...ELSEIF...ENDIF :
    IF (most likely to be true).
    ELSEIF (less likely to be true).
    ELSEIF (least likely to be true).
    ENDIF.
    Example - AND:
    IF (least likely to be true) AND
    (most likely to be true).
    ENDIF.
    Example - OR:
    IF (most likely to be true) OR
    (least likely to be true).
    <b>4. CASE vs. nested Ifs</b>
    When testing fields "equal to" something, one can use either the nested IF or the CASE statement. The CASE is better for two reasons. It is easier to read and after about five nested IFs the performance of the CASE is more efficient.
    <b>5. MOVE statements</b>
    When records a and b have the exact same structure, it is more efficient to MOVE a TO b than to MOVE-CORRESPONDING a TO b.
    MOVE BSEG TO *BSEG.
    is better than
    MOVE-CORRESPONDING BSEG TO *BSEG.
    <b>6. SELECT and SELECT SINGLE</b>
    When using the SELECT statement, study the key and always provide as much of the left-most part of the key as possible. If the entire key can be qualified, code a SELECT SINGLE not just a SELECT. If you are only interested in the first row or there is only one row to be returned, using SELECT SINGLE can increase performance by up to three times.
    <b>7. Small internal tables vs. complete internal tables</b>
    In general it is better to minimize the number of fields declared in an internal table. While it may be convenient to declare an internal table using the LIKE command, in most cases, programs will not use all fields in the SAP standard table.
    For example:
    Instead of this:
    data: t_mara like mara occurs 0 with header line.
    Use this:
    data: begin of t_mara occurs 0,
    matnr like mara-matnr,
    end of t_mara.
    <b>8. Row-level processing and SELECT SINGLE</b>
    Similar to the processing of a SELECT-ENDSELECT loop, when calling multiple SELECT-SINGLE commands on a non-buffered table (check Data Dictionary -> Technical Info), you should do the following to improve performance:
    o Use the SELECT into <itab> to buffer the necessary rows in an internal table, then
    o sort the rows by the key fields, then
    o use a READ TABLE WITH KEY ... BINARY SEARCH in place of the SELECT SINGLE command. Note that this only make sense when the table you are buffering is not too large (this decision must be made on a case by case basis).
    <b>9. READing single records of internal tables</b>
    When reading a single record in an internal table, the READ TABLE WITH KEY is not a direct READ. This means that if the data is not sorted according to the key, the system must sequentially read the table. Therefore, you should:
    o SORT the table
    o use READ TABLE WITH KEY BINARY SEARCH for better performance.
    <b>10. SORTing internal tables</b>
    When SORTing internal tables, specify the fields to SORTed.
    SORT ITAB BY FLD1 FLD2.
    is more efficient than
    SORT ITAB.
    <b>11. Number of entries in an internal table</b>
    To find out how many entries are in an internal table use DESCRIBE.
    DESCRIBE TABLE ITAB LINES CNTLNS.
    is more efficient than
    LOOP AT ITAB.
    CNTLNS = CNTLNS + 1.
    ENDLOOP.
    <b>12. Performance diagnosis</b>
    To diagnose performance problems, it is recommended to use the SAP transaction SE30, ABAP/4 Runtime Analysis. The utility allows statistical analysis of transactions and programs.
    <b>13. Nested SELECTs versus table views</b>
    Since releASE 4.0, OPEN SQL allows both inner and outer table joins. A nested SELECT loop may be used to accomplish the same concept. However, the performance of nested SELECT loops is very poor in comparison to a join. Hence, to improve performance by a factor of 25x and reduce network load, you should either create a view in the data dictionary then use this view to select data, or code the select using a join.
    <b>14. If nested SELECTs must be used</b>
    As mentioned previously, performance can be dramatically improved by using views instead of nested SELECTs, however, if this is not possible, then the following example of using an internal table in a nested SELECT can also improve performance by a factor of 5x:
    Use this:
    form select_good.
    data: t_vbak like vbak occurs 0 with header line.
    data: t_vbap like vbap occurs 0 with header line.
    select * from vbak into table t_vbak up to 200 rows.
    select * from vbap
    for all entries in t_vbak
    where vbeln = t_vbak-vbeln.
    endselect.
    endform.
    Instead of this:
    form select_bad.
    select * from vbak up to 200 rows.
    select * from vbap where vbeln = vbak-vbeln.
    endselect.
    endselect.
    endform.
    Although using "SELECT...FOR ALL ENTRIES IN..." is generally very fast, you should be aware of the three pitfalls of using it:
    Firstly, SAP automatically removes any duplicates from the rest of the retrieved records. Therefore, if you wish to ensure that no qualifying records are discarded, the field list of the inner SELECT must be designed to ensure the retrieved records will contain no duplicates (normally, this would mean including in the list of retrieved fields all of those fields that comprise that table's primary key).
    Secondly, if you were able to code "SELECT ... FROM <database table> FOR ALL ENTRIES IN TABLE <itab>" and the internal table <itab> is empty, then all rows from <database table> will be retrieved.
    Thirdly, if the internal table supplying the selection criteria (i.e. internal table <itab> in the example "...FOR ALL ENTRIES IN TABLE <itab> ") contains a large number of entries, performance degradation may occur.
    <b>15. SELECT * versus SELECTing individual fields</b>
    In general, use a SELECT statement specifying a list of fields instead of a SELECT * to reduce network traffic and improve performance. For tables with only a few fields the improvements may be minor, but many SAP tables contain more than 50 fields when the program needs only a few. In the latter case, the performace gains can be substantial. For example:
    Use:
    select vbeln auart vbtyp from table vbak
    into (vbak-vbeln, vbak-auart, vbak-vbtyp)
    where ...
    Instead of using:
    select * from vbak where ...
    <b>16. Avoid unnecessary statements</b>
    There are a few cases where one command is better than two. For example:
    Use:
    append <tab_wa> to <tab>.
    Instead of:
    <tab> = <tab_wa>.
    append <tab> (modify <tab>).
    And also, use:
    if not <tab>[] is initial.
    Instead of:
    describe table <tab> lines <line_counter>.
    if <line_counter> > 0.
    <b>17. Copying or appending internal tables</b>
    Use this:
    <tab2>[] = <tab1>[]. (if <tab2> is empty)
    Instead of this:
    loop at <tab1>.
    append <tab1> to <tab2>.
    endloop.
    However, if <tab2> is not empty and should not be overwritten, then use:
    append lines of <tab1> [from index1] [to index2] to <tab2>.
    Hope this will help you all in writing the ABAP program.<b></b>

  • ABAP Performance Optimizer

    dear abapers,
    i have a problem in optimize abap code, especially report program.
    is there any documentation / step by step guide / tips n tricks for best practise in abap performance optimizer ?
    if there any, could you please send to my mail : [email protected]
    many thanks in advance
    regards
    eddhie

    Hi,
    Take a look at the links below they have useful info and tips.
    http://www.sapdevelopment.co.uk/perform/performhome.htm
    http://www.thespot4sap.com/Articles/SAPABAPPerformanceTuning_PerformanceAnalysisTools.asp
    http://help.sap.com/saphelp_nw2004s/helpdata/en/6b/4b5ceb971afa469a02268df33f545f/content.htm
    http://www.asug.com/client_files/Calendar/Upload/ACF3DBF.ppt#264,1,Slide 1
    Cheers
    VJ

  • ABAP performance issues and improvements

    Hi All,
    Pl. give me the ABAP performance issue and improvement points.
    Regards,
    Hema

    Performance tuning for Data Selection Statement
    For all entries
    The for all entries creates a where clause, where all the entries in the driver table are combined with OR. If the number of
    entries in the driver table is larger than rsdb/max_blocking_factor, several similar SQL statements are executed to limit the
    length of the WHERE clause.
    The plus
    Large amount of data
    Mixing processing and reading of data
    Fast internal reprocessing of data
    Fast
    The Minus
    Difficult to program/understand
    Memory could be critical (use FREE or PACKAGE size)
    Some steps that might make FOR ALL ENTRIES more efficient:
    Removing duplicates from the the driver table
    Sorting the driver table
          If possible, convert the data in the driver table to ranges so a BETWEEN statement is used instead of and OR statement:
          FOR ALL ENTRIES IN i_tab
            WHERE mykey >= i_tab-low and
                  mykey <= i_tab-high.
    Nested selects
    The plus:
    Small amount of data
    Mixing processing and reading of data
    Easy to code - and understand
    The minus:
    Large amount of data
    when mixed processing isn’t needed
    Performance killer no. 1
    Select using JOINS
    The plus
    Very large amount of data
    Similar to Nested selects - when the accesses are planned by the programmer
    In some cases the fastest
    Not so memory critical
    The minus
    Very difficult to program/understand
    Mixing processing and reading of data not possible
    Use the selection criteria
    SELECT * FROM SBOOK.                   
      CHECK: SBOOK-CARRID = 'LH' AND       
                      SBOOK-CONNID = '0400'.        
    ENDSELECT.                             
    SELECT * FROM SBOOK                     
      WHERE CARRID = 'LH' AND               
            CONNID = '0400'.                
    ENDSELECT.                              
    Use the aggregated functions
    C4A = '000'.              
    SELECT * FROM T100        
      WHERE SPRSL = 'D' AND   
            ARBGB = '00'.     
      CHECK: T100-MSGNR > C4A.
      C4A = T100-MSGNR.       
    ENDSELECT.                
    SELECT MAX( MSGNR ) FROM T100 INTO C4A 
    WHERE SPRSL = 'D' AND                
           ARBGB = '00'.                  
    Select with view
    SELECT * FROM DD01L                    
      WHERE DOMNAME LIKE 'CHAR%'           
            AND AS4LOCAL = 'A'.            
      SELECT SINGLE * FROM DD01T           
        WHERE   DOMNAME    = DD01L-DOMNAME 
            AND AS4LOCAL   = 'A'           
            AND AS4VERS    = DD01L-AS4VERS 
            AND DDLANGUAGE = SY-LANGU.     
    ENDSELECT.                             
    SELECT * FROM DD01V                    
    WHERE DOMNAME LIKE 'CHAR%'           
           AND DDLANGUAGE = SY-LANGU.     
    ENDSELECT.                             
    Select with index support
    SELECT * FROM T100            
    WHERE     ARBGB = '00'      
           AND MSGNR = '999'.    
    ENDSELECT.                    
    SELECT * FROM T002.             
      SELECT * FROM T100            
        WHERE     SPRSL = T002-SPRAS
              AND ARBGB = '00'      
              AND MSGNR = '999'.    
      ENDSELECT.                    
    ENDSELECT.                      
    Select … Into table
    REFRESH X006.                 
    SELECT * FROM T006 INTO X006. 
      APPEND X006.                
    ENDSELECT
    SELECT * FROM T006 INTO TABLE X006.
    Select with selection list
    SELECT * FROM DD01L              
      WHERE DOMNAME LIKE 'CHAR%'     
            AND AS4LOCAL = 'A'.      
    ENDSELECT
    SELECT DOMNAME FROM DD01L    
    INTO DD01L-DOMNAME         
    WHERE DOMNAME LIKE 'CHAR%' 
           AND AS4LOCAL = 'A'.  
    ENDSELECT
    Key access to multiple lines
    LOOP AT TAB.          
    CHECK TAB-K = KVAL. 
    ENDLOOP.              
    LOOP AT TAB WHERE K = KVAL.     
    ENDLOOP.                        
    Copying internal tables
    REFRESH TAB_DEST.              
    LOOP AT TAB_SRC INTO TAB_DEST. 
      APPEND TAB_DEST.             
    ENDLOOP.                       
    TAB_DEST[] = TAB_SRC[].
    Modifying a set of lines
    LOOP AT TAB.             
      IF TAB-FLAG IS INITIAL.
        TAB-FLAG = 'X'.      
      ENDIF.                 
      MODIFY TAB.            
    ENDLOOP.                 
    TAB-FLAG = 'X'.                  
    MODIFY TAB TRANSPORTING FLAG     
               WHERE FLAG IS INITIAL.
    Deleting a sequence of lines
    DO 101 TIMES.               
      DELETE TAB_DEST INDEX 450.
    ENDDO.                      
    DELETE TAB_DEST FROM 450 TO 550.
    Linear search vs. binary
    READ TABLE TAB WITH KEY K = 'X'.
    READ TABLE TAB WITH KEY K = 'X' BINARY SEARCH.
    Comparison of internal tables
    DESCRIBE TABLE: TAB1 LINES L1,      
                    TAB2 LINES L2.      
    IF L1 <> L2.                        
      TAB_DIFFERENT = 'X'.              
    ELSE.                               
      TAB_DIFFERENT = SPACE.            
      LOOP AT TAB1.                     
        READ TABLE TAB2 INDEX SY-TABIX. 
        IF TAB1 <> TAB2.                
          TAB_DIFFERENT = 'X'. EXIT.    
        ENDIF.                          
      ENDLOOP.                          
    ENDIF.                              
    IF TAB_DIFFERENT = SPACE.           
    ENDIF.                              
    IF TAB1[] = TAB2[].  
    ENDIF.               
    Modify selected components
    LOOP AT TAB.           
    TAB-DATE = SY-DATUM. 
    MODIFY TAB.          
    ENDLOOP.               
    WA-DATE = SY-DATUM.                    
    LOOP AT TAB.                           
    MODIFY TAB FROM WA TRANSPORTING DATE.
    ENDLOOP.                               
    Appending two internal tables
    LOOP AT TAB_SRC.              
      APPEND TAB_SRC TO TAB_DEST. 
    ENDLOOP
    APPEND LINES OF TAB_SRC TO TAB_DEST.
    Deleting a set of lines
    LOOP AT TAB_DEST WHERE K = KVAL. 
      DELETE TAB_DEST.               
    ENDLOOP
    DELETE TAB_DEST WHERE K = KVAL.
    Tools available in SAP to pin-point a performance problem
          The runtime analysis (SE30)
          SQL Trace (ST05)
          Tips and Tricks tool
          The performance database
    Optimizing the load of the database
    Using table buffering
    Using buffered tables improves the performance considerably. Note that in some cases a stament can not be used with a buffered table, so when using these staments the buffer will be bypassed. These staments are:
    Select DISTINCT
    ORDER BY / GROUP BY / HAVING clause
    Any WHERE clasuse that contains a subquery or IS NULL expression
    JOIN s
    A SELECT... FOR UPDATE
    If you wnat to explicitly bypass the bufer, use the BYPASS BUFFER addition to the SELECT clause.
    Use the ABAP SORT Clause Instead of ORDER BY
    The ORDER BY clause is executed on the database server while the ABAP SORT statement is executed on the application server. The datbase server will usually be the bottleneck, so sometimes it is better to move thje sort from the datsbase server to the application server.
    If you are not sorting by the primary key ( E.g. using the ORDER BY PRIMARY key statement) but are sorting by another key, it could be better to use the ABAP SORT stament to sort the data in an internal table. Note however that for very large result sets it might not be a feasible solution and you would want to let the datbase server sort it.
    Avoid ther SELECT DISTINCT Statement
    As with the ORDER BY clause it could be better to avoid using SELECT DISTINCT, if some of the fields are not part of an index. Instead use ABAP SORT + DELETE ADJACENT DUPLICATES on an internal table, to delete duplciate rows.

  • Program terminated: Time limit exceeded, ABAP performance, max_wprun_time

    Hi,
    I am running an ABAP program, and I get the following short dump:
    Time limit exceeded. The program has exceeded the maximum permitted runtime and has therefore been terminated. After a certain time, the program terminates to free the work processfor other users who are waiting. This is to stop work processes being blocked for too long by
    - Endless loops (DO, WHILE, ...),
    - Database acceses with large result sets,
    - Database accesses without an apporpriate index (full table scan)
    - database accesses producing an excessively large result set,
    The maximum runtime of a program is set by the profile parameter "rdisp/max_wprun_time". The current setting is 10000 seconds. After this, the system gives the program a second chance. During the first half (>= 10000 seconds), a call that is blocking the work process (such as a long-running SQLstatement) can occur. While the statement is being processed, the database layer will not allow it to be interrupted. However, to stop the program terminating immediately after the statement has been successfully processed, the system gives it another 10000 seconds. Hence the maximum runtime of a program is at least twice the value of the system profile parameter "rdisp/max_wprun_time".
    Last error logged in SAP kernel
    Component............ "NI (network interface)"
    Place................ "SAP-Dispatcher ok1a11cs_P06_00 on host ok1a11e0"
    Version.............. 34
    Error code........... "-6"
    Error text........... "connection to partner broken"
    Description.......... "NiPRead"
    System call.......... "recv"
    Module............... "niuxi.c"
    Line................. 1186
    Long-running programs should be started as background jobs. If this is not possible, you can increase the value of the system profile parameter "rdisp/max_wprun_time".
    Program cannot be started as a background job. We have now identified two options to solve the problem:
    - Increase the value of the system profile parameter "rdisp/max_wprun_time"
    - Improve the performance of the following SELECT statement in the program:
    SELECT ps_psp_pnr ebeln ebelp zekkn sakto FROM ekkn
    INTO CORRESPONDING FIELDS OF TABLE i_ekkn
    FOR ALL ENTRIES IN p_lt_proj
    WHERE ps_psp_pnr = p_lt_proj-pspnr
    AND ps_psp_pnr > 0.
    In EKKN we have 200 000 entries.
    Is there any other options we could try?
    Regards,
    Jarmo

    Thanks for your help, this problem seems to be quite challenging...
    In EKKN we have 200 000 entries. 199 999 entries have value of 00000000 in column ps_psp_pnr, and only one has a value which identifies a WBS element.
    I believe the problem is that there isn't any WBS element in PRPS which has the value of 00000000. I guess that is the reason why EKKN is read sequantially.
    I also tried this one, but it doesn't help at all. Before the SELECT statement is executed, there are 594 entries in internal table p_lt_proj_sel:
      DATA p_lt_proj_sel LIKE p_lt_proj OCCURS 0 WITH HEADER LINE.
      p_lt_proj_sel[] = p_lt_proj[].
      DELETE p_lt_proj_sel WHERE pspnr = 0.
      SORT p_lt_proj_sel by pspnr.
      SELECT ps_psp_pnr ebeln ebelp zekkn sakto FROM ekkn
      INTO CORRESPONDING FIELDS OF TABLE i_ekkn
      FOR ALL ENTRIES IN p_lt_proj_sel
      WHERE ps_psp_pnr = p_lt_proj_sel-pspnr.
    I also checked that the index P in EKKN is active.
    Can I somehow force the optimizer to use the index?
    Regards,
    Jarmo

  • WD ABAP performance tips and tricks

    Hi all,
    I was wondering if there is any good approach to build WD applications so performance does not have to suffer. Do you know of any good documentation on this topic?
    Thank you,
    Georgy

    Hello, Georgy,
    From my experience, I follow some guidelines. These can be correct or not, but from my researches across SDN and other sources (help.sap.com and Ulli's book), it's proven to be good guidelines. Of course, I'll be presenting here only those tips related to WDA, not ABAP. Here they are:
    1. Design your Context nodes carefully:
    - Avoid non-Singleton nodes;
    - Make your supply functions as simple as possible;
    2. Controllers:
    - If you use a component (such as ALV or MESSAGE_MANAGER) frequently, instantiate it at WDDOINIT and save it as a public attribute of the COMPONENTCONTROLLER. This way, whenever you need to call a method of the component, you can refer to wd_comp_controller->attribute->method.
    3. Views:
    - Instead of using dynamic programming to control properties of view elements (visibility, read-only, text, etc), use context attributes. This way, you can control, for instance, the visibility of an element in any method, not only inside WDDOMODIFYVIEW;
    4. Methods:
    - Use the WDA framework correctly: if you need to consist user entered data, use WDDOBEFOREACTION; if you need to control aspects of the view, use WDDOMODIFYVIEW;
    - Learn the Phase Model better than the back of your hands
    Well, that's some guidelines I use, and I'd like you to comment it also, or further expand this list.
    Regards,
    Andre

  • WD ABAP Performance Tuning

    Is there a performance tuning guide focusing on WB ABAP?
    - Showing server settings which improve performance
    - Client (Browser) setting being recommend
    Any hint?

    http://help.sap.com/saphelp_nw2004s/helpdata/en/c6/58e70398244a87a2c39e700bdae4a9/frameset.htm

  • Sap abap- perform using....changing....

    1. can u explain me about ' perform....using...changing....'
    subroutine and how to work with it.
    2. how to declare constants (global declarations).

    Hi,
    You can declare global constants as below :
    constants : gc_bukrs like bsis-bukrs value '1000'.
    Find below docu for perform.
    PERFORM form(prog).
    Extras:
    1. ... TABLES   itab1 itab2 ...
    2. ... USING    u1 u2 u3 ...
    3. ... CHANGING c1 c2 c3 ...
    4. ... IF FOUND
    This variant is not allowed in an ABAP Objects context.See PERFORM form(prog) not allowed.
    Effect
    Calls the subroutine form defined in program prog ("external PERFORM").
    Notes
    You pass parameters to the external subroutine as described in variant 1.
    However, you can also do it using a shared data area (DATA BEGIN OF COMMON PART).
    Please consult Data Area and Modularization Unit Organization documentation as well.
    You can use nested calls, including several different subroutines in different programs.
    When you call a subroutine that belongs to a program prog, prog is loaded into the PXA buffer (if it has not been loaded already). To minimize the possibility of memory problems, try not to use too many external subroutines from a large number of different programs.
    Addition 1
    ... TABLES itab1 itab2 ...
    Effect
    See variant 1, addition 1.
    Addition 2
    ... USING u1 u2 u3 ...
    Effect
    See variant 1, addition 2.
    Addition 3
    ... CHANGING c1 c2 c3 ...
    Effect
    See variant 1, addition 3.
    Addition 4
    ... IF FOUND
    Effect
    The specified subroutine is only called if the subroutine and its main program exist. Otherwise, the statement is ignored.
    Notes
    If the program exists but not the subroutine, the program itself is still loaded.
    If the specified program contains errors, a runtime error occurs.
    You can only find out if the subroutine exists by programming a check yourself (for example, by setting a flag that you pass to it).
    Thanks,
    SRiram Ponna.

  • Urgent : general abap performance issue

    HI floks
    i did some development in new smartform its working fine but i have issue in data base performance is 76% . but i utilize similar below code with various conditions in various 12 places . is it possible to reduce performance this type of code . check it and mail me how can i do it . if possible can suggest me fast .how much % is best for this type of performance issues.
    DATA : BEGIN OF ITVBRPC OCCURS 0,
           LV_POSNR LIKE VBRP-POSNR,
           END OF ITVBRPC.
    DATA : BEGIN OF ITKONVC OCCURS 0,
            LV_KNUMH LIKE KONV-KNUMH,
            LV_KSCHL LIKE KONV-KSCHL,
           END OF ITKONVC.
    DATA:  BEGIN OF ITKONHC OCCURS 0,
           LV_KNUMH LIKE KONH-KNUMH,
           LV_KSCHL LIKE KONH-KSCHL,
           LV_KZUST LIKE KONH-KZUST,
           END OF ITKONHC.
    DATA: BEGIN OF ITKONVC1 OCCURS 0,
           LV_KWERT LIKE KONV-KWERT,
           END OF ITKONVC1.
    DATA :  BEGIN OF ITCALCC OCCURS 0,
           LV_KWERT LIKE KONV-KWERT,
           END OF ITCALCC.
    DATA: COUNTC(3) TYPE n,
           TOTALC LIKE KONV-KWERT.
    SELECT POSNR FROM VBRP INTO ITVBRPC
      WHERE VBELN = INV_HEADER-VBELN AND ARKTX = WA_INVDATA-ARKTX .
    APPEND ITVBRPC.
    ENDSELECT.
    LOOP AT ITVBRPC.
    SELECT KNUMH KSCHL FROM KONV INTO ITKONVC WHERE KNUMV =
    LV_VBRK-KNUMV AND KPOSN = ITVBRPC-LV_POSNR AND KSCHL = 'ZLAC'.
    APPEND ITKONVC.
    ENDSELECT.
    ENDLOOP.
    SORT ITKONVC BY LV_KNUMH.
    DELETE ADJACENT DUPLICATES FROM ITKONVC.
    LOOP AT ITKONVC.
    SELECT KNUMH KSCHL KZUST FROM KONH INTO ITKONHC WHERE KNUMH = ITKONVC-LV_KNUMH AND KSCHL = 'ZLAC' AND KZUST = 'Z02'.
    APPEND ITKONHC.
    ENDSELECT.
    ENDLOOP.
    LOOP AT ITKONHC.
    SELECT KWERT FROM KONV INTO ITKONVC1 WHERE KNUMH = ITKONHC-LV_KNUMH AND
    KSCHL = ITKONHC-LV_KSCHL AND KNUMV = LV_VBRK-KNUMV.
    MOVE ITKONVC1-LV_KWERT TO ITCALCC-LV_KWERT.
    APPEND ITCALCC.
    ENDSELECT.
    endloop.
    LOOP AT ITCALCC.
    COUNTC = COUNTC + 1.
    TOTALC = TOTALC + ITCALCC-LV_KWERT.
      ENDLOOP.
    MOVE ITKONHC-LV_KSCHL TO LV_CKSCHL.
    MOVE TOTALC TO LV_CKWERT.
    it's urgent ..........
    thanks .
    bbbbye
    suresh

    You need to use for all entries instead of select inside the loop.
    Try this:
    DATA : BEGIN OF ITVBRPC OCCURS 0,
    VBELN LIKE VBRP-VBELN,
    LV_POSNR LIKE VBRP-POSNR,
    END OF ITVBRPC.
    DATA: IT_VBRPC_TMP like ITVBRPC occurs 0 with header line.
    DATA : BEGIN OF ITKONVC OCCURS 0,
    LV_KNUMH LIKE KONV-KNUMH,
    LV_KSCHL LIKE KONV-KSCHL,
    END OF ITKONVC.
    DATA: BEGIN OF ITKONHC OCCURS 0,
    LV_KNUMH LIKE KONH-KNUMH,
    LV_KSCHL LIKE KONH-KSCHL,
    LV_KZUST LIKE KONH-KZUST,
    END OF ITKONHC.
    DATA: BEGIN OF ITKONVC1 OCCURS 0,
    KNUMH LIKE KONV-KNUMH,
    KSCHL LIKE KONV- KSCHL,
    LV_KWERT LIKE KONV-KWERT,
    END OF ITKONVC1.
    DATA : BEGIN OF ITCALCC OCCURS 0,
    LV_KWERT LIKE KONV-KWERT,
    END OF ITCALCC.
    DATA: COUNTC(3) TYPE n,
    TOTALC LIKE KONV-KWERT.
    *SELECT POSNR FROM VBRP INTO ITVBRPC
    *WHERE VBELN = INV_HEADER-VBELN AND ARKTX = WA_INVDATA-ARKTX .
    *APPEND ITVBRPC.
    *ENDSELECT.
    SELECT VBELN POSNR FROM VBRP INTO TABLE ITVBRPC
    WHERE VBELN = INV_HEADER-VBELN AND
                     ARKTX = WA_INVDATA-ARKTX .
    If sy-subrc eq 0.
      IT_VBRPC_TMP[] = ITVBRPC[].
      Sort IT_VBRPC_TMP by vbeln posnr.
      Delete adjacent duplicates from IT_VBRPC_TMP comparing vbeln posnr.
    SELECT KNUMH KSCHL FROM KONV
                   INTO TABLE ITKONVC
                   WHERE KNUMV = LV_VBRK-KNUMV AND
                   KPOSN = ITVBRPC-LV_POSNR AND
                    KSCHL = 'ZLAC'.
    if sy-subrc eq 0.
       SORT ITKONVC BY LV_KNUMH.
        DELETE ADJACENT DUPLICATES FROM ITKONVC COMPARING LV_KNUMH.
       SELECT KNUMH KSCHL KZUST FROM KONH
                 INTO TABLE ITKONHC
                 WHERE KNUMH =  ITKONVC-LV_KNUMH AND
                               KSCHL = 'ZLAC' AND
                               KZUST = 'Z02'.
       if sy-subrc eq 0.
    SELECT KNUMH KSCHL KWERT FROM KONV
                   INTO TABLE ITKONVC1
                    WHERE KNUMH = ITKONHC-LV_KNUMH AND
                                   KSCHL = ITKONHC-LV_KSCHL AND
                                    KNUMV = LV_VBRK-KNUMV.
        Endif.
    Endif.
    Endif.
    *LOOP AT ITVBRPC.
    *SELECT KNUMH KSCHL FROM KONV INTO ITKONVC WHERE KNUMV =
    *LV_VBRK-KNUMV AND KPOSN = ITVBRPC-LV_POSNR AND KSCHL = 'ZLAC'.
    *APPEND ITKONVC.
    *ENDSELECT.
    *ENDLOOP.
    *SORT ITKONVC BY LV_KNUMH.
    *DELETE ADJACENT DUPLICATES FROM ITKONVC.
    *LOOP AT ITKONVC.
    SELECT KNUMH KSCHL KZUST FROM KONH INTO ITKONHC WHERE KNUMH = ITKONVC-LV_KNUMH AND KSCHL = 'ZLAC' AND KZUST = 'Z02'.
    *APPEND ITKONHC.
    *ENDSELECT.
    *ENDLOOP.
    *LOOP AT ITKONHC.
    *SELECT KWERT FROM KONV INTO ITKONVC1 WHERE KNUMH = ITKONHC-LV_KNUMH *AND
    *KSCHL = ITKONHC-LV_KSCHL AND KNUMV = LV_VBRK-KNUMV.
    *MOVE ITKONVC1-LV_KWERT TO ITCALCC-LV_KWERT.
    *APPEND ITCALCC.
    *ENDSELECT.
    *endloop.
    LOOP AT ITCALCC.
    COUNTC = COUNTC + 1.
    TOTALC = TOTALC + ITCALCC-LV_KWERT.
    ENDLOOP.
    MOVE ITKONHC-LV_KSCHL TO LV_CKSCHL.
    MOVE TOTALC TO LV_CKWERT.

  • ABAP performance

    Hi!
    I have an internal table, which has 250000 records.
    LOOP AT itab INTO wa.
    * here are some other ABAP statements, but no SELECT
    * or other database accesses
    READ TABLE ...
    MOVE ...
    ENDLOOP.
    This code part runs for 8 minutes and I don't know why is it so slow.
    How can I trace, which command takes the most time? If I go into the debugger and run it step-by-step, it seems every command is progressed instantly. Is there some tool for it?
    SE30 is not enough detailfully, so it is not useful in my case.
    Thank you
    Tamá

    yes, you have to tell us more.
    Most likely your READ statement does not use a qualified key. Also, you might want to drop "INTO wa" and use field symbols instead ("ASSIGNING <fs>"). At 250K records you're saving some copying costs.
    Cheers
    Thomas
    Edit:
    You have to explicitely switch on analysis of internal table operations in SE30. Also see this excellent blog:
    /people/siegfried.boes/blog/2007/11/13/the-abap-runtime-trace-se30--quick-and-easy

  • Abap performance issue

    hello all ,
                  I am trying to read org unit text from t527x table inside get pernr and end-of-selection  loop.
    Performance wise is it better to use select statement or function module to get the text
    or read all the possible texts into an internal table before get pernr  and then read the internal table inside the loop.
    thnx
    regards

    SELECTING ALL POSSIBLE T527X ENTRIES INTO AN INTERNAL TABLE AND READING THIS INSIDE  LOOP IS EFFECTIVE PERFORMANCEWISE....
    also sort this internal table by orgeh endda descending and delete adjacent duplicates to get only latest orgtx
    also use binary search extension while using read statement.
    AS IF U CHECK TOTAL NUMBER OF ENTRIES IN T527X AS COMPARED TO THAT IN PA0001(WHICH HAS ORGEH) IS JUST 1/10TH OR EVEN LESS.
    SO INSTEAD OF PROCESSING 10 TIMES MORE THE NUMBER OF RECORDS IT'S BETTER TO PROCESS LESS NUMBER OF RECORDS....!!!!!
    Regards
    Vasu

  • Workflow- ABAP performance question

    hi ,
    we were doing to couple of test.
    i have include a select statement
    Below logic takes 700,000 micro seconds to run in a dev environment
    TYPES: Begin of ty_test,
            meth_edate LIKE sy-datum,
           End of ty_test.
    DATA:  it_workitem TYPE STANDARD TABLE OF ty_test
                               WITH NON-UNIQUE KEY meth_edate
                               INITIAL SIZE 100.
    SELECT meth_edate FROM sww_outbox
       I                              NTO TABLE it_workitem
                                      WHERE meth_edate EQ sy-datum.
    Where as
    Below logic only takes 2000 micro seconds
    DATA : it_workitems LIKE SWWWLHEAD occurs 0
                                       WITH HEADER LINE.
    SELECT * FROM sww_outbox
       INTO CORRESPONDING FIELDS OF TABLE it_workitems
                    WHERE meth_edate EQ sy-datum.
    I couldnt believe how come logic which I thought takes more time is taking less time. Any particular reason for such big difference. I am guessing I am missing something.
    But I need to optimize code from 2000 micro second to lesser ..any suggestion

    SELECT * FROM sww_outbox
    INTO CORRESPONDING FIELDS OF TABLE it_workitems
    WHERE meth_edate EQ sy-datum.
    You can  increase performance by removing the INTO CORRESPONDING FIELDS OF TABLE.... this is the addition of select statement which would be taking time to get the data from SWW_OUTBOX table....
    Instead of * you can write selective fields which ever you are trying to read into the table... this modification could improve the select statement performance..

  • VMWare Netweaver 70 Java & Abap, Performance Boost

    Hi all,
    a small tip how to improve the performance of the VM Edition:
    0. Create and Add a new VM Ware harddisk with a link to a physical empty partition
    1. Logon to Linux with root:sap123 and format the new mounted harddisk with e.g. ext3, mount the new disk to /netweaver_new
    2. edit file /etc/init.d/netweaver line 30, comment out #exit 0
    3. Stop ALL running Instances /etc/init.d/rc5.d/S12netweaver stop
    4. Copy all files from from /netweaver to /netweaver_new with all permisions e.g. cp -fvpr /netweaver /netweaver_new
    5. Change mountpoint of old WMware harddisk to /netweaver_old and change new phisical linked hardisk mountpoint /netweaver_new to /netweaver
    6. Start ALL /etc/init.d/rc5.d/S12netweaver start
    This is 50% faster than running from a virtual disk, have fun !

    ...

  • Abap performance trace

    Hi,
    can anyone provide me the workbench tools for performance trace and runtime analysis.
    step by step procedures will be much appreciated.
    thanks and regards,
    maahi

    Hi Maahi Verma,
    Check this info.
    <b>ST05</b>
    You use ST05, Trace Request, to do a SQL trace. 
    When using SQL trace, it is good to run the program in debugger and just before you execute the SQL, go to ST05 in another session and turn the trace on.
    After, or when, the SQL is finished, you can turn the trace off. 
    Then click on List Trace to see the details. 
    This is the way to control the traces. 
    If you just turn the trace on and then execute the program, you will get everything and will be overflooded with unnecessary information. 
    <b>Runtime Analysis</b> checks program execution time in microseconds. When you go to se30.if you give desired program name in performance file. It will take you to below screen. You can get how much past is your program.
    Hope this resolves your query.
    Reward all the helpful answers.
    Regards

  • Abap Performance Tuning

    Dear Friends,
           I'm got this error while use the Extended Program Check in particular z-programs where ever I’m using the Z-package how can I avoid this error in Extended Program Check
    .       Program:  ZCM_NO_SER_NITOR  Include:  CM_LES_CON_MISC  Row:     68  [2]
    Object PROG ZCM_NO_SER_NITOR has insufficient authorization to use objects
    DTEL CMT_LS_CAC_POC from package CM_FS_CHGE_NCEL
    ZCM_NO_SER_NITOR in package ZLMA
    CMT_LS_CAC_POC in package CM_FS_CHGE_NCEL
    Package ZLMA does not have sufficient use access
    (The message cannot be hidden using pseudo-comment "#EC .., bzw. durch SET
    EXTENDED CHECK OFF/ON)
    Thanks,
    Nirmal.
    Edited by: Nirmal R on Mar 24, 2008 1:36 PM
    Edited by: Nirmal R on Mar 24, 2008 1:44 PM

    I didn't see Properly!!! I spend 10-12 hrs of my day on SOLMAN forum. Z-Package Package ZLMA does not have sufficient use access how does it sound like???
    Do you think there will be much response on this ABAP questions in this forum??
    Why can't you make use of ABAP Development Forums?
    Extended Program Check, simple search in ABAP forum would have provided you the solution.
    Hope I am correct. Still if you argue that this is the correct forum.... I am damn sure you will get very delayed response that also doubtful.
    --Ragu

Maybe you are looking for

  • 11i to R12 upgrade

    Hi, I am doing test upgrade 11.5.10.2 to 12.1.1 I am following R12 upgrade guide and 1211 install guide. I finished rapid install step "Creating the Upgrade File System". Now my next step is to perform upgrade (apply upgrade drivers). It is not clear

  • TS2755 iMessage sent as text for first message

    After the iOS 6 update, my iPhone 4S through Sprint will not send iMessages to iMessage users on the first text. It sends the message as a text and when the iMessage user responds it changes to iMessage. How can I fix this? I've restarted my phone ov

  • Safari Virus?

    I appear to have a virus on my Safari browser. I'm getting unblocked popup ads for any and all websites (popup blocker has worked normally 'til now). Any thoughts on how to locate and remove the problem?

  • AUC settlement process

    Dear All, Please let me know how to settle values from a GL to asset with AUC settlement process with out using Internal order. Thanks, Srini.

  • Creating an employee by copying from other employee

    Hi Guys,                I need to create an employee by copying the other employee data for testing purpose. Can it been done ? Cheers