Reverse engineering OnPremise FIORI for “key” source code!
Sometimes you are looking for a solution at Google (or even here) and it’s very hard to find, or you’re looking for better ways on how to achieve a scenario that standard SAP already does (like BAPIs, etc.) but without much success.
I’m here to tell you that, if you have OnPremise FIORI installed (or other products), you can study how it’s done on the “new approach” that comes with the standard apps, mostly with “API” classes/methods that can be or contain exactly what you need!
Let’s use the Approve Purchase Order standard FIORI App as an example:
Looking at the Item details page, we can see that lists all major important details regarding it:
But if i don’t want to manually select all the relevant tables to get these data, i want a “complete” and simple solution to achieve that, what can i do? Let’s study how FIORI does!
First, activating a trace for my user at: /IWFND/TRACES. After the refresh, we notice what service/entity this exactly screen executes to get the data:
Looking at the return, we can see all the data presented at the screen.
Now that we know what service it’s executed (you can find that out as well checking the FIORI Apps Library ?):
Go to service implementation to find the Data provider class (DPC):
Now searching this class, placing a break point at the GET_ENTITY method (looking for the WorkflowTask entity, as we saw at the TRACE):
We discover that the exact place that standard code looks for the relevant data for this PO is on the GET_PO_WORKFLOW_FOR_LIST method:
Voilà! ? Now you’ve discovered that there is a class (CL_GBAPP_APV_PO_API) that contains a lot of methods regarding the process of approval a PO, so you can see what all the methods do and copy to your needs or even use this class methods as well.