Skip to Content
Author's profile photo Thomas Fiedler

Using Wildcards in Code Completion to insert code patterns

One of the most powerful features of source code editors is for sure the code completion.

In ABAP in Eclipse you use this for example also to insert code patterns into your source code.

I described this already in one of my last blogs: Insert Code Patterns and Templates within Eclipse.

Normally you just type the first characters of the method or function to insert the pattern into your code using SHIFT-ENTER:

/wp-content/uploads/2013/05/cc1_223172.png

But sometimes you don’t know the exact name of the function or method but only parts of it.

In the insert pattern dialog in SE80 you use the F4 help to find the object that you need.

But how can you do that in Eclipse?

It is quite simple. We also support wild cards in the code completion in ABAP in Eclipse.

So let’s assume you want to call on the ALV control a method to define the layout.

Here we go. Just use asterisks and press CTRL-SPACE to restrict the result of the code completion like here:

/wp-content/uploads/2013/05/cc2_223174.png       

Or you are searching for a function that returns you information about classes. Wild cards also work for function modules as you see here in the example:

/wp-content/uploads/2013/05/cc3_223178.png

When choosing an item from the result list via SHIFT-ENTER the code pattern is generated into your code.

Another small but very helpful feature I guess.

Have fun and Regards,

Thomas.

   

Assigned Tags

      10 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Ashwani Kumar Sharma
      Ashwani Kumar Sharma

      This is not so intuitive in the beginning but quite powerful afterwards !

      Has helped in my ABAP learning days 🙂

      Author's profile photo Florian Henninger
      Florian Henninger

      This is an awesome feature 😘 (Eclipse)

      Regards

      Flo

      Author's profile photo Dmitrii Iudin
      Dmitrii Iudin

      does not work in the abap trial version, unfortunately

      Author's profile photo Florian Henninger
      Florian Henninger

      Does work very well. What version do you download?

      Tried it by using cl_alv_grid class and does exact what it should do...

      So, check for updates.

      Regards Florian

      Author's profile photo Dmitrii Iudin
      Dmitrii Iudin

      Perhapse I was not specific enough. I am using 7.03 version available for download from here http://www.sdn.sap.com/irj/scn/nw-downloads . Is it expected that this functionality should be working on that version?

      Author's profile photo Florian Henninger
      Florian Henninger

      I'm not sure, if it works in that version.

      Update your ABAP-Tools right out of eclipse with this link

      SAP Development Tools for Eclipse - Kepler Software Repository

      , then you get the tools to Version 1.90 and here, i'm pretty sure it works fine.

      Regards

      Florian

      Author's profile photo Stefan Schmöcker
      Stefan Schmöcker

      The last example "code-completion with signature and wildcards" ( CALL FUNCTION 'SEO*CLASS*GET*' ) does not work as described.

      When there are still wildcards present the codecompletion will only add the complete function or method name - but the signature won't be added even though SHIFT-ENTER was requested.

      But when the function/methodname is spelled partially or completly without wildcards ( like cl_gui_frontend_services=>gui the codecompletion will suggest gui_download and gui_upload ) when hitting SHIFT+ENTER it will add the method/function including the signature as expected.

      Author's profile photo Michael Schneider
      Michael Schneider

      Hi Stefan,

      Thanks for reporting.

      Note 1962353 should solve this issue.

      Best regards,

      Michael

      Author's profile photo Bruno Esperança
      Bruno Esperança

      Thanks Thomas.

      Not a small feature at all. Could actually even be a deal breaker for some 🙂

      Quick question, what if you don't know the first letter of the function module, does it still work?

      Thanks.

      Best regards,

      Bruno

      Author's profile photo Michael Schneider
      Michael Schneider

      Yes, this works also if you use a wildcard in the very beginning.