Before BW 7.3 SP 11 there was no standard way to debug Planning Functions of type Formula which were written in FOX.But with BW 7.30 SP 11 SAP provided a debugging script that allows us to easily debug the FOX code .There are some other workaround methods which can be used for debugging and were used when the script was not available but these are not very convenient to use and there are a lot of scenarios where these workaround methods could not help.
In this blog will I will use the new debugging functionality provided by SAP.
This blog is in continuation to my earlier blog where I showed how a planning ADSO simplifies design for the Integrated Planning projects. https://blogs.sap.com/2016/11/28/integrated-planning-advanced-dso-for-planning/
What i meant by “no standard way to debug”
Debugging in IP FOX planning functions can be invoked by the classic ABAP statement Break-Point. You can start debugging either by executing the planning sequence or using the program RSPLS_PLSEQ_EXECUTE .Once started the ABAP debugger would open up with the FOX code generated in ABAP and not in FOX. So unless you also happened to be a seasoned ABAPPER or had one in your team it was not possible to meaningfully debug the code.
I will go also cover these workaround methods before i start with the script.
Lets see how debugging was done with RSPLS_PLSEQ_EXECUTE
SAP provides a program RSPLS_PLSEQ_EXECUTE to help debug FOX. The same result would be achieved if you had the words Break-Point in the code and triggered the Planning Sequence from RSPLAN.
On pressing F8 or Execute button
Again on pressing F8 or Execute button
Let’s also see how debugging can be done with Messages
In FOX formula you can output message notification using MESSAGE Tnnn(<Class>) WITH <Operand1> … <Operand4>. statement.So to see the output each time lines of code got executesd the message statement were placed in the code.
On execution of the planning sequence if you had breakpoints in the code then you can see the message outputs in ABAP debugger.
Else you can also see the messages in the messages section after execution of Planning Sequence.
Benefits of this method was that you did not have to use keyword Break-point and the fact that you could see the messages even in the front end like BeX or WAD.This was especially useful if you were trying to pass some values from the front end to the planning sequence.
Now let’s see how to use the newly provided script RSPLFC_DEBUGGING_SCRIPT_FOX.
Use the keyword Break-point and trigger debugging either by executing the planning sequence in RSPLAN or using program RSPLS_PLSEQ_EXECUTE .Then you will get to the screen below.
Go to the last tab of this screen i.e. “script” and click on “load script”
In the next screen enter the name of the script i.e. RSPLFC_DEBUGGING_SCRIPT_FOX and press ok.
Now press “start script”.
The debugger starts in FOX
To debug you need to understand Block Values.For execution a planning function the system breaks the data into smaller subsets. The system uses all fields that are not in “fields to be changed” as criteria for breaking up the data into subsets.Block value will show you that criteria.
Since we have two “messages” in our code we can see that along with any system generated messages using the messages button.