clean up comments in SAPscript
Dear community, comments are basically a good thing. In SAPscript forms, however, I discovered the following situation quite often when using SE71.
The example is fictitious, but in my experience often found in practice. There are more comments than executable SAPscript statements. The representation in transaction SE71 is confusing, too.
The comments also contain similar content as “XY, 15.xx.xxxx, INS, BEGIN” or “-> xy15xxxxxx, INS”. In addition to the comments that contain the word “BEGIN”, you will also find the matching comments that contain the word “END” … but sometimes that’s not the case 😉 Ultimately, the readability is drastically reduced by the large number of comments without adding value.
Of course, useful comments are important in SAPscript. That has different reasons. Here are three examples:
- You don’t want to use the SAPscript debugger to understand specific issues. The debugger is simply too “special”.
- The use of descriptive variables is not always possible due to the link to the print program – the print program could be used by different forms.
- Historic terms such as “T024E” or “T001G” are not immediately clear.
In my opinion, such comments as shown in the figure above should be deleted whenever possible. This gives you a better overview. As a result, maintenance is much easier. And the pre-analysis to move to a different technology such as SIFbA will also be easier.
In the past I already talked about my open source solution “SAPscript forms breakdown helper“. It also helps with the evaluation and subsequent editing of comments. Whereby this is about quantitative evaluations and not content-related evaluations.
On the one hand, you can use the colors to visualize the ratio of comments to other instructions. Pay attention to the color choice on the selection screen. This works only if you are not color blind and may look like the following figure.
On the other hand you can use the statistics to evaluate the quantity ratio. Pay attentation to the context menue. This information is a good indicator, too.
At the end a small note: While deleting the comments you should not delete the useful comments. That happened fast enough 😉
And here is one of my favorite experiences regarding comments in SAPscript: A window in which about 50 lines of formerly effective statements were commented. No information why the instructions were commented … but you could read the developer’s abbreviation and the date of the change 🙂
Have a good time and thanks for reading