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.

Backend Tasks: Creating the Model Using SAP Gateway 13.3

Figure 13.19 Calling the Browser Test Tool

This is all wonderful: An external request can see that you have various monsters

that can be searched for, each with some items. However, at the moment, if the

external application (which is going to be an SAPUI5 application in this case)

wants to look up a particular monster, or all the monsters, or a subset of them,

then it’s right out of luck—because yo ur SAP Gateway monster entity doesn’t

have any ABAP code in it yet, just a bunch of empty generated classes.

13.3.2 Coding

In the last section, you not only create d and activated a service to expose your

monster model data to the outside world, you also generated some ABAP classes

that are to be used to manipulate your monster data within the SAP system. These

classes won’t do anything much until you add some code to them. There are several

steps to this process:

1. First, you have to understand the str ucture of an SAP Gateway service implementation,

such as the one you will be creating for your monster data model.

This will help you understand what code we need to add and where.

2. Code the data retrieval method GET_ENTITY_SET.

3. Test the data retrieval method GET_ENTITY_SET. This is going to be different

than the testing you’ve been used to, because you have to test this from a web

browser.

4. Code GET_ENTITY_SET for associated entr ies, where the entity set is the list of

items associated with a monster entity.

5. Code error handling (i.e., how to pass error messages back to the calling application)

so that they can appear in the SAPUI5 display.

Each of these steps is discussed in more detail next.

581

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

Saved successfully!

Ooh no, something went wrong!