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.

Summary 8.4

Therefore, if you work on the computer system of a zoo that contains only mythical

animals, say, then next week you might be ca lled upon to create a unicorn

business object in the SAP system. You could reuse the previous helper class as is

without looking at it. However, I would urge you to look at the examples in

which it’s used (in Section 8.2.9, mainly) and try to understand what’s going on.

It’s highly likely that during your work you’ll find yourself writing some code

that falls into the generic basket and can be abstracted into a new method of the

preceding class or to a different helper class if the code’s purpose is not database

relevant.

If you do find the need to do this, then when creating wrapper classes it makes

sense to change the parameter names of the wrapper methods so that they make

it a bit clearer to programmers callin g the custom method what was actually

required. As an example, the standard method asks for a node key, and you might

try to pass in the object key, when what isreally required is a GUID that indicates

what type of node you’re dealing wi th. Therefore, rename the parameter node

type. This is the adapter pattern: in this case, you’re adapting the standard SAP

parameter names into something easier for a human to understand.

For the same reason, it often makes sens e to rename the method names. If you

find yourself having to put a comment above a call to one of your custom methods

in order to explain what it does, yo u should rename the method to exactly

match the comment you have just written, and then get rid of the comment

(which is now redundant).

One or more wrapper classes takes away most of the pain of using BOPF, but in

some areas you’re still going to end up with more code than you’re used to.

8.4 Summary

This chapter discussed the new Busine ss Object Processing Framework (BOPF)

SAP applies to represent business object s such as sales orders and any custom

equivalents you may create. I’m going to have to leave it to you to experiment

with writing an application using BOPF an d seeing if there is less effort overall

than the traditional method; SAP certainl y believes this to be case, and I’m

inclined to agree.

355

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

Saved successfully!

Ooh no, something went wrong!