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.

15

ABAP Programming for SAP HANA

This is, unfortunately, part ly a manual task. When you have to resort to using

database-specific features, it’s due to a specific problem only your organization’s

SAP system is having, and thus it’s difficult for SAP to provide an automated tool

to look for such occurrences. (Having said that, there are some automated checks

that can be performed using the Code In spector; these are covered in Section

15.5.3.)

One example of database-specific code in a custom program (it can also be found

in SAP standard programs) is “database hints,” which you can add to your ABAP

SELECT statements, as in Listing 15.21.

SELECT SINGLE monster_number

FROM zt_monsters

INTO ld_monster_number

WHERE monster_name EQ ld_monster_nmae

%_HINTS ORACLE 'index(ZT_MONSTERS "ZT_MONSTERS~Z01")'.

Listing 15.21 SELECT with a Database Hint

Normally, the database optimizer chooses what index to use, but if that optimizer

keeps choosing the wrong index, then you can force the issue using a HINT (i.e.,

make the optimizer use the index you think is best).

The recommendation from SAP has always been never to use database hints, on

the grounds that one day you might want to do a database migration. In this situation,

the cows have certainly come home to roost; this is precisely what you’re

doing—moving to SAP HANA—so you need to get rid of all these HINTS statements.

The other database-specific type of coding you might come across in custom code

is NativeSQL. This is when the specificdatabase you are using has SQL commands

not available in OpenSQL, and you want to take advantage of this, so you write

some Oracle- or Microsoft-specific SQL inside the ABAP constructs EXEC SQL /

ENDEXEC.

Naturally, SAP recommends against this as well, and there are two good reasons

that you should replace such NativeSQL with OpenSQL:

왘 Such a query will no longer work once you’ve migrated to SAP HANA.

왘 With all the advances that ABAP 7.4 brin gs to OpenSQL, it’s more than likely

that the missing functionality that ca used the original programmer to use

696

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

Saved successfully!

Ooh no, something went wrong!