SAP provides an extremely rich variety of product suites which are built primarily on ABAP. I am a recent joiner to SAP/ABAP world with my prior experience completely on Java Based applications. Based on my recent experience (for past few weeks) with ABAP Framework & its extensive in-depth technical capabilities, there were many aspects which appeared common with JAVA programming standards. This implies a common congruence between both Java & ABAP Worlds with generic underlying architecture principles being similar.
This blog makes an initial attempt to
1. Draw similarity between both worlds (Java & ABAP) by providing a generalized concept & their corresponding usage
2. Provide a high level view to get readers familiarized on basic concepts which leverages them to generate analogy between both worlds
Currently, the topic in discussion is ORM i.e. Object-To-Relation Mapping is a widely used standard in today’s industry. Conceptually ORM includes various aspects. These along with corresponding approaches leveraged within Java/ABAP are as provided below:
|Aspect||Description||Java Approach||ABAP Approach|
|Entity/Objects||Persistent objects that map to related tables in DB||
01. Defined as serializable objects (i.e. Simple POJO classes extending Serializable interface).
02. Uniqueness is managed using Primary Keys (or Primary Class in case of Composite Keys)
01. Persistent Classes (e.g. CL_PERSISTENT) constructed using Class Builder. Objects created from classes are transient in nature. ABAP Object Services provides Persistence Service to manage these objects in a manner that they can be used for persistence.
02. Objects contain mandatory unique Id (GUID) for maintaining uniqueness
Provides mapping configuration in form of config files. E.g.
01. For an Employee Object & an Employee Tables in DB, this file defines the mapping where an Attribute of Employee i.e. Name is mapped with which column of Employee Table i.e. Emp_Name
02. It also defines Cardinality relationships between 2 objects/tables e.g. Employee has 1..N relationship with Salary Object
|Defined using descriptors which can be of any type (e.g. XML file, Java Class, ORM Workbench etc.)||ABAP Workbench provides Mapping Assistant Tool (Integrated within Class Builder) for defining the Relationships|
|Persistent Context||It is a set of Entity Instances where any persistent entity has a unique entity instance. Within the persistence context, the entity instances and their lifecycle are managed. Simply put, this is nothing but cache which maintains set of entity objects which are currently in scope of being persisted.||
01. Obtained from configuration files (e.g. Persistence.xml)
02. Java provides flexibility of creating persistent context containing multiple persistent objects
03. Singleton Instance of this class is provided
01. Upon creation of Persistent Class, ABAP implicitly creates singleton ‘Agent Class’.
02. Objects of Global Class (i.e. persistent objects) can only be created from Agent Class. Hence all persistent objects are managed by single Agent Class.
03. ABAP defines single Agent class per Global Class
|Persistence Manager||Each ORM vendor provides different flavors in form of interfaces (e.g. Entity Manager). This class gets associated with the persistence context, hence maintains lifecycle of persistence objects & also provides the Persistence Related Services i.e. manage DB interactions like Create, Remove, Find, Query etc.||
01. Entity Manager in Java based solutions which is provided by PersistenceContext itself
02. It can be defined as Container Managed (App Server Manages the Lifecycle) Or Application Managed (Lifecycle can be programmed by developer)
Agent Class (CA_PERSITENT) defines methods for managing entity lifecycle
e.g. CREATE_PERSISTENT, GET_PERSISTENT, DELETE_PERSISTENT etc.
ABAP framework provides very rich set of functionalities which are well defined industry standards that are adopted by other technology stacks (e.g. Java/J2EE). The underlying concepts remain same with only Syntaxes & Semantics being different. Knowledge of the underlying concepts can help understand basic underlying architectural principles.
There are more ABAP related topics (e.g. ABAP Objects, Webdynpro MVC, Authorizations, Memory Organization, Remoting etc.) that bear close resemblances with Java approaches. Subsequent blog submissions can address these topics and provide further details.
1. The list of topics covered currently is just initial & not necessarily a comprehensive list.
2. The details provided are author’s own views based on experience. Readers are encouraged to share their experiences and also provide comments /more detailed insights into the topics. Any corrections/differences of options are most welcome