Wednesday 4 January 2017

SAPscript forms breakdown tool

Overview

“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.1-01 (01.01.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 here.

Introduction

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.

Tool Features

Please note that the following screenshots are just for demonstration purpose.

Indentation

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.

SAPscript forms breakdown tool

Accentuation

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.

SAPscript forms breakdown tool

SAPscript forms breakdown tool

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.

SAPscript forms breakdown tool

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”.

SAPscript forms breakdown tool

SAPscript forms breakdown tool

Colors

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.

SAPscript forms breakdown tool

SAPscript forms breakdown tool

Symbol Detection

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.

SAPscript forms breakdown tool

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.

Update Checker

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.

SAPscript forms breakdown tool

Upcoming Features

There are ideas to implement new features or to improve existing ones. Here are some of them:
  1. In combination with a printer program it’s possible to get additional data dictionary information about program symbols.
  2. By double clicking a PERFORM statement it’s possible to view the corresponding source code.
  3. By double clicking an INCLUDE statement the corresponding text is shown.
  4. There could be a function to detect structure errors.
  5. To support the “Copy to clipboad” feature, editing a line of the ALV or adding new lines could be an interesting feature.
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

License

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).

Disclaimer

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.

Installation

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.

No comments:

Post a Comment