14.01.2020 Views

ABAP_to_the_Future

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

14

Shared Memory

14.2 Creating and Using Shared Memory Objects

The best way to describe how to use shar ed memory is to use an example. This

section will first present a basic example and then will present more complicated

scenarios.

In Chapter 9, you learned that objects inSAP often resemble Russian nesting dolls

in that an observer only sees the outermost doll, but inside are a series of smaller

dolls. This matches the OO principle of having each class do one thing and one

thing only.

Therefore, an application built using OO principles that uses shared memory will

have absolutely no idea th at it does in fact use sh ared memory, because it does

not need to know or care about where th e data it uses comes from. If you start

from the point of view of the human sitt ing in front of the computer or mobile

device looking at the screen and pressing buttons, you will pass through the following

layers:

왘 The outermost layer of the software is the user interface (the view), which of

course is the software from the end user’s point of view, because that’s all that

he sees. That is why ugly gray screens don’t go over so well, even if those ugly

gray screens are rendered in a web browser.

왘 The view only knows about the next layer down, which is the controller. The

controller acts as a mediator, passing user input down to the business application

(the model) and receiving back instructions from the model as to how the

state of affairs has changed in response to that user input so that the controller

can tell the view to let the user know.

왘 The model (one level down from the controller) knows about the controller it

talks to but has no further knowledge of the outside world. It is solely concerned

with business logic. That busi ness logic almost always needs to access

information from the database, but the model does not know or care if the

information is actually coming from the database or an external system or from

the Planet Bong in the Constellation ofHorseradish Sauce. The model delegates

the task of getting the data it needs to yet another class, whose sole task is to

retrieve data.

왘 The next layer is the persistency layer, and usually the clas s that performs this

layer’s function simply performs a big bunch of database reads in its various

methods. It could of course use RFC call s to other systems or call SAP Process

634

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

Saved successfully!

Ooh no, something went wrong!