Introduction

In this article, we are going to explore the classic specification pattern and implement it in order to compose the LINQ queries, and also non-LINQ queries. This article will also help beginners in understanding the specification pattern and how to implement it in practice. Major benefits of the specification patterns include reusability, maintainability, loose coupling of business rules from the business objects, readability and easy testing.

Specification Pattern

Specification pattern as per the definition from Wikipedia, is a particular software design pattern, wherebybusiness rules can be recombined by chaining the business rules together using boolean logic. To put it simply, business rules are segregated based on the Single responsibility principle (SRP) and chained or composed using boolean operands (AND, OR or NOT) to achieve the desired result. Each segregated business rule is called Specification.

Each specification inherits the abstract CompositeSpecification class which defines one abstractmethod called IsSatisfiedBy. This method is the engine of specification pattern. The responsibility of this method is to apply the business rule (specification) on the object in question and return a boolean result. The primary goal of the specification pattern is to select the subset of objects that satisfy a set of specifications chained together.

 

More infor:

codeproject

ABAP 

Using SALV (object oriented model) has many advantages:

  • Simplified design: This Model uses a highly integrated object oriented design which provides the simplicity to programmers to develop the ALV.
  • Unified Object models: This model has only one main class which will get and set the parameters of entire layout.

All Classes has static method FACTORY which will get back the instance of the ALV. Like for the simple table dispaly we must call the method CL_SALV_TABLE=>FACTORY to get the instance of the ALV.

SALV class

SALV class

 

Simple case to display table:

DATA lo_salv TYPE REF TO cl_salv_table.
TRY.
cl_salv_table=>factory(
IMPORTING
r_salv_table = lo_salv
CHANGING
t_table = lt_sflight ).
CATCH cx_salv_msg INTO lx_msg.
ENDTRY.

lo_salv->display( ).

Add standard PF Status

DATA: lo_functions TYPE REF TO cl_salv_functions_list.
lo_functions = co_salv->get_functions( ).
lo_functions->set_default( abap_true ).

 

Shortcut What it does
Ctrl + D Duplicate any line.
Ctrl + U Selected text converted into uppercase..
Ctrl + L Selected text converted into lowercase..
Ctrl + J Selected text will become capitalize.
Ctrl + O Goto a particular line in the program.
Ctrl+Alt+T Swaps current line with the Upper Line.
Ctrl+Shift+L Deletes the whole line

Otherway, we can created a new shortcut for selected command via using Keyboard option as the following picture

KeyBoard Options

KeyBoard Options

If you want to save your keyboard and import into new PC, you can do the following steps.

Checking SAP folder “C:\Users\XXXX\AppData\Roaming\SAP\SAP GUI\ABAP Editor”, you will found a folder named SAP GUI and in this folder, select find keymap.xml this is Keyboard mapping file, you can use this to import when having new computer.

Hope that help!