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.

Making Programs Flexible

B

Example

The point should now be clear: hard-coding is bad. Now consider an example that

shows how to fix this problem. As bizarre as it sounds, you’re going to create a

customizing table of customizing entries. Say that you have five different categories

of monsters. The categories are pretty much the same all over the world, but

the customizing values in each country’s SAP system ar e different. You need a

table to say what data element you’re talking about and what possible categories

can apply to that data element.

In Figure B.1, you can see how you assign values to a data element. You could also

have other values, like for an extra scary monster or gigantic monster. The underlying

database table would look like Figure B.2.

Figure B.1 Adding a Meaningful Value for a Data Element

Figure B.2 Database Table for Linking Meaningful Values to Data Elements

The next step is to store the exact values each country is using to describe the

same sort of monster. As you can see in Figure B.3, each country has chosen a

different four-digit code to describe the same thing, and each of those codes is

meaningless, in that it’s impossible to guess that ZZT5 represents a standard

monster. However, a program specific ation would say something like “When

you encounter a standard monster, do such and such,” as opposed to “When

you encounter a ZZT5, do such and such,” so you want to see the former

approach in your code.

713

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

Saved successfully!

Ooh no, something went wrong!