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)

a link to these blog posts in the “Recom mended Reading” box at the end of the

chapter.

8.3.2 Using a Custom Interface (Wrapper)

What puts a lot of people off of BOPF is the sheer amount of coding that seems to

be needed to perform routine tasks that take only a line or two of code in “traditional”

ABAP. However, this is always going to be the case when you have a very

generic framework intended to handle ju st about anything, which is after all

SAP’s market: SAP wants to produce softwa re that can be used by any company

(or government department) in any country.

When I was writing some code to demons trate BOPF, first I got it working, and

then I split the code into small methods, each of which did one thing only, as per

the OO philosophy. That left me with some fully generic methods that had nothing

to do with monsters and could be put in a reusable Z class for the next time I

wanted to use BOPF for something. Code that never changes is crying out to be

abstracted to this or a similar wrapper cl ass. Thus, you will notice that the code

samples in this chapter use a custom wra pper class to surround a lot of the class

in standard BOPF classes and methods (Figure 8.42).

Figure 8.42 Custom Wrapper Class

If you look inside the methods of ZCL_BC_BOPF_HELPER using the downloadable

code sample you get as part of this book, then you will see that these methods

make no reference to monsters or any other type of BOPF object. The idea is that

such methods, and indeed the entire class, should be reusable in the next BOPF

entity you create without any changes whatsoever.

354

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

Saved successfully!

Ooh no, something went wrong!