Skip to Content

Dynamic Generation of Offline Adobe Interactive forms for SAP 4.6c and EP 7.0 without User Intervention(Part II)

In Continuation to my previous blog, in this Second part 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 (AIF) at run time without Webdynpro Java, without logging into Portal and with out user intervention using SAP R/3 4.6c. As I discussed in my previous blog (Part-I) we have scenario to have a java service which runs at regular intervals of 5 minutes, picks the Quotations created in the last 5 minutes span in R/3, Generate AIF on the fly by merging the XDP template with the data from RFC and send it as mail attachment to customers automatically. This AIF (Offline) also contains a WebService to enable the customer submit the form back directly from the desk top without logging into portal

h5. How to Implement this Solution

We have implemented this Solution by dividing it into 5 Steps. 

> Creating XDP file

> Connecting to SAP and getting data


> Generating XML Data String at runtime.


> Using PDFDocument API for Dynamic Generation of Adobe Interactive Form


> Send the Generated AIF as mail Attachment using Mail API


> Scheduling the Entire Project Using KM Scheduler


Our Environment


Netweaver Developer Studio: 7.0.15


Adobe Reader 9.0


Adobe Live Cycle Designer 8.0


SAP Enterprise Portal 7.0 SP15 with Adobe Document Services Configured

h5. Creating XDP file


We have designed the Adobe Interactive Form using Adobe Live Cycle Designer 8.0 and placed the resultant XDP file in a shared folder on the Portal Server. Every UI Element is bound to an attribute (The attribute name is very important, as we are going to use the same name while generating the XML Data). Since the entire process has to happen in the background, we are not going to include this as part of any webdynpro application.


Connecting to SAP and getting data


Since only the .par files can be exposed as KM Scheduler Tasks, we have chosen “Portal Application Project” in Netweaver Developer Studio, for our purpose. While implementing the AIF dynamic generation functionality (in run method) we need to fetch the data that should be populated in the XDP template from RFCs (R/3) and for this we are using JCO client middle layer. Hence we are creating this SAP Connectivity to enable the NWDS generate the proxy classes for us and we are using these proxy classes to pass input parameters, get output parameters and execute the RFC. Also ensure that SAPJCorfc.DLL and sapjco.jar should be present at c:\windows\system32 on Portal Server and we need to restart the server once after placing these files.


Generating XML Data String at runtime


To be able to Schedule KM Scheduler and enable it to call our Java Application (Portal Application), application should follow Repository Framework. Usually RF is used for extending or customizing the standard delivered KM functionality by SAP (like implementing Repository Filters, Customizing Resource Renderers, Collection Renderers in KM etc..). The same RF can also be used to schedule and call any Job developed as Java Application. Technically this means our class should implement the ISchedulerTask Interface. Within our Portal Application Project, we have to create a Repository Framework and choose “Scheduler Task Wizard”. In the Scheduler Task Wizard’s screen provide a Class name, Package and Eclipse project Name and click finish. 

NWDS Auto generates the skeleton for the implementation of the interface ISchedulerTask:

* *In your java class ( you will find the following template already created by NWDS. We have to write the entire code that is to be called by the KM scheduler in the run method  

package com.companyName.project;

import java.util.Properties;

import com.sapportals.wcm.WcmException;

import com.sapportals.wcm.service.;</p><p>import com.sapportals.wcm.service.scheduler.;//Written in the Custom Method getExampleDetailRFC

//Header data

sb = new StringBuffer(0); for(

You must be Logged on to comment or reply to a post.
  • how are you handling client side validation? do you have the script in each form, or is there another way?

    I have many deviations of the same form template, and I want to eliminate the number of forms by using a more dynamic approach, but I'm faced with the client side validation of each form.

    any ideas?

      • Hi,
        I am using the same method to generate a PDF file. It works perfectly fine when I am embedding values inside table cells or embedding images. There is an additional requirement however, that I need to change the background color of a cell depending on the value that is shown in that cell. I have looked all over the place, but can't find a complete solution for my problem. I think you can embed a script in the XML source (setData method) using xfa:contentType="application/x-formcalc" attribute, but haven't been able to add a script successfully using this method. Any ideas??

        Navneet Nair.

        • Hi,
          From my under standing we cannot set color dynamically when the text is static. You can change the color of a cell depending on the value that is shown in the cell if the text is in non-editable field (Script type:- Java Script, Code to be written in Initialize method, this.fillColor="255,102,0";). If you want to know what values you need to give here for a specific color
          1)Goto Border tab in right pane of Adobe Designer
          2)Goto Background fill
          3)Select style:-Solid
          4)You can see the color icon highlighted
          5)Click on that icon
          6)Select what ever color you required.
          7)When the color is assigned select the specific field
          8)Goto XML Source of specific field.
          9)You find the code of the color()
          10)Copy the value of the color do write the code in the initialize method.
          11)Now it is done.
          Hope your question got resolved.
          For adobe forums queries you can visit the site: