Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Skipping a portion of code at runtime

Former Member
0 Kudos

Hi all,

Can anyone please suggest a way to skip a particular lines of code while in debugging mode without altering the ABAP program code.

Regards,

Prabaharan.G

8 REPLIES 8

former_member221770
Contributor
0 Kudos

Prabaharan,

You can use breakpoints in debug mode and then "Run to Cursor". To put a break point, simply click on where you want to put the Break Point and hit the following menu path: Breakpoints->Create/Delete

You will see a "Stop" icon on that line. Then you can select "Run to Cursor" (it's the 4th icon under the transaction box and to theleft of the "Watch Point" icon). The program will run in online mode until it hits the Break Point and revert back to debug mode.

Hope this helps.

Cheers,

Pat.

0 Kudos

Hi Patrick,

Thanks for your response.

But the thing we actually require is that we dont want to execute certain lines of code in the program.

ie...if we have some 6 lines of code..in that we dont require 4th and 5th line of code.Also we cannot make changes to the program....

Plz suggest.

Regards

Prabaharan

Former Member
0 Kudos

Hi Prabaharan.G,

IMHO, I don't think it's possible, because the program you are debugging is already compiled (you just see the source code as a reference for you), and it could be pretty hard for the SAP core to skip certain instructions.

My advice is: define a global variable, surround the piece of code you may want to skip with some IF-statement (evaluating this global variable) and then modify the contents of the variable when debugging. That is:


* (...any previous code...)
IF d_skip_code IS INITIAL.
*  (...the piece of code you may want to skip)
ENDIF.
* (...any subsequent code...)

Then run till the IF-statement, change the contents of variable "d_skip_code", and keep on running.

I hope it helps. BR,

Alvaro

0 Kudos

Hi Alvaro,

Thanks for your immediate response.

The thing is that we cannot make any changes to the program as of now.

So we cud not introduce IF statements.

Any other suggestion plz..?

Regards

Prabaharan.G

0 Kudos

Hello,

try this:

debugger. Stop at the last line you want to be executed (maybe by setting a breakpoint).

Set cursor the next line you want to be executed.

In menu you find Debugging->Control->Goto Statement.

It should skip line between breakpoint an cursor.

Christian

Former Member
0 Kudos

Hello Prabahkaran,

If you're on 4.7 then you would be having the Goto statement in debugging. Choose the Menu Option <i>Debugging>Control>Goto Statement</i>.

This option is different than the one Patrick had suggested. It just jumps to the statement where the cursor is placed. the statements in between are not executed. And what is really cool about this option is that you can even go <i>backwards</i> during debugging - From Line 20 you can go back to line 15, for example.

Check this out and let me know if it suits your purpose. If you're on a release < 4.7, then I'm afraid you do not have this option.

Regards,

Anand Mandalika.

P.S. Please don't forget to reward the answers that have helped you. If a reply solves your problem, give it 10 points. That will mark this thread as "answered".

Message was edited by: Poornanand Mandalika

0 Kudos

Hi Anand,

you are right, I'm working with release 4.6C, and cannot find this option

Great!, that this is available in further versions.

C u in the forums. BR,

Alvaro

0 Kudos

Hi Poornanand,

Ur reply was very helpful.......... But we are working in 4.6 version............... Could you suggest any solution for this.

Regards,

Prabaharan.G