(Original Blog Post from Juan Pablo Guerena-Moran, coresuite expert, posted at the 03.05.2013)
When programming with coresuite optimizer, we often create rules that interact directly with the UI of the form we are working on. In this case, we only deal with information that is visible in the active form (for example, by using pVal.GetFromUID). When we want to access information that is not displayed, but else stored inside one of the tables of SAP, the general approach is to create a SQL query that allow us to get the data we are looking for.
What happens, however, when we want to retrieve information that is not being displayed and has not been stored yet in any table? How would it be possible to obtain this kind of data? Fortunately, optimizer allows us to take advantage not only of the functions defined in the coresuite framework, but also the ones in the SAP SDK as well.
Let’s say we want to know if the draft document we have open at that moment has been approved, or which is its current status. Maybe the approach would be running a query to get that information from the draft documents table. This is possible, but first we would need to get the draft's ID. This may be a little hard to grasp for the uninitiated, but can be easily solved by using the following code:
This code stores in the variable "DocAuthStatus" the value of the Authorization Status
(WddStatus). We can then incorporate this information in the logic of our customize rule.
This is very useful, and this is an uncomplicated technique to obtain information from most SAP forms. Give it a try and forget saying "no" to your customers’ requirements