Testing and Debugging ABAP Codes, Functions

Could some one help me. I am looking out answers for the following questions:
Explain what sort of testing you would do on your own code?
What steps would you take to debug a function or report in SAP?

---

First test your code with '/h' type in command window which shall take you to debug or by putting break points with F8. You test your program from code and then go to se30 performance analysis transaction and there you can know what are the drawbacks. Then go to SLIN transaction and do extended syntax check or from code in menu options where you have debugging -> extended check and the program id ready without error.

Tips by : Harichand Chandunair 

Testing your code.

As mentioned above after doing syntax check and extended syntax check you have to create a TEST PLAN. You have  to  test all possible Postive & Negative test cases. 

Test for division by zero if it involves calculation or code accordingly. 

Try to test for field overflows. If it involves sap script or smart forms  try to  print  outputs which have single page and also multiple page and which does not have any output at all. 

Test by leaving all parameters in selection screen blank. 

Test by  entering  wrong  values in selection screen and display a pop-up if the user enters wrong selection screen values.

You can also do ABAP trace and SQL trace to make sure that your program is efficient.

Debugging code/program.

As mentioned above type /h in command line and try to execute the program. Another way is to set break-point at the function module or the required line and do single step execute or execute.  Once you finished debugging, you can select Delete to clear all the break points.

Testing and Debugging ABAP

Third option in certain  cases is to  check for sy-subrc <> 0  and proceed from there by  making it 0 by updating the sy-subrc in the debug editor  and  see how the program  behaves if the value is what  you enterd in the debug screen. For certain case  try to use WATCH POINT feature in debug  editor. 

Fast Links:
Get help for your ABAP problems
Do you have a ABAP Question?

SAP Books
SAP Certification, Interview Questions, Functional, Basis Administration and ABAP Programming Reference Books

ABAP Tips
ABAP Forum for Discussion and Samples Program Codes for Abapers

Best regards,
SAP Basis, ABAP Programming and Other IMG Stuff
http://www.erpgreat.com

All the site contents are Copyright © www.erpgreat.com and the content authors. All rights reserved.
All product names are trademarks of their respective companies.  The site www.erpgreat.com is in no way affiliated with SAP AG. 
Every effort is made to ensure the content integrity. Information used on this site is at your own risk. 
 The content on this site may not be reproduced or redistributed without the express written permission of 
www.erpgreat.com or the content authors.