Dynamic Generation of Offline Adobe Interactive forms for SAP 4.6c and EP 7.0 without User Intervention (Part I)
Our requirement is to mail an offline adobe interactive form to the customer every time a new sales order quotation is created in R/3. This should happen automatically without any user interaction whenever sales quotation is created in R/3 and the offline form should have sales quotation data and submit button option. Customer would open the adobe form and make the required changes and submits the form by clicking on submit button which in turn posts the changed order data to SAP. This looked as very regular scenario and we thought of designing a workflow which gets triggered whenever sales order quotation is created. Design an offline form in SAP which is invoked and sent as mail as part of workflow. This would have worked if our client is not on R/3 4.6c which doesn’t have any Adobe Forms capability.
Very important aspects to take into consideration are –
· Form should be mailed with in 5 minutes after the Sales order quotation creation
· Form should be sent out with out any user intervention
We started to think about different approaches that could work in our environment which is R/3 4.6c and EP 7.0 SP15.
Offline Form using ABAP: Our ABAP team suggested the most common and easy approach as per them- Generating the form dynamically at run time using PDFObject API available in ABAP. As mentioned above this doesn’t work with R/3 4.6c as Adobe SAP partnership started with NW 04.
Generate Form in Java Stack and invoke from SAP: Since Adobe Offline form can‘t be generated in ABAP stack, only other option left is generating the offline form in Java Stack and invoking it from R/3 whenever sales order quotation is created.
How to Invoke Adobe Form: Adobe form is typically embedded in a Webdynpro application. Webdynpro being UI technology, this requires manual intervention. Since this has to happen in the background automatically, this solution won’t work for us. Then we came across PDFDocument API available which we could use in the init method of Webdynpro to send out the adobe form automatically. All this requires is invoking the Webdynpro application URL and passing the sales order quotation data. We looked at different options to do this but we couldn’t find any way to invoke the URL of Webdynpro application from R/3. Other option available is to create adobe form and expose it as web service which seems to be the common used technology as it is independent of any protocol and also gives me the flexibility to use it from virtually any system. Unfortunately we are told that R/3 4.6c doesn’t have the capability to invoke Web services. So using both Webdynpro and Web service are taken out due to limitation of R/3 4.6c.
At this point of time, we were desperately looking for the solution to our problem – Even we write any sort of java service, with out calling the Java Service from R/3 as soon as the Quotation is created, how and when to invoke the java service that is sitting on top of J2EE engine and how does the Service knows that there is Quotation created in R/3 and it should react now.
Then after some brain storming and discussions, my team mate Ramesh and I came to a conclusion that as we can invoke the Java Service from R/3, why not the java Service itself go and pick the already created Quotation numbers in R/3, periodically. Every time a sales order quotation is created a custom table gets updated with sales order quotation number and status. We need a way to query this table periodically and trigger the adobe document. We are looking for some sort of a scheduler that runs periodically on Portal and we found that there is KM Scheduler which full fills our requirement. KMScheduler can be scheduled to call a Java Program periodically. We need to design a java program which can read the data from custom table generate interaction form and mail the form to the customer. All these three can be achieved by creating a portal application which can call RFC to get data from SAP, generate interaction from using PDFDocument API and mail the document using Java Mail API. Most importantly this can be scheduled through KMScheduler. So we decided to go with this approach. We will further discuss the technical details in our next blog.
Initially we need to generate the Offline AIF on the fly. For this we found that there is PDF Document API provided by SAP which can solve the AIF generation problem. In order to generate PDF, the API requires XDP template and XML data. It takes both of them and merges into single Dynamic Offline AIF. We designed the XDP template using Adobe Live Cycle Designer (Web Service is also incorporated into it which is used to update form data to R/3 on form submission by customer) and the XML String should be runtime generated by calling the RFC and delimiting the data with XML tags. To call RFC we need to use JCO Client and for this SAP Connectivity should be created in the Portal Application Project. All this Process needs be scheduled to run periodically. At this instance, we created a KM Scheduler and placed all the Code in this project. Since only the Portal Application project can be scheduled as such, we have chosen Portal Application Project.
In the Second part of this blog I am going to discuss and demonstrate how we technically developed this solution. The purpose of this blog is you can create an Adobe Interactive Form at run time without Webdynpro Java, without logging into Portal and with out user intervention using SAP R/3 4.6c.