Advanced ABAP PACKT Tutors Dec

16
Advanced ABAP PACKT tutors dec. 2014 See also : “Design Patterns in Object-Oriented ABAP “published by SAP-Press ABAP Design Patterns Design patterns provide you with proven solutions for everyday coding problems, and this book shows how to apply them to your favorite language: ABAP. Including the MVC pattern in Web Dynpro and the Factory pattern, this second edition now covers all important patterns and all up-to-date ABAP techniques. Learn how the experts code patterns and immediately benefit from better stability and maintainability of your code! Get a detailed introduction to the concept of design patterns Learn how to easily implement Singleton, Adapter, Composite, Decorator, Factory, Façade, and MVC Including MVC implementation for Web Dynpro ABAP ABAP design patterns section covers the uses and implementations of design patterns in ABAP Objects. The ABAP design patterns are extremely powerful blueprints for ABAPers or SAP Architects in design phase of SAP development projects. ABAP design patterns allow common problems to be solved through proven and well-known solutions. In addition, ABAP design patterns ensures correct ABAP code is developed faster with less mistake that will occur in both design or implementation phases. We assumed that you have basic knowledge of ABAP Objects and to be familiar with UML to follow our ABAP design patterns tutorial. ABAP design patterns are grouped into three categories: creational patterns, structural patterns and behavioral patterns. Let’s dive into each individual design pattern and see how it works.

description

SAP ABAP tutors

Transcript of Advanced ABAP PACKT Tutors Dec

Advanced ABAP PACKT tutors dec. 2014

See also : “Design Patterns in Object-Oriented ABAP “published by SAP-Press

ABAP Design PatternsDesign patterns provide you with proven solutions for everyday coding problems, and this book shows how to apply them to your favorite language: ABAP. Including the MVC pattern in Web Dynpro and the Factory pattern, this second edition now covers all important patterns and all up-to-date ABAP techniques. Learn how the experts code patterns and immediately benefit from better stability and maintainability of your code!

Get a detailed introduction to the concept of design patterns Learn how to easily implement Singleton, Adapter, Composite, Decorator, Factory, Façade, and MVC Including MVC implementation for Web Dynpro ABAP

ABAP design patterns section covers the uses and implementations of design patterns in ABAP Objects. The ABAP design patterns are extremely powerful blueprints for ABAPers or SAP Architects in design phase of SAP development projects. ABAP design patterns allow common problems to be solved through proven and well-known solutions. In addition, ABAP design patterns ensures correct ABAP code is developed faster with less mistake that will occur in both design or implementation phases.

We assumed that you have basic knowledge of ABAP Objects and to be familiar with UML to follow our ABAP design patterns tutorial.

ABAP design patterns are grouped into three categories: creational patterns, structural patterns and behavioral patterns. Let’s dive into each individual design pattern and see how it works.

1. Creational Patterns

a. Factory Method  – Makes use of factory method to create an instance of appropriate class from class hierarchy or family of related classes when the client does not know which class to instantiate.

b. Singleton - Provides an object creation mechanism to ensures that one and only one instance of class exists.c. Abstract Factory – Allows creation of object from a suite of related classes without specifying the actual concrete object to be instantiated.

d. Builder – Enable to create a complex object by providing information on only its type and content, keeping the details of object creation transparent to the clients. The builder pattern allows the same construction process to make different representations of the object.

e. Prototype – Offers a simpler way of creating object by copied or cloned it from existing (prototype) object.

2. Structural Patterns

a. Adapter – Adapts interface of an existing class into another interface that clients expect.b. Bridge – Decouples an abstraction from its implementation to allow the two can vary independently.c. Composite – Enables both individual objects and composite objects to be treated uniformly.d. Decorator – Extends functionality of an      object dynamically      without modifying its class or using inheritance   .e. Facade – Offers an easier to use interface to a subsystem of classes.f. Flyweight – A fine-grained instance used for efficient sharing.g. Proxy – Provides an object that represents another object.

3. Behavioral Patterns

a. Observer  – Ensures related objects get notified when the state of an object changes.b. Strategy  – Encapsulates individual of algorithm in a family of related algorithms and make it easier to interchange the alternative implementations, even at run-time.c. Chain of responsibility – Allows the sender object to pass the request along a chain of objects without knowing which actual object will handle the request.d. Command – Allows requests are encapsulated as objects, thereby enable clients to be parameterized with different requests.e. Interpreter – A way to include language elements in a program.f. Iterator – Allow clients to traverse the contents of a collection of objects sequentially, without having any knowledge about the internal representation of its content.g. Mediator – Defines simplified communication between classesh. Memento – Captures and restore an object’s internal state.i. State – Allows object to change its behavior when its state changes.j. Template Method – Lets subclass handles exact steps of an algorithm.k. Visitor – Enables adding new operations to a class without change.

ABAP Strategy Design Pattern

In this tutorial, you will learn how to implement ABAP strategy design pattern with a practical example.

Read More →

ABAP Observer Design Pattern

Summary: this tutorial discusses about the Observer design pattern and how it is implemented in ABAP. Problem It is needed to maintain the consistency between related objects without making classes tightly coupled. For example, let’s say you have to develop a simple stock application that tracks price throughout the day in SAP.  The stock’s prices […]

Read More →

ABAP Singleton Design Pattern

This tutorial explains what ABAP singleton pattern is and how to implement it in ABAP.

Read More →

ABAP Factory Method Design Pattern

In this tutorial, you will learn what is ABAP factory method design pattern and how to implement factory method in ABAP.

Creatie: ZAREA_ROOT_CLASS en ZCL_MY_EMP_AREA. SHMA This will also generate an area class by entering the same name

NB Developer key

Default client is "001". Client 000 is typically for system wide administrative tasks. Two users are prenstalled: DDIC (default password: 19920706 overwritten during installation) and SAP* (default password: 06071992 overwritten during installation). Password may be changed, to the one you provided during installation.

The DDIC user is intended for certain system administration and maintenance tasks. Only use DDIC as experienced user. SAP* is a special administrative user, not used in Trial systems.  Only use SAP* as experienced user, e.g. to log into a system without valid license key.

BCUSER in Client 001 is preshipped in this Trial version. Change password with Transaction SU01. If not you have to create your development user: BCUSER. Purpose of the BCUSER is to develop applications and maintain the system. If you create or modify SAP objects within the customer namespace (starting with Y or Z), you need to enter the developer key for this user: 29671482393151224771 (Remark: valid after you installed the licensekey. If your system type is "initial" enter: 07222097363139263004). Enter when prompted. (Remark: This is not an access keys to modify SAP objects. Custom development namespace is Z* or Y*).

Login into your system, client 001 with user DDIC type in "SU01" into transaction field. You are redirected to transaction user maintenance. Usually you have to maintain company adress first. Type in your company and press ok. type in user "BCUSER" and press "create". Provide Profile "SAP_ALL" and your initial password (usually "initial" as you have to change it next time.). press save. log off and login again with your BCUSER. You are prompted to change your password.

Activate ICF - Internet Communication Framework (optional)

For web development, call Transaction SICF. Check that sap\bd\icf service is activated.

Architecture

Factory method

The Book by Igor!

Static UML of the Application

GUI part of appl: