
Mindset of SAP Documentation Capable Program Code
Contents
In order to easily generate TS documentation, you need to follow a few basic principles. We provide assistance with this in this section and introduce some features that you can use to make your development more document-friendly. Let's take a look at these tools one by one.
Recommendations:
1. Use the SAP standard documentation transaction
As far as possible, use the documentation tool provided by SAP, which can be accessed using transaction code SE61. If you use this function the TS generator will transfer these descriptions into the TS document.
You can find further information about the SE61 Documentation and how it works at the link below.
2. Use correct object description
In many cases, the object description field is not filled in or is filled in incorrectly. For example, if we create an new include program, SAP fills the description field with a default text. The object description field should be descriptive, which is reflecting the purpose of the object.
Let's look at an example of an incorrectly filled in description field. It is important that this field is filled in correctly, as it will also appear in the TS document. The description fields of the objects managed by the program appear in the document.

Correctly filled description field, as it appears in the document:

3. Delete unused code, don't just comment it out
It often happens that developers simply comment out unused code, which reduces the transparency of the program. Version tracking allows us to compare our old codes with each other. This allows our TS document to be generated in a more transparent format.
4. Use TOC but turn off TOC version generation
Do not release the transport if development is not yet full complete. If you want to import it into a TEST system environment, use Transport of Copies (TOC) instead of Transport release. Also, turn off TOC version generation, as this is only part of the development process and not the a final version.
You can find more information on this topic at the following link:
5. Use code template
SAP allows you to create predefined code templates. When you start transaction SE38, you will find a button in the bottom right corner that you can use to access these templates. Here you have the opportunity to create a new personalized template that can be automatically inserted into the code. You can insert various tags into the template, even variable fields as well.

Once the template is ready, all you have to do is use it in the code.
All you have to do is enter the name of the template (in this case, *h) and press TAB.



6. Use comments before or after the programming units
/TSDOC/REGEX table contains the regular expressions based on which a newly created program's TS document is generated. This table can be maintained by transaction SM30 (/TSDOC/V_REGEX ). The program looks for the string in program code based on the regular expression and takes over all comments of statement from environment into the TS document.
You can find further information about the /TSDOC/REGEX table and how it works at the link below.
7. Use code marker when creating new code
Some settings reach from /TSDOC/PARAM table, which can be maintained by transaction SM30 (/TSDOC/V_PARAM). This table contains the BLOCK_BEG and BLOCK_END parameter for code marker. The code marker is used to insert a specific code snippet into our TS document.
You can find further information about the code marker and how it works at the link below.