Application Development and Automation 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: 
Read only

Breakpoint at database table modification using Script debugging

alexandreourth
Active Participant
4,724

Hello experts,

Context :

I have to update MKPF-BKTXT for the goods movement generated by the following function modules :

  • BAPI_PRODORDCONF_CANCEL
  • BAPI_GOODSMVT_CANCEL
  • BAPI_PRODORDCONF_CREATE_TT
  • BAPI_GOODSMVT_CREATE

For BAPI_GOODSMVT_CREATE -> no problem because there is a "GOODSMVT_HEADER" structure with my BKTXT field.

This is another story for the others because header for MKPF is not available. Each of them creates a some point a goods movement so I tried the badis MB_BAPI_GOODSMVT_CREATE & WORKORDER_GOODSMVT but there is no method with the data i need to update MKPF-BKTXT, or it's not even called by the FMs above.

I tried "break point at statement" : "CALL BADI" and also "CALL CUSTOMER-FUNCTION" but nothing seems to do the job i want.

My last hope is to find when MKPF and MSEG are updated. Of course when i start my debugger, those tables are not reachable so i can't set a breakpoint on them, but, at one point, they have to be updated, but i don't know when.

I ve checked and It seems there is a way using Script in debbuging mode, but i don't understand how it's working :

How can i set the break point on MKPF here?

Or if you know any other way to do that then I'll take it.

Thanks a lot for your time.

Best regards,

Alexandre

1 ACCEPTED SOLUTION
Read only

touzik_itc
Active Participant
3,354

You can use RSTPDA_SCRIPT_BP_CHANGE_TAB script or create your own:

The tables to debug are listed in the range table range_it, which is filled in init() method

METHOD init.
    DATA l_cancel TYPE flag.
    CALL FUNCTION 'TPDA_SCRIPT_CALL_SEL_SCREEN'
      EXPORTING
        p_screen   = if_tpda_sel_screens=>c_scr_table
      IMPORTING
        p_range_it = range_it
        p_cancel   = l_cancel.

    IF l_cancel = abap_true.
      MESSAGE s144(tpda) .
      RAISE EXCEPTION TYPE cx_tpda_stop_scripting_request.
    ELSEIF range_it IS INITIAL.
      MESSAGE s144(tpda) .
      RAISE EXCEPTION TYPE cx_tpda_stop_scripting_request.
    ENDIF.
  ENDMETHOD.                    "init

in your own script tables can be added directly, without a popup window:

range_it = VALUE #( ( low = 'MKPF' option = 'EQ' sign = 'I' )
                    ( low = 'MSEG' option = 'EQ' sign = 'I' ) ).
5 REPLIES 5
Read only

touzik_itc
Active Participant
0 Kudos
3,354

The transaction ST05 can be used to find out, where database tables are updated.

Read only

alexandreourth
Active Participant
0 Kudos
3,354

Hi touzik_itc

Yes thanks, i've used SAT tcode and i found the place too work for one of my MF. ST05 should do the same yes.

But still i'm curious to know if it's possible to set this kind of break point directly in the debugger.

Thanks again.

Read only

touzik_itc
Active Participant
3,355

You can use RSTPDA_SCRIPT_BP_CHANGE_TAB script or create your own:

The tables to debug are listed in the range table range_it, which is filled in init() method

METHOD init.
    DATA l_cancel TYPE flag.
    CALL FUNCTION 'TPDA_SCRIPT_CALL_SEL_SCREEN'
      EXPORTING
        p_screen   = if_tpda_sel_screens=>c_scr_table
      IMPORTING
        p_range_it = range_it
        p_cancel   = l_cancel.

    IF l_cancel = abap_true.
      MESSAGE s144(tpda) .
      RAISE EXCEPTION TYPE cx_tpda_stop_scripting_request.
    ELSEIF range_it IS INITIAL.
      MESSAGE s144(tpda) .
      RAISE EXCEPTION TYPE cx_tpda_stop_scripting_request.
    ENDIF.
  ENDMETHOD.                    "init

in your own script tables can be added directly, without a popup window:

range_it = VALUE #( ( low = 'MKPF' option = 'EQ' sign = 'I' )
                    ( low = 'MSEG' option = 'EQ' sign = 'I' ) ).
Read only

3,354

Thanks touzik_itc and sandra.rossi

With both your answer, i have used my first debbuging script ever (even after 10 years of ABAP) ^^

We learn every day!

Have a great day.

Regards,

Alexandre

Read only

Sandra_Rossi
Active Contributor
3,354

Note that if the tables are updated in the update task (as often), you must first activate the update debug, then start the script in the update task.

Note that the standard script RSTPDA_SCRIPT_BP_CHANGE_TAB asks for the table names (RANGE_IT) when the script is started, and its method SCRIPT is triggered at each INSERT/MODIFY/UPDATE/DELETE statement (if you look at the script "properties").