Difference between revisions of "SAP ABAP ADOBE FORMS"
From SapWiki
(Created page with "<pdf>File:Mini_manual_adobe_forms.pdf</pdf> <pdf>File:Insertar_imagenes_Adobe_Forms.pdf</pdf>") |
|||
Line 3: | Line 3: | ||
<pdf>File:Insertar_imagenes_Adobe_Forms.pdf</pdf> | <pdf>File:Insertar_imagenes_Adobe_Forms.pdf</pdf> | ||
+ | |||
+ | ==Ejemplo programa de impresión== | ||
+ | <nowiki>FORM print_pdf USING p_data TYPE zestruc_cert_renta | ||
+ | CHANGING p_xstring TYPE xstring | ||
+ | p_subrc TYPE sy-subrc. | ||
+ | DATA: wa_output TYPE sfpoutputparams, | ||
+ | wa_result TYPE sfpjoboutput. | ||
+ | DATA: gs_fp_outputparams TYPE sfpoutputparams, | ||
+ | lv_fm_name TYPE rs38l_fnam, | ||
+ | lv_form_name TYPE fpwbformname, | ||
+ | wa_docparams TYPE sfpdocparams. | ||
+ | DATA ls_pdf_file TYPE fpformoutput. | ||
+ | |||
+ | *...Opciones de salida impresión | ||
+ | wa_output-device = 'PRINTER'. | ||
+ | * wa_output-dest = 'PDF1'. | ||
+ | wa_output-cover = 'D'. | ||
+ | wa_output-receiver = sy-uname. | ||
+ | wa_output-reqnew = abap_true. | ||
+ | wa_output-preview = abap_false. | ||
+ | * wa_output-getpdf = space. | ||
+ | wa_output-getpdf = abap_true. | ||
+ | |||
+ | wa_output-nopreview = abap_true. | ||
+ | wa_output-nodialog = abap_true. | ||
+ | wa_output-reqimm = abap_false. | ||
+ | |||
+ | |||
+ | CALL FUNCTION 'FP_JOB_OPEN' | ||
+ | CHANGING | ||
+ | ie_outputparams = wa_output | ||
+ | EXCEPTIONS | ||
+ | cancel = 1 | ||
+ | usage_error = 2 | ||
+ | system_error = 3 | ||
+ | internal_error = 4 | ||
+ | OTHERS = 5. | ||
+ | IF sy-subrc <> 0. | ||
+ | p_subrc = 1. | ||
+ | RETURN. | ||
+ | ENDIF. | ||
+ | |||
+ | TRY. | ||
+ | lv_form_name = 'Z_MI_FORMULARIO'. | ||
+ | CALL FUNCTION 'FP_FUNCTION_MODULE_NAME' | ||
+ | EXPORTING | ||
+ | i_name = lv_form_name | ||
+ | IMPORTING | ||
+ | e_funcname = lv_fm_name. | ||
+ | CATCH cx_fp_api_repository | ||
+ | cx_fp_api_usage | ||
+ | cx_fp_api_internal. | ||
+ | p_subrc = 2. | ||
+ | RETURN. | ||
+ | ENDTRY. | ||
+ | |||
+ | CALL FUNCTION lv_fm_name | ||
+ | EXPORTING | ||
+ | * /1bcdwb/docparams = wa_docparams | ||
+ | gs_datos = p_data | ||
+ | IMPORTING | ||
+ | /1bcdwb/formoutput = ls_pdf_file | ||
+ | EXCEPTIONS | ||
+ | usage_error = 1 | ||
+ | system_error = 2 | ||
+ | internal_error = 3 | ||
+ | OTHERS = 4. | ||
+ | IF sy-subrc NE 0. | ||
+ | p_subrc = 3. | ||
+ | RETURN. | ||
+ | ENDIF. | ||
+ | |||
+ | CALL FUNCTION 'FP_JOB_CLOSE' | ||
+ | IMPORTING | ||
+ | e_result = wa_result | ||
+ | EXCEPTIONS | ||
+ | usage_error = 1 | ||
+ | system_error = 2 | ||
+ | internal_error = 3 | ||
+ | OTHERS = 4. | ||
+ | IF sy-subrc <> 0. | ||
+ | p_subrc = 4. | ||
+ | RETURN. | ||
+ | ENDIF. | ||
+ | |||
+ | p_xstring = ls_pdf_file-pdf. | ||
+ | * READ TABLE wa_result-spoolids INTO DATA(wa_spoolids) INDEX 1. | ||
+ | * CHECK sy-subrc = 0. | ||
+ | * | ||
+ | ** Get merged document | ||
+ | * DATA l_xstring TYPE xstring. | ||
+ | * CLEAR l_xstring. | ||
+ | * CALL FUNCTION 'RSPO_GET_MERGED_PDF_FROM_SPOOL' | ||
+ | * EXPORTING | ||
+ | * spool_number = wa_spoolids | ||
+ | * IMPORTING | ||
+ | * merged_document = l_xstring | ||
+ | * EXCEPTIONS | ||
+ | * internal_error = 1 | ||
+ | * empty_job = 2 | ||
+ | * not_supported = 3 | ||
+ | * OTHERS = 4. | ||
+ | * IF sy-subrc = 0. | ||
+ | * p_xstring = l_xstring. | ||
+ | * ENDIF. | ||
+ | ENDFORM.</nowiki> |
Revision as of 17:06, 7 January 2021
The URL or file path given does not exist.
Ejemplo programa de impresión
FORM print_pdf USING p_data TYPE zestruc_cert_renta CHANGING p_xstring TYPE xstring p_subrc TYPE sy-subrc. DATA: wa_output TYPE sfpoutputparams, wa_result TYPE sfpjoboutput. DATA: gs_fp_outputparams TYPE sfpoutputparams, lv_fm_name TYPE rs38l_fnam, lv_form_name TYPE fpwbformname, wa_docparams TYPE sfpdocparams. DATA ls_pdf_file TYPE fpformoutput. *...Opciones de salida impresión wa_output-device = 'PRINTER'. * wa_output-dest = 'PDF1'. wa_output-cover = 'D'. wa_output-receiver = sy-uname. wa_output-reqnew = abap_true. wa_output-preview = abap_false. * wa_output-getpdf = space. wa_output-getpdf = abap_true. wa_output-nopreview = abap_true. wa_output-nodialog = abap_true. wa_output-reqimm = abap_false. CALL FUNCTION 'FP_JOB_OPEN' CHANGING ie_outputparams = wa_output EXCEPTIONS cancel = 1 usage_error = 2 system_error = 3 internal_error = 4 OTHERS = 5. IF sy-subrc <> 0. p_subrc = 1. RETURN. ENDIF. TRY. lv_form_name = 'Z_MI_FORMULARIO'. CALL FUNCTION 'FP_FUNCTION_MODULE_NAME' EXPORTING i_name = lv_form_name IMPORTING e_funcname = lv_fm_name. CATCH cx_fp_api_repository cx_fp_api_usage cx_fp_api_internal. p_subrc = 2. RETURN. ENDTRY. CALL FUNCTION lv_fm_name EXPORTING * /1bcdwb/docparams = wa_docparams gs_datos = p_data IMPORTING /1bcdwb/formoutput = ls_pdf_file EXCEPTIONS usage_error = 1 system_error = 2 internal_error = 3 OTHERS = 4. IF sy-subrc NE 0. p_subrc = 3. RETURN. ENDIF. CALL FUNCTION 'FP_JOB_CLOSE' IMPORTING e_result = wa_result EXCEPTIONS usage_error = 1 system_error = 2 internal_error = 3 OTHERS = 4. IF sy-subrc <> 0. p_subrc = 4. RETURN. ENDIF. p_xstring = ls_pdf_file-pdf. * READ TABLE wa_result-spoolids INTO DATA(wa_spoolids) INDEX 1. * CHECK sy-subrc = 0. * ** Get merged document * DATA l_xstring TYPE xstring. * CLEAR l_xstring. * CALL FUNCTION 'RSPO_GET_MERGED_PDF_FROM_SPOOL' * EXPORTING * spool_number = wa_spoolids * IMPORTING * merged_document = l_xstring * EXCEPTIONS * internal_error = 1 * empty_job = 2 * not_supported = 3 * OTHERS = 4. * IF sy-subrc = 0. * p_xstring = l_xstring. * ENDIF. ENDFORM.