Sunday 9 October 2011

Things to Remember while Programming in SAP ABAP – Part 1


In Any programming language a good program should take care of following 5 aspects
  • Flexible
  • Robust
  • Extensible
  • Easy to understand
  • Easy to maintain

There are some aspects that can be brought in ABAP(Though they will fall under any of the above mentioned categories) which will serve the full value to the purpose.
They are:

1)      Modularize your Code :
 While Developing the code don’t write the pages of code without using the modularization techniques, this will give good chance of reusing the redundant code, helps you to have clarity on the code and will helps your buddies to understand the code Easily.
The best way to use modularization Is to use performs.       

2)      Use the Standard function modules
Use the standard function modules in as far as possible in the Code, Don’t try to write the logic blindly, The logic that you have developed might not work when deployed in the different system as you might only code for the current configuration settings. For example. Currency conversion settings will be different for each currencies, Standard currency conversion function modules will be the best and easiest way to use

3)      Avoid Hard coding
Always don’t do any hard coding in the program, especially if there are any configuration items, try to fetch the configuration values from the table and use the same. Don’t ever do any hard-coding in the program. If there is no other go, use Constants instead of hard coding directly in the program.
One more technique is to create a custom table and store all the values for Hard coding in them and use them in the program. If there are any changes in those values, you just need to change the items in the table and you don’t need to change the program.

4)      Document you code
Use Comments and provide some documentation in the program, this will be usefull to the guys who will maintain the code in the future.

5)      Use Coding Standards
In most of the ABAP Development projects there will be coding standards defined, always don’t deviate from the coding standards already defined. This will be useful for the other members in the team to understand you code.
  
6)      Think about Performance of the system
Always consider the performance aspects while developing the ABAP code. Think about the size of the tables that you are going to access in the program. Try to avoid nested loops, nested Selects in the program. Try to use Binary Search in your program wherever applicable

 7)      Understand the target landscape for which you are developing the code.
One of the main thing that you should be careful while developing any code is to make sure that the code that you are developing fits your target landscape, you can deliver a better value only by having a good understanding of your target landscapes. If it is a large transformational project, then make sure that you a frequent discussion with the enterprise architect.

To Be Continued …..

No comments:

Post a Comment