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.

1

ABAP in Eclipse

SAP has not been known for the quality of the graphics within the SAP GUI. You

are probably used to the runtime analysis within the ABAP Workbench—Transaction

SE30 or more recently SAT—which gives detailed information about how

a given application spends its processing time. The problem is that there is just so

much information that you tend to get swamped. You’ll see a nice set of three bars

indicating whether the most time is spen t in the database or in the application

server, and if it turns out that the server is the problem, then you have to try and

get to grips with the big tree that indicates how much time is spent in each routine.

That is not the end of the world, but it takes some getting used to, and the equivalent

in ABAP in Eclipse is much friend lier to the eye. To demonstrate this, up

next is a silly example in which a small fraction of the program performs mathematical

calculations, and the bulk of the program performs SELECT statements

within a loop. (In fact, the example isn’t as silly as all that, because you do tend to

find this situation all too often in real-life programs.)

Say that every time a monster learns that there is such a thing as American Airlines,

the monster instantly wants to go on a flight with them. Thus, Listing 1.16

combines the popular SFLIGHT example with a monster example.

DO 100 TIMES.

SELECT COUNT( * )

FROM sflight

WHERE carrid = 'AA'.

CHECK sy-subrc = 0.

ADD 1 TO gd_flying_monsters.

ENDDO.

Listing 1.16 SFLIGHT and Monster Mash-Up

This example is only good for showing wh at not to do; obviously, we only need

to read the database once. To invoke the runtime analysis, select your ABAP program,

follow the menu path Profile as 폷 ABAP Application, and then type

“trace” into the top-right-hand corner of the screen, where it says Quick Access.

You’ll see the trace file as per usual. When you expand it and click on it, instead

of bars saying how much time was spent in the database and in the server, you’ll

see a pie chart showing the exact same thing. That probably does not impress you

too much, but as a next step click the Call Timeline tab at the bottom. Then,

70

www.allitebooks.com

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

Saved successfully!

Ooh no, something went wrong!