Posts

Showing posts from 2020

ABAP Editor/Workbench Custom Dynamic Patterns

Image
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. Type name for the pattern: 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. > 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. Insert Below c

ABAP Editor(SE38/80) dynamic patterns

Image
This post is about tooling around the ABAP workbench(SE80). You can speed up your development using dynamic patterns. What are patterns? Patterns are helper plugins in the ABAP workbench to help you generate a necessary call to various ABAP constructs like Methods, function modules, declarations etc. Accessing Patterns: Implicitly invoking them by opening them on the left side category and dragging and dropping them to your editor. If you are on an ABAP 7.4+ system, It generates declarations for you too. Or, You can access them by clicking on the Pattern button on the ABAP editor in edit mode. A popup appears, providing you with Options. Providing the same class and methods in the popup results in generated code. The output depends on which system you are. ABAP 7.3: ABAP 7.4: In conclusion,  ABAP dynamic patterns are a great way of speeding up and simplifying your day-to-day development effort even though they are not the only ones. T

ABAP Obsolete Statement: TABLES

 As part of the Obsolete statement series , today's post is about TABLES statement.  Syntax: TABLES wa_table . Example: It declares a data object wa_table as a table work area whose data type is taken from the identically named table wa_table in the ABAP dictionary. DB tables and views can be used to declare their work areas using TABLES statement. Table work areas declared using TABLES are interface work areas ( a special data object that can act as a cross-program interface between program and screens or logical databases. The statement TABLES is not allowed within classes anyway. Since obsolete database accesses requiring the statement TABLES and shared data areas between programs are not allowed, there is no need to use the statement TABLES . In other words ,  The main purpose of the TABLES statement is to act as an interface work area to share data across programs and screens, since the shared data areas between programs are not allowed, the tables

Difference between Chaining operator(&&) and Literal Operator(&)

Image
Recently I talked about the Chaining Operator(&&) and how it simplifies dealing with texts and strings. I wanted to talk about a similar-looking operator with some similar functions to the chaining operator which makes it easy to confuse each other. A literal operator( & ) is used to join two or more literals to produce a single literal. However, there is a hard character length limit of 255. Example of using a literal operator: There are more features and limitations to a literal operator. Below are the points on which it's similar/different to a Chaining operator.     - Similar to the chaining operator, you can use join string templates using & .     - Any trailing blank in text field literals is preserved, unlike chaining operator.     - Can span multiline:      - Calculated at compile-time.     -  Can not have more than 255 characters(See the error in the above image), if you w

ABAP Chaining Operator && and how to use it

I am not particularly fond of the excess of the ABAP statements to achieve simple tasks and really like the new adaption to operators and predefined functions to achieve similar or sometimes better results. In line with that, this post is about my favourite, chaining operator or && . For folks who have never seen this or want to know more about it, What is a Chaining Operator? The chaining operator concatenates two operands in a string expression as a character string. It has the ability to allow string expressions, predefined functions or functional methods, and even method chaining at its operand position.  To Me, It's an upgrade over the good old CONCATENATE statement. Syntax: … operand1  && operand2 … . Below are a few examples of Chaining Operator and its usage. Simple Concatenation:  Adding Separator: Adding Different Separators in a text: Notice how effortlessly different separators can be embedded in th

ABAP OBSOLETE Statement: MOVE

It's time to talk about another obsolete statement that unfortunately still gets seen around. It's the good old MOVE statement. Syntax: MOVE " Source " TO " Destination ". It's an obsolete form of assignment back from the days when ABAP was more descriptive and English in nature than it is now. Also, the statement  MOVE was created at a time when assignments were only made between individual data objects. This statement is not appropriate in a modern, expression-oriented ABAP program that exploits all options on the left and right sides of assignments. Replacement Statement is assignment Operator( '=' ).  Below is a small example: