2017 Jun 10 4:12 PM
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
2017 Jun 10 5:16 PM
You may use the statement READ REPORT to read the source code.
2017 Jun 10 5:16 PM
You may use the statement READ REPORT to read the source code.
2017 Jun 12 5:36 AM
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.
2017 Jun 12 8:19 AM
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
2017 Jun 12 9:22 AM
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.
2017 Jun 12 9:37 AM
2017 Jun 12 9:37 AM
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.
2017 Jun 12 11:34 AM
2017 Jun 12 5:38 AM
Chetan,
May I know the objective of this exercise ?
Just curious 🙂
K.Kiran.
2017 Sep 01 7:50 AM
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