Skip to Content

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

A reduced german translation of this blog is available on Berater-Wiki.

 

Changelog

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

 

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.

 

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.

 

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.

 

Statistics

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

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

 

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.

 

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.


 

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

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.

To report this post you need to login first.

25 Comments

You must be Logged on to comment or reply to a post.

  1. Peter Inotai

    Hi Michael,

    Thanks for sharing it. I tried it quickly and found it really useful.

    I didn’t like the color codes in the selection screen, but not a big deal, played around until I liked it and saved it as a variant.

    One more idea:

    Collapsing IF-ENDIF block could be also useful to implement similar to new ABAP-Editor, however I’m not sure how difficult it would be. Just an idea 🙂

    Best regards,

    Peter

    (0) 
    1. Michael Keller Post author

      Hi Peter,

      at first thanks for testing the tool and your feedback 🙂

      You are right, color codes are really user-unfriendly. I think dropdown-lists with predefined color codes and corresponding caption would be the better choice.

      The idea of collapsing IF-ENDIF blocks is great. Complexity could be easy reduced by a feature like that. I think it should not be as hard as it sounds to implement because we can use the values of column “Level” to identify a block. With a new column consisting of an icon like “+” or “-” next to the column “Adapted” the user can expand or collapse a block (unhide or hide some lines).

      I think I can implement the two features with the next version of the tool.

      Best regards,

      Michael

      (0) 
      1. Peter Inotai

        HI Michael,

        A drop down approach would be great for the color codes.

        I think I can implement the two features with the next version of the tool.”

        That sounds great, thanks!

        Peter

        (0) 
      2. Peter Inotai

        Just noticed that there is a new version, so I quickly installed it.

        I like the color codes in the selection screen this way much better and also the Collapse/Expand feature. Thanks for implementing them!

        Peter

        (0) 
        1. Michael Keller Post author

          Hi Peter,

          nice to hear that you like the new features. And thanks again for testing them.

          At the moment I’m thinking of a easy way to integrate transaction SE71. In my opinion most people will first analyse the form, then change or enhance the form. So the tool should offer an easy possibility to switch to the proper SAPscript lines. Perhaps a call transaction with batch input could be a solution. I will check that soon.

          Best regards

          Michael

          (0) 
          1. Peter Inotai

            Maybe it’s also worth to check how the download/upload tool (RSTXSCRP) implemented saving the changes, it could be easier than batch input.

            Peter

            (0) 
  2. Sandra Rossi

    For GC_SPACE, to “simplify the distribution”, you may change it to :

    DATA gc_space(1) TYPE c.
    
    gc_space = cl_abap_conv_in_ce=>uccpi( 160 ). " U+00A0
    (0) 
    1. Peter Inotai

      For me in the editor when I copied and pasted the code from notepad came a popup if I want to convert the special characters. I just pressed no, and it worked fine.

      Peter

      (0) 
    2. Michael Keller Post author

      Hi Sandra,

      thanks for your tip. I will check that as soon as possible. It’s always a good idea to keep things clear and simple. To have everything in one big text file is a great advantage and user friendly 🙂

      Best regards

      Michael

      (0) 
    1. Michael Keller Post author

      Hi,

      you’re welcome. There are a lot of ideas to make the tool better. Next version is coming and hopefully it is still easy to use but more useful than today … 😀

      Best regards

      Michael

      (0) 
  3. Viral Shah

    Hi Michael,

    Pardon my silly question here. But I did not see attachment in the blog.

    Based on the reply on the blog I am eager to use this. But Seems I am not good at finding attachment here.

    Thanks for your help here.

    Viral Shah

    (0) 
    1. Michael Keller Post author

      Hi Viral,

      I have to excuse oneself for the missing attachment (source code).

      As I noticed that, I talked with the support team (at this point my thanks goes out to Kirill, Monika, Dan and all other helpful people). They told me that my blog was moved when SCN was upgraded and attachments were lost because the function to have attachements is not existing anymore.

      At the moment I’m looking for web space to store the source code and to link it in my blog. Then everyone would be able to download it as it was possible in the past.

      As a fast solution for the problem: Everyone who is interested in using the tool, please get in touch with me. There is an option to send direct messages in SCN. If you send me your e-mail address I can send the source code to you.

      Best regards
      Michael

       

      (0) 
  4. Peter Inotai

    Hi Michael,
    Thanks for the new version (2016.4-02).
    Just had a quick look.
    Unfortunately I got syntax error in basis release 7.02 due to the message statements with &&. After changing them it worked fine. BTW I also got a warning for gc_burl3, because the value was longer than the definition.

    What I liked:
    – jumping directly to the line is really nice feature
    What I would like:
    – the F4 help for the the form in the selection screen jumps to the tree view, but I personally prefer the characteristic search (just like in SE71: Form -> Find).

    It’s nice to see that this tool is getting better and better 🙂

    Best regards,
    Peter

    (1) 
    1. Michael Keller Post author

      Hi Peter,

      as always: Thanks for your help!

      My development platform is a basis release 7.50. I will not use new syntax elements in future releases of the tool to avoid problems as you described. The current problems will be fixed as fast as possible.

      I will check your idea with the F4-help. The tree view help is really not a good F4-help.

      Best regards
      Michael

      (1) 
    2. Michael Keller Post author

      Hi Peter,

      sorry for the long delay. I had a lot of things to do. Unfortunately further development had to wait. But now new version is ready. Syntax errors and warnings are repaired. F4 help is enhanced. You can decide which one you want to use. And forward navigation to transaction SO10 is integrated. Just double click on a static include statement. Furthermore I did some research on forward navigation to transaction SE38 by double clicking on a PERFORM statement. Perhaps that’s coming with next version 🙂

      Best regards
      Michael
       

      (1) 
      1. Peter Inotai

        Hi Michael,
        Thanks a lot for the update.

        F4 help is really nice. 🙂
        SO10 is also a good idea, however most of the time I use dynamic ones.
        PERFORM would be also useful, I’m looking forward to it 🙂

        BTW it would be useful to add a feature list to the blog every time you have an update. This way it’s immediately visible what was changed, what is new without going through the comment section of this blog.

        Best regards
        Peter

        (1) 
    1. Michael Keller Post author

      Hi Jelena,

      you are welcome. As you said: interesting – the tool offers some possibilities for more useful functions.

      Here is an example: At the moment I’m thinking about the idea to calculate a score. The concept behind the score is to easily see how complex a part of a form or even the entire form is. Could be an indication for how many hours a developer has to spend to change something or how many time a tester should spend.

       

      Best regards

      Michael

      (0) 
  5. Peter Inotai

    Hi Michael,

    Thanks for the notification about the new version:2017.2-01 (23.04.2017).

    I had problem again on 7.02 system, but they could be fixed in 10 sec 🙂

    • in alv_caller_exit():  syst_title does not exist, but replaced with CHAR70
    • in  FORM form_edit the select  FROM rseumod, the INTO part was with space for the brackets. After I removed the spaces, it worked fine

    I also noticed if I select the ALV layout in the selection screen, it’s not taken in the result screen.

    SO10 picked up the whole line as value (Example line: INCLUDE ‘SD_RVADIN01’ OBJECT TEXT ID SDVD PARAGRAPH HT, in SO10 it tried the whole to display “SD_RVADIN01 OBJECT TEXT ID SDVD PARAGRAPH HT”).

    I have to admit, I never heard about McCabe and Halstead before. Now I have something the read 🙂

    Best regards,

    Peter

    (1) 
    1. Michael Keller Post author

      Hi Peter,

      thanks for your tests. Sounds like homework for me 🙂 Will fix the problems as soon as possible. And please tell me about your experience with the statistics in private chat. I think there are a lot of improvements to do. But first step is done …

      Best regards

      Michael

       

      (1) 
  6. Gernot Schwartz

    Hello Michael,

     

    helpful stuff indeed.

    But when printing the ALV-result, the <space> used for indenting is translated into <#> which overthrows most of your efforts. I therefore added a new paramter on the selction Screen and moved the relevant coding to another place. You will easily identify my changes by todays date.

     

    If I just could get the coding transmitted to you…. I could not find an “attach”-button in here. ‘am just too dumb 🙁

     

    BestRegards

    Gernot

     

     

    (0) 
    1. Michael Keller Post author

      Hi Gernot,

      thanks for your help to improve the tool. I don’t know any function to share source code in a SAP community network blog. Therefore please send your source code to <deleted>.

      I will adopt your changes to my latest version.

      Best regards and thanks in advance

      Michael

       

      (0) 

Leave a Reply