SAP ABAP Editors like SE37 / SE38 have provided cool feature of Patterns. One can add ready made statements into his program directly and modify as required. This is very useful when programmer has to deal with complex statements frequently because adding template type patterns avoids risk of errors and reduces efforts of typing. Making patterns of frequent queries ensures correct syntax.
How to use statement patterns in the ABAP Editor:
...
1. 1. In change mode of ABAP editor, click on Pattern button on tool bar and you will see a pop up with different options to choose from
2. Choose the required pattern and, if necessary, the statement. Click on continue.
3. Fill out the pattern with the required information.
4. Choose continue to confirm your entries.
5. The system inserts the statement at the cursor position in the program code.
This is the list of pattern options:
Statement | Explanation |
CALL FUNCTION | Inserts a function call. |
ABAP Objects pattern | Inserts the following basic ABAP Objects statements: CALL METHOD CREATE OBJECT RAISE EVENT RAISE EXCEPTION |
MESSAGE | Inserts a MESSAGE statement for a specified message. You need to enter a message ID, a message type and number. |
SELECT * FROM | Inserts a SELECT FROM <table> statement. You need to enter a name of an existing table and then select the fields you want to be included in your SELECT statement. |
PERFORM | Inserts a PERFORM statement for a specified form. |
AUTHORITY-CHECK | Inserts an AUTHORITY-CHECK statement for a specified authorization object. |
WRITE | Inserts a WRITE statement for a specified structure or table. |
CASE | Inserts a CASE statement for a specified status. |
Structured Data Object
| Inserts a structured data object. You can copy the fields or the structure of an existing table. |
CALL DIALOG | A CALL DIALOG statement for a specified dialog module. |
Other pattern | Inserts a predefined or user-defined ABAP statement. |
(Source http://help.sap.com)
Other pattern:
This is a custom template type; we can create any code snippet up to 100 lines.
To create new patterns, click on Utilities > More Utilities > Edit Pattern > Create Pattern
To change new patterns, click on Utilities > More Utilities > Edit Pattern > Change Pattern
To delete new patterns, click on Utilities > More Utilities > Edit Pattern > Delete Pattern
To display new patterns, click on Utilities > More Utilities > Edit Pattern > Display Pattern
Pattern names are not user specific so common patterns can be created which can be used across all users.
Happy Coding!