14.01.2020 Views

ABAP_to_the_Future

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Creating and Using Shared Memory Objects 14.2

Integration (PI) proxies to achieve the sa me end. In this example, the data is

going to come from shared memory. It turns out that this will require two further

layers, both of which are known to the persistency layer: the broker class

and the root class.

왘 The broker class is a class that handles shared memory areas for the given set of

data. The persistency class uses this shared memory handling class to access the

innermost layer. The broker class is a generated class, and you don’t do any custom

coding inside it.

왘 Finally, the innermost layer is the so-called root class, and this is where you do

our own coding for where in the database you want to get the data from initially.

You also can add a whole bunch of whatever methods you see fit to use

in order to control what data gets storedand how it gets changed and accessed.

Broker Class: What’s in a Name?

They say that the Eskimos have 200 words for snow; in the same way, SAP often uses

multiple terms to mean the same thing. In the realm of shared memory, the terms “broker

class,” “area class,” and “handle” are used interchangeably. To avoid confusion, this

chapter sticks to “broker class”; it’s arguab le the best of the three phrases, because it

describes the task of the class in human terms—that is, to act as an intermediary, a broker,

between the calling program and the root class.

The user interface and controller layers were, of course, the focus of earlier chapters

in the book. In this section, we concentrate on the layers from the persistency

layer inward. First of all, you will create the root class, in which all the action

(your own code) happens. Then, you will learn about creating the broker class,

which serves as the interface between the custom code in the root class and the

persistency layer in any ABAP programs that want to take advantage of shared

memory. Finally, you’ll discover how to call the broker class from a persistency

layer class.

14.2.1 Creating the Root Class

This type of class does not want to change the world; it only has one job, which

is to store data and then let anyone in the system who is authorized to do so

access that data. Just as Spiderman can do whatever a spider can, this root class

can do whatever a normal class can, which makes it a lot cleverer than a database

table. It cannot swing from a web, but it can perform complicated authorization

635

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!