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

you can see that MonsterNumber is the key; it’s a string field of a maximum length

of 10 characters, and it cannot be null. This is how a UI control can dynamically

figure out how big to make a field on the screen and so on.

Now, take things one step further and change the URL once again so that it ends

in /odata/sap/Z_MONSTER_SRV/MonsterSet?sap-ds-debug=true. You have to be

very careful here; URL entries are case sensitive, and you need to make sure you

type in the name of the entity set exactly as it appears in the $metadata list.

As can be seen in Figure 13.22, the results are more impressive this time. You’ll

see a big list of all the monsters, which is proof that the ABAP code has been

called. You could (and you really should ) put an external breakpoint in the

method to see for yourself what’s happening.

Figure 13.22 Monster List in a Browser

If anything goes wrong, th ere’s an error handling tr ansaction called /IWFND/

ERROR_LOG, which is not useful at all. It just keeps pointing you to the same SAP

Note.

Coding GET_ENTITY_SET for Associated Entities

Now you want to be able to see the items for an indivi dual monster, so it’s time

to redefine another method in your entity set. Listing 13.3 reads IT_KEY_TAB,

589

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

Saved successfully!

Ooh no, something went wrong!