ABAP Editor/Workbench Custom Dynamic Patterns

In my last post ABAP Editor dynamic patterns, We saw how we can use the patterns to our advantage.

Today, I wanted to expand upon further features of dynamic patterns, which is the ability to write and add your own dynamic patterns.

Let's say you want to define a template for the generation of DB validation code and provide your table name as input.

Creating the Pattern.

From the ABAP editor,
Select Utilities > More Utilities > Edit Pattern > Create Pattern and enter a name for your pattern.


ABAP Editor Create new Custom Pattern

Type name for the pattern:

ABAP Editor Create new custom pattern Name

You will be presented with a text editor screen, Add the following code:
*$&$MUSTER
The above code tells the runtime to call a function module with the naming convention:
<pattern_name>_editor_exit. >ABAP Editor Create new custom pattern Code

The next obvious step is to create the FM with the above-discussed name.
The FM has a defined interface of a TABLES parameter BUFFER of type RSWSOURCET.
The table is used to pass back the code to the editor.

ABAP Editor Create new custom pattern FM
Insert Below code in the source code tab.

Call the new pattern:

ABAP Editor Call  custom pattern

Input table name:ABAP Editor Call  custom pattern

Generated Code:

ABAP Editor Call  custom pattern
So there you have it, Your own Dynamic pattern to help you out with writing DB Existence check.

Offcourse, You can expand upon it or create your own pattern with extra functionalities.
As always, Hope you like the post and use the information in your day-to-day work.

Popular posts from this blog

ABAP convert internal table to excel (.xlsx) format and Send email or download

ABAP read excel(.XLSX) file to internal table in ABAP using CL_FDT_XL_SPREADSHEET

Application Logging in ABAP