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.

8

Business Object Processing Framework (BOPF)

of several different classes before you ca n even dream of starting to think about

dealing with a BOPF object, so you need to have those as attributes that get

instantiated in the constructor of the monster model persistency layer.

In a well-designed OO program, there are a lot of small classes, each with a very

specific job to do, which is why you need so many helper classes. This is partly

why programming this framework is going to seem overcomplicated at first, but

it does give you an enormous amount of flexibility. (Also, as mentioned earlier,

you’re eventually going to be hiding all this complexity away.) These helper

classes are shown in Figure 8.7, and Li sting 8.1 shows how an instance of each

gets created during the construction phase of the monster model class.

Figure 8.7 Model Class: Helper Classes as Attributes

METHOD constructor.

TRY.

mo_transaction_manager =

/bobf/cl_tra_trans_mgr_factory=>get_transaction_manager( ).

mo_service_manager =

/bobf/cl_tra_serv_mgr_factory=>get_service_manager(

zif_monster_c=>sc_bo_key ).

mo_object_configuration =

/bobf/cl_frw_factory=>get_configuration(

zif_monster_c=>sc_bo_key ).

CATCH /bobf/cx_frw.

* Oh dear, we’ve not goten off to a good start

ENDTRY.

ENDMETHOD.

Listing 8.1 Monster Model Class Constructor

292

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

Saved successfully!

Ooh no, something went wrong!