Skip to Content
0

Set a Break-point at particular word in Z program programatically.

Jun 10, 2017 at 03:12 PM

158

avatar image
Former Member

Hello Everyone,

I have a requirement to set break-point in zprogram at a particular FM or keyword (say "REUSE_ALV_GRID_DISPLAY" in "ZANY_PROGRAM" program) programatically.

I am aware of below code to set breakpoint in any program at particular line number.

  wa_breakpoints-program = sy-repid.
  wa_breakpoints-line    = 3.
  APPEND wa_breakpoints TO breakpoints.
  CALL METHOD cl_abap_debugger=>save_breakpoints
    EXPORTING
      main_program = sy-repid     "Program name
      breakpoints  = breakpoints.

However cannot figure out a way to get line number from the keyword.

Any help will be appreciated. Thank you

10 |10000 characters needed characters left characters exceeded

Chetan,

May I know the objective of this exercise ?

Just curious :-)

K.Kiran.

0
Former Member
Kiran K

Hello Kiran,

We have multiple print program each triggering multiple smart form in our project. It becomes extremely time consuming at times to find the correct print program triggering the smart form. The above logic might help to set breakpoints in all print program's 'SSF_FUNCTION_MODULE_NAME' thus saving time finding the right program.

Thanks and Regards,

Chetan Shah

0
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Sandra Rossi Jun 10, 2017 at 04:16 PM
0

You may use the statement READ REPORT to read the source code.

Show 6 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Thank you Sandra. I created below program using Read Report to get the line number of particular string. Hope it helps someone.

DATA:
  template TYPE          c LENGTH 30,
  source   TYPE TABLE OF string,
  wa       TYPE          source.

template = 'ZRLB_INVOICE'.

READ REPORT template INTO source.
IF sy-subrc <> 0.
  RETURN.
ELSE.
  LOOP AT source INTO wa WHERE table_line CS 'SSF_FUNCTION_MODULE_NAME'.
    WRITE: sy-tabix.
  ENDLOOP.
ENDIF.

1

Why would you need to do this ? Perhaps I am thinking too simplistically here, but you can set break points from other GUI sessions at statemments, procedures, methods and functions, you can set watch points on variable values etc etc. Why would you programatically want to set a break-point ?

Rich

0

In BW you'll see code like

IF certain_flag EQ abap_true.
BREAK-POINT.
ENDIF.

This is used in some data processing, where you tell the DTP that you want to debug before the start routine begins, for example. The start routine is held in a locally generated program, so isn't readily accessible to place the break-point. (Actually, it is, you just go to the DTP and choose "display generate program", but that's probably too technical for most BW people. ;-) ).

I imagine the OP is wanting to do something similar.

2

Thanks for the explanation Matt.

0
Matthew Billingham

Matt,

Now I understood the funda behind those break-points which I got to see while developing a few routines in BW.Thanks for the info.Would you also let us know what is DTP (InfoObjects,InforSources....?)

K.Kiran.

0

Data Transfer Process.

0