Below code snippet shows how an Adobe form is called from a Driver Program.
DATA: lv_form_name TYPE fpname VALUE 'ZADOBE_FORM',
wa_otparams TYPE sfpoutputparams,
lv_fm TYPE funcname,
e_result TYPE sfpjoboutput.
"Here goes the code for fetching the data that we want to pass.
------------------------------------------------------------------
"Every Form is a function module. We don't know the technical name of the FM. So this FM is used to call the actual FM holding the form.
CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
EXPORTING
i_name = lv_form_name
IMPORTING
e_funcname = lv_fm.
"These are the output settings to be passed in FP_JOB_OPEN FM
wa_otparams-nodialog = 'X'.
wa_otparams-preview = 'X'.
"This FM is used to Determine the output settings of the form (Print, Print Preview, Archive settings)
CALL FUNCTION 'FP_JOB_OPEN'
CHANGING
ie_outputparams = wa_otparams
EXCEPTIONS
cancel = 1
usage_error = 2
system_error = 3
internal_error = 4
OTHERS = 5.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
"This will call the ADOBE Form. I stated earlier that every form is an FM. We got the actual FM name from FP_FUNCTION_MODULE_NAME and received it in LV_FM. Now we are calling that directly.
CALL FUNCTION lv_fm
EXPORTING
ls_tab = table_name
ls_var = variable_name
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
"Every Open Job has to be closed. This will close the output spool and return the result.
CALL FUNCTION 'FP_JOB_CLOSE'
IMPORTING
e_result = e_result
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
No comments:
Post a Comment