Here a few rules to follow when developing ABAP code:
Rule 1: Why?
You probably know that ABAP stands for Advanced Business Application Programming but maybe it should stand for A Better Alternative Possible? because this is what you should consider every time you are asked to create a new ABAP report. "Our old system used to do this” or "We don't want to use the SAP equivalent component” are some of the reasons why a custom programs are asked for but you need to understand the business benefits and consider the alternatives.
Bespoke code will need to be developed, tested and supported through system upgrades. Yes the finished product may be easier and quicker to use but if the development and support time adds more time than it saves, it may be more efficient to use Standard SAP reports if available.
What are the alternatives for reporting or data transfer?
â€¢ Existing SAP reports
â€¢ SAP (ABAP) Query
â€¢ Report Writer
â€¢ SAP Transfer Workbench
Rule 2: Is the data being accessed in the most efficient way
Things you need to consider to ensure you get the optimum performance from your code are as follows:
â€¢ Is the design is correct in the first place
â€¢ Are the correct tables being used
â€¢ How is the code affected when the amount of data increases.
Rule 3: How are any errors handled
Rule 4: What are the security issues with this ABAP report
See here for further information on Security specific ABAP code
Rule 5: Is there validation on the selection screen
Rule 6: Does the code contain any hard coded values
If possible try not to use hard coded values as this can cause support issues further down the line. i.e. if the value you have hard coded changes you need to update the program with the new value, test it and then transport it through the SAP landscape. This is ok if it's just one program but if there are multiple programs then this job can become time consuming.
Just imagine if you had written numerous programs which retrieved data based on company code and you had hard coded this value. Then your company needs to use a second company code on the same SAP system, you would then need to modify every program where you had hard coded company code.
Rule 7: Is the ABAP going to be used international
Does the code need to display text in multiple languages, use multiple currencies or even handle different company codes if a different one is used for each country?
See here for further information on Country specific ABAP code
Rule 8: Have you commented your code
Rule 9: Is the ABAP report/program documented
Rule 10: Will it transport ok
Is everything activated and ready to go, also are all components transportable or do you need to create some of them manually in each system?