Digital Signature in Adobe Forms
This blog will help in creating a digitally signed Adobe Form.
With digital signatures getting a nod in many countries, a lot of organizations are looking up to digital signatures to save the time spent on a redundant task such as, signing the hard copy. By using digital signatures, a soft copy can be digitally signed and secured.
I have used, ABAP to design the form. The reason of using SFP transaction is, easier integration of form and interface with various other platforms, that is not easily ans seamlessly possible with WD JAVA.
The following steps need to be verified by the basis team for digital signature to be active in the system.
1. Uploading a digital signature in the system
2. Create connection between ADS (Adobe Document Services) and R/3 system – It is recommended to name the connection, “ADS_HTTPS”
The following steps will create an Adobe for with digital signature.
Go to transaction SFP
Give the interface, you want to design, a name. The interface is that part, in which we write the logic for pulling data from the tables. Click on create.
Maintain the data to be used in the form under Global Data. Both input and output elements can be used here. We need to define the name and the type.
Go to Code initialization. Here we write the logic of extracting the data from the tables. Here we need to define the Input & Output parameters. The Input / Output parameters are the ones, defined in Global Data. Here we don’t need to define the Type.
Note: The name used in The Input / Output parameters should be the same that is used in Global Data.
Once the code is written in the interface, save it and go back to Form (Transaction SFP)
Give the form a name and create the form.
In the form properties, provide the name of the interface which the form will call.
In the context, bind the global data with the form context. This can be done by simple drag and drop.
Click on layout, to design the form.
Design the form and bind the UIs with the data available in the data view.
After form design, insert the signature field in the form.
Once the form has been designed and the digital signature field has been incorporated in the form, the code for digitally signing the form will be written in the RFC that will call the form.
We’ll have to define the HTTP Connection, the position of the Digital Signature UI and the name of the digital signature in the form.
Following is the code that we need to write to define the above mentioned fields.
P_DEST TYPE RFCDEST VALUE ‘ADS_HTTPS’, // The name of connection
S_FIELD(100) TYPE C VALUE ‘data.#subform.END.SIGNATURE.SignatureField1’, // The position of digital signature
FORM_NAME = ‘ZMM_V2V_RATE’. // The form RFC needs to call
S_ALSIGN = ‘Umang_Test’ . // Name of Digital Signature
Following is the code that needs to be written for digitally signing the form.
FORM_NAME = ‘ZMM_V2V_RATE’.
S_ALSIGN = ‘Umang_Test’.
GS_FPOUTPARAMS–NODIALOG = ‘X’.
GS_FPDOCPARAMS–FILLABLE = ‘X’.
CALL FUNCTION ‘FP_JOB_OPEN’
IE_OUTPUTPARAMS = GS_FPOUTPARAMS
CANCEL = 1
USAGE_ERROR = 2
SYSTEM_ERROR = 3
INTERNAL_ERROR = 4
OTHERS = 5.
IF SY–SUBRC <> 0.
CALL FUNCTION ‘FP_FUNCTION_MODULE_NAME’
I_NAME = FORM_NAME
E_FUNCNAME = GV_FMNAME.
CATCH CX_ROOT INTO LV_W_CX_ROOT.
LV_MESG = LV_W_CX_ROOT->GET_TEXT( ).
CALL METHOD L_PDFOBJ->SET_DOCUMENT
PDFDATA = FORMOUTPUT–PDF.
CALL METHOD L_PDFOBJ->SET_SIGNATURE
KEYNAME = S_ALSIGN
FIELDNAME = S_FIELD.
CALL METHOD L_PDFOBJ->EXECUTE( ).
L_PDFOBJ->SET_USAGERIGHTS( DEFAULT_RIGHTS = C_FALSE ).
CALL METHOD L_PDFOBJ->GET_DOCUMENT
PDFDATA = L_OUT.
CALL FUNCTION ‘SCMS_XSTRING_TO_BINARY’
BUFFER = L_OUT
* APPEND_TO_TABLE = ‘ ‘
* OUTPUT_LENGTH =
BINARY_TAB = BINARY_CONTENT.
CALL FUNCTION ‘FP_JOB_CLOSE’
USAGE_ERROR = 1
SYSTEM_ERROR = 2
INTERNAL_ERROR = 3
OTHERS = 4.
The above mentioned code will digitally sign the document.