You are on page 1of 5

Basics of Debugging in SAP

Debugging on SAP: Debugging is one of the best and wonderful tool used by the developer(In any development Environment) to track down a issue and also to understand code or logic written by any other developer. As we know, since its being a technical stuff, not all unctional !onsultants will have an idea about it, so they have some tough time initially to understand as what it is and how it works, but once they understand it, its like piece of cake to any person. I have put some basic information regarding debugger and some basic concepts about debugger, going over these might help you in not getting panic when you see a debugger screen "). Note" In #A$, there are % types of debuggers. &ne is !lassic debugger and the other one is 'ew Debugger. !lassic debugger is lot easy to use and also to understand but 'ew debugger(available from release levels (.)*) is has more features and also will be used vastly in future, so I am going over 'ew debugger in my blog. #ome brief differences between these % types are, (!ourtesy of #A$)

+he !lassic Debugger runs in the same roll area as the application to be analy,ed (debuggee). It is therefore displayed in the same window as the application. -owever, this technology also has some restrictions. or e.ample, some A/A$ programs (such as conversion e.ist) cannot be analy,ed in debug mode for technical reasons. -owever, the most significant restriction is that no A/A$ technology can be used for designing the Debugger interface and it is therefore not possible to create a modern user interface.

+he 'ew Debugger on the other hand, is e.ecuted in a separate e.ternal session (Debugger), while the application to be analy,ed (debuggee) uses a second e.ternal session. 0ith this technology, the user interface of the Debugger can be designed freely by A/A$ means.

About New Debugger: SAP's old debugger which is Classic debugger was user-friendly but has some cons as described above. This New Debugger is a lot different to old debugger !ust not in loo" but also in features. #ist of few features available on New Debugger are$ %. Ability to Configure the loo" of the debugger screen. &. 'ulti(le Des"to(s o(tions to go over multi(le ty(es of data while debugging. ). Access to all the *lobal +ariables of the re(ort or function module which we are debugging. ,. Tab #ayouts to easily access multi(le information which is necessary while debugging. -n Classic debugging to get to some of the information we have to navigate through 'enu .(tions. /. Advance features li"e Saving a test variants to functions modules while debugging searching for a (articular entry inside a table while in debugging o(tion to get to the u(dated source code being in debugging mode and few others. 0. 'ore o(tions while debugging .b!ect .riented code com(ared to Classic debugger. Setting up a break-point or starting a debug session: Option 1:

Program goes to debug mode when you enter 1h in command (rom(t and then e2ecute the re(ort. Option 2: -n the (rogram (lace the cursor on a (articular (oint where you want to debug and clic" on the sto( button on the to(. 3hen you e2ecute (rogram will sto( here in Debug mode. Option 3: 4sing 567A8-P.-NT command inside the code. This is mostly used by the develo(er if you are not the develo(er of that re(ort you cannot use this o(tion.

Difference between the & Sto( 5uttons is generally for debugging a re(ort we use the one with no human icon on it. ST.P icon with human icon on it will be used only for 72ternal Debugging that is if your a((lication is being called from out of SAP's current session. 72am(le cases are$ %. -f we are debugging a 3ebdyn(ro a((lication which actually runs on an -nternet 72(lorer browser we use the 72ternal Debugging button to (ut a brea"-(oint. &. -f we want to debug any Portal or P- A((lication Call we use 72ternal Debugger. This doesn't mean that you cannot use that for normal re(ort debugging we can set a brea"-(oint using this button too for a normal debugging. Also for the below screen shots - have configured my debug screen to show Code on the left (art of screen and the variables data on the right (art of the screen Actually this is the standard layout but you can change this layout to have , screens on a layout.. .nce you are in Debug 'ode

.n the left screen you will see the code and on the right screen you can see the values of the variables at that (oint of the (rogram. #i"e if you see on the right side (9co(y variable has value ::% at this (oint of the (rogram e2ecution. ;ere to debug ste( by ste( we can use the buttons on the to( of debugger screen which are

-f you want to go Ste(-by-Ste( either clic" on </ or clic" on first button of above. -f you want to e2ecute a com(lete ste(=#i"e a <unction 'odule called in (rogram without going into the function module clic" on second button or <0. <> is to come out of ste(. #i"e you have gone into a function module now to come out of it without going through the whole logic use <>. <? can be used to come out of debugger and continue e2ecution normally. 4sing the above commands you can navigate through each (oint of the code and "ee( chec"ing the main variable which you thin" has an issue or the main variables which are shown in the out(ut of the re(ort. Important concepts to know whi e debugging: %. .ne of the most hel(ful and used (ro(erty of a debugger is ability to change values of the variable while in debugging. - can e2(lain that in brief in below screen shots$

-n the above screen shot - am inside a #oo( of an internal table one of the field of that table has a value of ':%' as shown below

- have some code to chec" when that value becomes ':&'=#-9CN.D-D9#-N7-N.D79-D@ su((ose dont have test case for that what - can do is clic" on that Pencil -con ne2t to that field and you will see that field as in(ut enabled and you can change the value of that field to :& as shown below

-f you see the above screen that (encil icon changed to D-SP#AA icon and the field is in(ut enabled. .nce you change the value of that field you can !ust hit enter and the value gets changed. 'ost im(ortant (oint is you would need authoriBations to do that $@ most of the functional (eo(le will not be (rovided authoriBation to do that. 2! Setting up a break-point at a particu ar A"AP #ommand or a Statement . - -f we "now that the (rogram is failing at a (articular command we can use the below o(tion to set the brea"-(oint at that (articular statement instead of debugging through the whole code. 3hen you are in debugger mode and if you want to set a brea"-(oint at any of aba( command you can do it based on the navigation screen shot below.

.n the right (art of screen if you see Tabs which say +ariables% +ariables) #ocals and *lobals in that *lobals shows the list of values of all the variables used in that (rogram at that (oint of time. 3e have some notes under hel(.sa(.com too about the Classic and the New Debugger. 5elow is the lin" for the same. http"11help.sap.com1saphelp2nw3*1helpdata1en1c(1(43ca5e(6c44d%b%ab*6***5b)77841frameset.htm .

You might also like