“SAPscript forms breakdown helper” is a free tool for analysing forms. It has different features to help you understanding the structure of a form and the used SAPscript commands. Therefore you are quickly ready to decide what has to be changed to fulfill your requirements. Please note that you cannot make changes to a form with this tool. That’s the task of transaction SE71 which you can easily call from the tool.
Current version is 2017.2-01 (23.04.2017).
Please pay attention to the license, disclaimer and installation section at the end of this blog. It is not recommended to use this tool in productive environment.
Download latest version from GitHub.
A reduced german translation of this blog is available on Berater-Wiki.
2017.2-01 (23.04.2017): navigation to source code of subroutines | statistics (enfolded different metrics like source lines of code (SLOC), McCabe and Halstead)
2017.1-01 (01.01.2017): navigation to included text via transaction SO10 | better F4 help to select a form on selection screen
2016.4-02 (01.11.2016): edit line via transaction SE71 in same and new window
2016.4-01 (03.10.2016): easy color selection via selection screen | update checker | collapse and expand of blocks
Using SAPscript forms to output document data is a long time used and well proofed technique. New projects normally do not make use of this aged technique but there are still a lot of forms in use. Therefore many programmers will face the same scenario some day: You will have a requirement to change an existing SAPscript form. And that’s not easy, especially when different conditions in combination control the program flow.
In this context I remember one sentence of the book “Back to Basic” (John G. Kemeny, Thomas E. Kurtz): “Programmers now generally agree that indentation, properly used, helps them understand programs” (page 35). In forms there is as far as I know no automatic indentation and that makes understanding program flow extremely difficult.
So please have a look at my approach to make it a lot easier to understand a SAPscript form and save time by planning your changes goal-oriented. I wrote an ALV tool with the following features to support breakdowns.
Please note that the following screenshots are just for demonstration purpose.
The missing feature to make it a lot easier to analyze a SAPscript form. Actually it works with IF, ELSE, ENDIF, CASE, WHEN and ENDCASE statements. In the ALV you have two columns: “Original” and “Adapted”. Only the “Adapted” column use indentation and so you have the option to compare with the original source.
A nice feature to identify the partner of a IF or CASE statement. You can double click on IF, ELSE, ENDIF, CASE, WHEN and ENDCASE statements. Double click is only working on the “Adapted” column.
Integration of Form Painter (transaction SE71)
In context menue (right click) you will find two functions called “Edit line in same window” and “Edit line in new window”. By these functions, you can easily switch between doing breakdowns and changing a form. Please note that both functions will only work with up-to-date releases of SAP Basis like 7.50 and you have to deactivate the graphical editor in “SAPscript” section of your personal settings.
To get a fast evaluation of a form, you can use the function “Show stats” (have a look at the context menue). You will find different metrics like source lines of code, McCabe and Halstead. To be fair, I’m still thinking about the benefit of some Halstead measures like “Difficulty” in context of SAPscript. So please do not pay too much attention to these measures at the moment – I will have to spend more work on this topic later.
Navigation to subroutine
You can double click on an PERFORM statement. The software will forward you to the source code of the subroutine. That’s nice to easily get a clue of what is happening with the parameters of the PERFORM statement.
Integration of Standard Text (transaction SO10)
You can double click on an INCLUDE statement. The software will forward you to the selection screen of transaction SO10 and all fields are filled with proper values of the statement. Please note that this feature will only works with static standard text.
Collapse and Expand
You can collapse and expand IF/ENDIF and CASE/ENDCASE blocks by the symbol in the column “Collapse/Expand Icon”. Please note that this feature is implemented with ALV standard filters. If you work with additional filters please do not change the values in the field “Collapse/Expand Id”.
Colors are a good instrument to distinguish different formats. You can set up to 4 different colors to mark lines. On selection screen, you can choose them from a dropdown list or you can define the colors by their color codes. Choose the option “individual” from the corresponding dropdown list to open the “Color code” field for input. Have a look at the internet for an ALV color palette (for example http://www.kerum.pl/infodepot/00005).
Up to 5 symbols will be detected in an SAPscript statement. The symbols will be placed in own columns of the ALV, called “Symbol 1” and so on. Therefore you are able to sort by your needs.
Copy to Clipboard
You can simply copy the content of the “Adapted” column to your clipboad and paste it into your form (SE71). You will find the function by using the context menu (right click). Mark one or more rows first.
You can simply look out for new versions of this tool via the update check button on selection screen. Your version is shown next to the button. By pressing the button your standard browser will open this blog. There you can compare with latest version and download if necessary.
There are ideas to implement new features or to improve existing ones. Here are some of them:
- In combination with a printer program it’s possible to get additional data dictionary information about program symbols.
- Bring your own code (BYOC): To bring your source code and the latest release of this tool in line, different user exits would be useful.
If you have any ideas for more features: You can implement them by yourself or you can contact me to implement them. Anyway it would be nice to share your ideas.
License and Disclaimer
In very simple words: It’s free. Until now it was an interesting and funny free time project, not more. The idea was to make life of every developer, consultant and user a little bit easier. If you can save one minute by using this tool you have one more minute for coffee break and to talk with your friends and colleagues about new ideas. So please feel free to use it, to improve it and to share it (not sell it).
I do not take any responsibility and I am not liable for any damage caused through use of this tool. Use it at your own risk. It is not recommended to use this tool in productive environment.
I put all source code in one report (have a look at the attached file). That makes it easy to adapt it to your development system. I had to apply some perhaps unusual techniques to implement features I want because everything had to fit in one report. So please forbear with me.
Instead of right click menu you can work with your own GUI Status as long as you will use the same function codes.