Output Parameters, PDF Return and Spool Handling
Control preview, print, spool and PDF output from Adobe Form driver program.
Explanation
Adobe Forms can be used for preview, print, spool creation, email attachment or PDF download. Output behavior is controlled using output parameters and document parameters. In some scenarios, the program needs the PDF binary data instead of immediate print preview. In other scenarios, the form should go directly to spool. A strong ABAP consultant should know how to set output parameters and handle generated PDF output. This is especially important for interfaces, email workflows and background jobs.
Code example
* Purpose:* Generate Adobe Form PDF output for email/download scenario.* getpdf = X tells framework to return PDF data instead of only preview/print. DATA ls_outputparams TYPE sfpoutputparams.DATA ls_formoutput TYPE fpformoutput.DATA lv_fm_name TYPE rs38l_fnam. ls_outputparams-nodialog = abap_true.ls_outputparams-getpdf = abap_true. CALL FUNCTION 'FP_JOB_OPEN' CHANGING ie_outputparams = ls_outputparams. CALL FUNCTION 'FP_FUNCTION_MODULE_NAME' EXPORTING i_name = 'ZINVOICE_ADOBE_FORM' IMPORTING e_funcname = lv_fm_name. CALL FUNCTION lv_fm_name IMPORTING /1bcdwb/formoutput = ls_formoutput EXPORTING is_header = ls_header it_items = lt_items. CALL FUNCTION 'FP_JOB_CLOSE'. * PDF binary is available in ls_formoutput-pdf.* It can be attached to email or returned through an API.Real project scenario
A billing output program generated invoice PDF and attached it to an email instead of showing print preview. The driver collected PDF output and passed it to email sending logic.
Common mistakes
- Not setting getpdf when PDF binary is required. - Using preview settings in background job. - Not handling spool output correctly. - Forgetting FP_JOB_CLOSE.
Best practices
- Set output parameters based on scenario. - Use getpdf for PDF binary. - Avoid dialog options in background jobs. - Handle spool and PDF output explicitly.
Interview angle
Senior candidates should know how to generate PDF output and use it for email/API/background processing.