|
Topic | Date / Examples / Link to comments |
5 Apply a consistent and descriptive naming scheme for your variables A variable that is used only locally within a range of a few lines, like a line index, can have a short name like V[i]. All other variables should have meaningful names. It often makes sense to start with the transaction code (capital letters) , an underscore, and a short descriptive name that uses upper and lower case letters:
Set V[MM01_MaterialType] “&F[Material type]“ A different convention is to use only lower-case letters after the underscore, and to use an underscore as separator between the words: Set V[MM01_material_type] “&F[Material type]“ Make a decision on which convention to use and then do not not mix up the conventions. When your script deals with several transactions, e.g. MM01, MM02, MM03, define a suitable group identifier (eg. MM for material master transactions, VA for order entry, change and display): Set V[MM_MaterialType] “&F[Material type]“ Set V[VA_Type] “&F[Order type]“ Be extremely careful with the naming of internal status variables. A coding like if V[flag=X] is next to useless when we have to deal with the script again a year later. Instead, if V[MM_MaterialCopyDone=X] makes our work easier. A short comment is reasonable: // Suppress “Copy” button later on if copy already done | Last update: July 4, 2004 |