Style Tips 

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]“
Set V[MM01_IndustrySector]   “&F[Industry sector]“

 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]“
Set V[MM01_industry_sector]  “&F[Industry sector]“

 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[MM_IndustrySector]    “&F[Industry sector]“

Set V[VA_Type]              “&F[Order type]“
Set V[VA_ShipTo]            “&F[Ship to]“

Be extremely careful with the naming of internal status variables. A coding like

if V[flag=X]
  Set V[flag2] “N”
endif

is next to useless when we have to deal with the script again a year later.  Instead, 

if V[MM_MaterialCopyDone=X]
  Set V[MM_DisplayCopyButton] “N”
endif

makes our work easier. A short comment is reasonable: 

// Suppress “Copy” button later on if copy already done
if V[MM_MaterialCopyDone=X]
  Set V[MM_DisplayCopyButton] “N”
endif

Last update: July 4, 2004

Apply a consistent and descriptive naming scheme for your variables