I can think of the following coding practises which will avoid any pitfalls in terms of performance and defects. If you can think of any other please let me know
1.Avoid writing a select condition in Loop endloop.
Try retrieving all entries before the loop , and instead use READ table.
2.Before using for all entries make sure you sort the table by field1
and delete duplicates comparing field1.
3.Before using read table with binary search , make sure the table is sorted.
4.Avoid using direct updates to table, if yes try using enque ,
dequee function modules
5.Avoid using check statements in user exits,Use IF statements.
6.When write commands used with currency or quantity fields,
make sure appropriate additions added.
7.If some data is being updated in SAP database tables then try updating
them using function module which has Update task enabled.
8.Checking of sy-subrc outside a function module call with all exceptions
commented will always return sy-subrc = 0.Hence never do that.
9.Use EQ/GT/LE instead of =/ > / <
10.Avoid move-corresponding.
11.Avoid into corresponding fields
12.Is select single used with all key fields,
if all fields cannot be specified then use select upto 1 rows.
13.Use select into table is used instead of select and then append
14.Use Function module XXX_SINGLE_READ (i.e.: -MARA_SINGLE_READ) instead of
reading of material directly from XXX (i.e.: - MARA) using SELECT SINGLE
15.Avoid using Select Endselect.
16.Clear internal tables and variables( Free Memories)