Skip to Content
author's profile photo Former Member
Former Member

abap code review

hi all,

can any body tell that what things has to be taken care of, while reviewing abap code.

And actually what statergy has to be followed.

Thanks and Regards.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • author's profile photo Former Member
    Former Member
    Posted on May 28, 2008 at 06:30 AM

    hi,

    these are the things which shd be taken care of while doing code review

    prepare a xls for every object u review and mark a tik against it it not then tell the developer to make necessary changes in the code.

    1 There should be no nested select statement

    2 There should be SY-SUBRC check at all possible places

    3 Has usage of select-endselect been avoided wherever possible

    4 There should be no perform statement inside select-endselect

    5 Have variables been cleared after use

    6 Have itabs been refreshed after use

    7 Is documentation attached to every object

    8 Has Pretty printer been used

    9 Use of text elements no hard coding

    10 Have constants been used wherever applicable

    11 Check ABAP Code has appropriate Comments

    12 Define constants wherever possible instead of hard coding. (e.g. c_planning value u2018PL instead of hard coding u2018PLu2019).

    13 No hard coding of break points in the source code.

    14 Code executed more than once should be placed in a form routine.

    15 No hard coding of values in BDC or Call Transaction unless specified in function specifications.

    16 Variables declared within programs have reference of the corresponding table/structure fields

    17 For custom tables, table maintenance generator is used for generating table maintenance interface.

    18 Use SELECT SINGLE when possible.

    19 Use SELECT against views or FOR ALL ENTRIES IN when possible.

    20 Check the internal table in the "For all entries" Clause is not Blank

    21 If structures match, use MOVE instead of MOVE-CORRESPONDING.

    22 Use SELECT fields FROM database tables INTO TABLE t_tab instead of APPEND statements.

    23 Avoid ORDER BY unless ordering by an index.

    24 SORT and READ TABLE t_tab WITH KEY u2026 BINARY SEARCH.

    26 "Avoid SELECTu2026ENDSELECT within another SELECTu2026ENDSELECT. Load data in internal tables.

    To process a join, use a view wherever possible instead of nested SELECT statements. Network load is considerably less."

    27 Use text elements for Longer text.(It provides possibility for multi-language support).

    28 Use CASE statement usage instead of IFu2026ELSEIF.

    29 Check if the warning, error messages etc. are relevant and have proper format

    30 Check if in the LOOP .. ENDLOOP , if we have used AT u2026 ENDAT,we should have copied the work area prior to AT statement in a Buffer (work area) and use that within the AT .. ENDAT to fetch the fields of the work area

    31 While making changes New Fields are added to the End of the Structure/Table unless specified differently

    32 Ensure that all the Database Changes are in a separate request

    33 Check if Start of Changes and End of Changes are maintained for all the new code we write in existing programs and also ensure that we have maintained History for the changes done.

    Format : ENTCR_XXXX <Description> : Start of Changes

    ENTCR_XXXX <Description> : End of Changes"

    34 Add a task for the User ID of the Onsite Member in your Change Request, or change the ownership of your request to the User ID of Onsite Member

    35 Check SY-SUBRC after select query before further processing.

    Reward points if useful.... 😊

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 27, 2008 at 09:23 PM

    Hi Noor,

    These are some of the factors to be considered for ABAP code review.

    1. We should follow the proper Naming standards through out the program

    2. REPORT <name> LINE-SIZE <s> LINE-COUNT <C> MESSAGE-ID <id>.

    (In Classical reports we should mention the additions LINE-COUNT and LINE-SIZE. They should be avoided in ALV's.Reason is maximum size of line is 255char which is overwritten with the value specified in LINE-SIZE which will truncate the data.)

    3. MESSAGE-ID <id>

    (If we use same message class through out the Report program we should use MESSAGE-ID addition.)

    4. No TABLES statement should be used because it is unnecessary wastage of memory.

    5. We should not use OCCURS <n> addition for declaring internal tables.

    (Reason for that is memory will be allocated to the Internal table when it is declared.)

    6. We should use TYPES to define structure and later define Internal tables and Work area separately.

    7. Hard coding should be avoided. Text elements should be used for that because they are language dependent.

    (This helps while language translation)

    8. PERFORM should be used which helps in improving readability, reusability and for enhancing performance. Parameters should be passed by USING , CHANGING and TABLES STATEMENT.

    (LIKE should not be used, we should use TYPE)

    (Proper Documentation and Indentation is necessary).

    9. Validations should be done on all mandatory fields mainly on the selection screen.

    10. We should use all key fields in the WHERE to filter the data for the maximum extent.

    11.We should check the SY-SUBRC values which are returned by SELECT statement to stop unnecessary execution of statements.

    12. We should SORT while using READ statement

    14. We should SORT internal table data while using DELETE ADJACENT DUPLICATES statement.

    13. We should handle the errors by handling the SY-SUBRC values from Function Modules.

    14. CHECK should not be used because further processing will not take place.

    15. We should avoid Nested loops, Nested IF-ELSE, SELECT inside LOOPS etc.

    16. At the end we should also avoid the errors and warning messages by using EXTENDED PROGRAM CHECK and CODE INSPECTOR.

    Reward if useful.

    Thanks,

    Khan.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Above all code level.

      A standard coder review check list privided ..which has naming convesions to be used, performance related check outs, on boarding process related comments and Log updates etc.,

      //Kiran

  • author's profile photo Former Member
    Former Member
    Posted on May 27, 2008 at 11:33 PM

    Hello ,

    You can use the code inspector tool to give a quick review on the abap code...

    Go to Program->check->code inspector....

    You will get a list of problems that the code may have...

    Hope this helps

    Gabriel p-

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 28, 2008 at 06:02 AM

    hi,

    generally code review is done by the senior people (may or may not be in the project).

    The purpose is to check the code whether all the coding standards and naming stds, performance issues are ok or not.

    Reward if helpful

    Rgds

    umakanth

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 28, 2008 at 06:07 AM

    in review

    first naming standard weather thy got name as understanding name or not...

    then modularization of code based on funcationality which is critial.

    then performance issue how u fatching data using buffer or not..

    better to make design on code before implemetating..

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 28, 2008 at 12:16 PM

    Hi Mohd,

    Apart from the mentioned things about code review.

    Ensure that you have SAP tools like

    1)SE30 Runtime Analysis and look at the cosnumption of ABAP Memroy which shud be more than 50%.

    2) SCI - Code Isnpector - which gives you syntax errors, security errors, performance errors etc.

    check that there are no errors at all and correct with whatever suggestions have been provided.

    3) run SLIN check for Extended programme check and do all the check as listed.

    4) if further need you cna also do a SQL trace Run for knowing which of the tables is cosnuimng more time to retrieve data which is a performance issue.

    Hope these wud be useful.

    Reward if useful

    Thanks

    Venugopal

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.