What I learned:- SAP Workflow approval process can be integrated with a Java application
There was a strange (well I thought it was strange as I did not had much idea on workflows at that time 🙂 )requirement from our client to have a front-end for the invoice creation, approval and posting process.
Now we already had a workflow which was handling the approval process in R/3 using SAP inbox and standard SAP approval process.
The business requirement was to remove the SAP inbox functionality completely and have the inbox and approval modules integrated in a browser (using Java).
Is that possible?? Well. I learned that “it is possible”.
This is how..
We were dealing with 3 major issues here:-
1. Replicate the document creation process in Java.
This issue was a bit easy to tackle as we need to just mock the SAP document creation process/screens into Java.
We designed an RFC which fetch the entries made by user in browser and will be passed back to R3.
In R3, we call t-code FV60 to create the document and custom approver logic will also be updated in the RFC.
2. Make a virtual inbox for the approver in Browser.
As we don’t have a physical inbox available in Java, we created an RFC which will be called once a user is logged in to the front-end application.
This RFC will use the username as input and will check all the custom tables to get all open documents which are pending for this user’s action.
Then these documents are passed back to Java which they will be displaying in form of an inbox.
3. Enable Approvers to take action on the document from Java front-end.
This was the most difficult part of this whole design process.
We removed all agent assignments from the workflow and relied on some container variables to store the approval details.
(No!!! Now I feel this was a major fault as we could use function modules to mock agent’s action.)
The approval steps are replaced with event receiver steps. This was the most crucial design change in the workflow.
So when approver clicks on an approve/reject button in Java, an RFC will called (with the action), which will use FM SAP_WAPI_CREATE_EVENT to create event. The event receiver will catch this event and will continue the approval process.
Though there were many design flaws with this approach (replacing the agent assignment being the major one), I learned that Java can be integrated with SAP workflows.. 🙂
PS: Please provide your valuable inputs/feedbacks as this is my first blog.