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

cpudt as cpudt,

augdt as augdt,

amount as amount,

waers as waers

from zmonster_debts

where mandt = :id_mandt

and cpudt >= :id_woff_date

and cpudt >= :id_last_extract_date;

et_old_bad_debts = SELECT

mandt as mandt,

belnr as belnr,

cpudt as cpudt,

augdt as augdt,

amount as amount,

waers as waers

from zmonster_debts

where mandt = :id_mandt

and cpudt < :id_woff_date

and cpudt >= :id_last_extract_date

and augdt >= :id_woff_date;

endmethod.

ENDCLASS.

Listing 15.20 AMDP Method Implementation to Get Monster Cleared Items

If you do an ST05 SQL trace on that method when the data was retrieved from the

database, you’ll find that there was no FETCH operation, as is normally the case

when performing a SELECT statement against a traditional database. Instead, the

result looks like Figure 15.10, which show s a call to the AMDP inside the database.

Figure 15.10 ST05 Trace on an AMDP

That was a very simplistic example, but hopefully you get the idea: Whenever you

find that the only way to get what you want from the database using traditional

methods like OpenSQL cannot work without breaking a golden rule (such as getting

back more data than you actually need), then it’s time to think about pushing

the code down to the database using the gu idelines in this se ction (i.e., use the

extended syntax of OpenSQL if possible; if not, then use a CDS view if possible;

690

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

Saved successfully!

Ooh no, something went wrong!