Skip to Content

Summary

There is a very important time-saving ABAP Editor setting that enables data declaration of actual parameters when calling a function module (FM) or class method. The setting should work fine on ABAP release 731 and above.

After enabling the setting, call pattern for FM would look like this:

Call pattern of class method would look like this:

The settings can be found in ABAP Editor > Utilities > Settings > ABAP Editor > Editor > Pattern

Story

I had seen the setting about 1 year ago on 701 release but the meaning was not so obvious. Enabling the setting did nothing on that release.

The text ( Name Actual Parameter Same as Name Formal Param. ) does not suggest that the actual parameters will be declared automatically.

F1 help or verbatim Google search returned 0 hits.

This 4 years old blog explains how to insert custom pattern (FM and data declarations) using ABAP Editor exit.

Call a function module in the ABAP Editor: Stop Crying – Start Laughing.

This ready-made solution was luckily present in my work environment. Excited by the thought of saving so much time, I started using the editor exit.

My work environment changed some time back ( different system having 731 release ) and the custom pattern was no longer with me.

I missed the functionality but didn’t install the code due to:

  1. Laziness – It is a selective thing. When it comes to touch typing, I am not lazy at all.
  2. Reluctance – Basis/Security might question me if dumps came due to that exit.

Couple of days ago I finally installed the editor exit. Nowadays I am trying to use methods instead of forms. As an exercise, I thought of understanding how the code works so that some day I’ll replace all forms with methods and probably improve the code using newer ABAP features.

The custom code reads FM’s formal parameters, determines the types, generates code for data declaration and then generates code for FM call. I thought to see how the standard generates FM call and reuse that code if possible. While debugging standard Call Pattern > Call Function, I found that there is an FM to generate the FM call. After generating the FM call code, there was additional code enclosed in IF condition. It really looked like the code is present for data declaration but it is not getting called.

The IF condition was on field of table RSEUMOD, which stores user specific ABAP workbench settings. This meant the setting can be activated somewhere in ABAP Editor settings. Added bonus was that similar setting is present for class methods too, which my custom editor exit didn’t do. I tried out same thing on 701 release ABAP trial and found that even though the setting is present in options, there is no corresponding code to do something with it.

This is how I came to know about the setting while debugging standard code.

Some Notes ℹ

  1. I am also using the option ” Functional Writing Style for Call METHOD ” . Functional-style method calls help reduce the lines of code and can be used in functional expressions. For example, try creating pattern for get_instance( ) method of some class. Generated code would have actual parameter on left hand side and functional method call on right hand side.
  2. You can export the ABAP Workbench settings to PC so that it can be imported by your colleagues.
  3. The custom pattern uses magic word *$&$MUSTER. Muster is German for Pattern.
To report this post you need to login first.

21 Comments

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

  1. Ulrich Rechner

    We’ve used release 731 for so long now, and I haven’t known about this helpful feature. I remember e.g. declaring variables for a BAPI-call with a lot of effort. Great hint!

    (0) 
  2. Ajit Kumar Panda

    Nice useful blog Manish.

    2 questions:

    1. How to export/import ABAP workbench settings to/from PC.

    2. Can you explain Point 3 of Some notes section.

    Thanks in advance.

    Ajit

    (0) 
  3. Ravi Shankar

    Hi Manish,

    Thanks for your wonderful document…I am not able to understand first point that where you create instance for pattern can you please explain it.Thanks in advance for help.

    After that if this pattern as been imported it will work to all users right ?

    Regards,

    Ravi Shankar.L

    (0) 
    1. Manish Kumar Post author

      I am inserting the code using standard Call pattern > ABAP Objects Patterns > Call Method.

      For example, see these screenshots.

      Step 1:Press Call Pattern or Ctrl F6 and choose ABAP Objects Patterns

      2014-09-23 19_16_59-Ins. statement.png

      Step 2: Call a static method that returns object instance and press enter

      With correct settings and ABAP release level, resulting code would be:

      /.

      (0) 

Leave a Reply