How can we debug Asynchronous TM Freight Order Save Strategy?
How to set an External Breakpoint in the Controller Method for the Strategy fails to capture the process thread?
Regenerating the issue:
- First, create a Freight Order Type (SAP Transportation Management > Transportation Management > Freight Order Management > Freight Order > Define Freight Order Types) in customizing that specify a Save Strategy CALC_CHARG.
- Now in T-Code SE80 open method CALCULATE_CHARGES in Class /SCMTMS/CL_CREATE_SAVE_METHODS. This method is registered for CALC_CHARG.
- Please also place an external breakpoint at the top of CALCULATE_CHARGES.
- Now open an FO in NWBC, make a change like modify the Resource Capacity Weight value, then Save. You will see a message 'Data saved successfully'
- Now you will notice that the ABAP Debugger window does not appear.
In order to debug the asynchronous TM Freight Order Save Strategy please make sure that the ABAP debugger must be set to System Debugging mode to trap at breakpoints in methods called via asynchronous strategies.
1) First, ensure that the ABAP debugger is properly configured to be in the System Debugger mode, please set an External Breakpoint in the method TRIGGER_STRATEGIES in Class /SCMTMS/CL_TOR_D_TRIGGER_STRAT. This class method will be responsible for registering the Save Strategy and Create Strategy as specified for the FO type:
2) Please also set an External Breakpoint in a Controller Method for the Save Strategy. Such as, set an External Breakpoint at the top of the method CALCULATE_CHARGES in class /SCMTMS/CL_CREATE_SAVE_METHOD for CALC_CHARG:
3) Now in NWBC, please save the FO which will bring up the ABAP Debugger at the Breakpoint set in shown in step 1. Select menu item Settings > Change Debugger Profile/ Setting and enable 'System Debugging' and 'Update Debugging'
Click Continue (F8) and you will get a message 'Data saved successfully'.
4) Now after a few seconds, an ABAP Debugger window will pop up, trapped at the entry to function /SCMTMS/TOR_PROC_STRAT_UPD in program /SCMTMS/SAPLTOR_STRAT_PROC. This program is responsible for the running of asynchronous strategies in TM:
5) Now again click Continue (F8) and the ABAP Debugger will now stop at the External Breakpoint defined in Step 2: