PDF form is geting popular in ABAP programming. Especially for those forms will be combined in the SAP GUI together with webdynpros.
This article described the steps to creat a PDF form.
1. Install 'SAP Adobe LiveCycle Designer'
2. execute tcode 'SFP'
Here, you can create the interface and form for the PDF form, different with SMARTFORMS, PDF form defined a separated interface for the program call.
In the interface, like SMARTFORMS, you can design the input and output parmeters, global definitions and do initializations.
In the FORM, you should annance the interface to be used by the form. And then the parameters of the interface can be linked to the context of the form.
In the form layout designed, you can combine the output field with the parameters to show the word in the form as your needed.
3. program the driver program of the PDF form.
First, get all the data for the interface parameters.
Second, CALL FUNCTION 'FP_FUNCTION_MODULE_NAME' to get the function name of the PDF form
Third, CALL FUNCTION 'FP_JOB_OPEN' to open a PDF form output job.
Forth, call the PDF function name, parameters are refer to the interface parameters.
Fifth, CALL FUNCTION 'FP_JOB_CLOSE' to close the PDF output job.
Sample codes as:
* get the function mudule name of the pdf form
CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
EXPORTING
i_name = lf_formname
IMPORTING
e_funcname = lf_fm_name.
IF sy-subrc <> 0.
* error handling
retcode = sy-subrc.
IF sy-subrc = 1.
MESSAGE e001(ssfcomposer).
ENDIF.
IF sy-subrc = 2.
MESSAGE e002(ssfcomposer) WITH lf_formname.
ENDIF.
ENDIF.
* set the job parameters
lv_outpuparams-dest = nast-ldest.
lv_outpuparams-reqimm = nast-dimme.
lv_outpuparams-reqdel = nast-delet.
CALL FUNCTION 'FP_JOB_OPEN'
CHANGING
ie_outputparams = lv_outpuparams
EXCEPTIONS
cancel = 1
usage_error = 2
system_error = 3
internal_error = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
lv_docparams-langu = sy-langu.
lv_docparams-country = 'US'.
lv_docparams-fillable = ''.
CALL FUNCTION lf_fm_name
EXPORTING
/1bcdwb/docparams = lv_docparams
address = ls_header
item_table = lt_item
item_final = lt_item_final
item_payment = lt_payment
IMPORTING
/1bcdwb/formoutput = lv_fpformoutput
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4.
CALL FUNCTION 'FP_JOB_CLOSE'
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4.