Es gibt ab und an die Anforderung Adobe Formulare direkt aus der Dynpro- oder Reportverarbeitung aufzurufen. Ich habe dafür eine kleine Lösung gebaut, die den Umweg über das Temp-Verzeichnis auf dem lokalen Rechner geht und das Formular dann in einem Popup(cl_abap_browser) anzeigt. So wird mit relativ wenig Aufwand das entsprechende Formular erzeugt UND angezeigt.
CONSTANTS: con_formname TYPE fpname VALUE 'FP_TEST_00'.
DATA ls_outputparams TYPE sfpoutputparams.
DATA ls_formoutput TYPE fpformoutput.
DATA lv_fm_name TYPE funcname.
DATA lv_temp_dir TYPE string.
DATA lv_separator TYPE c LENGTH 1.
DATA lv_filename TYPE string.
DATA lt_tsftext type tsftext.
CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
EXPORTING
i_name = con_formname
IMPORTING
e_funcname = lv_fm_name.
ls_outputparams-nodialog = 'X'. " suppress printer dialog popup
ls_outputparams-getpdf = 'X'. " launch print preview
CALL FUNCTION 'FP_JOB_OPEN'
CHANGING
ie_outputparams = ls_outputparams
EXCEPTIONS
cancel = 1
usage_error = 2
system_error = 3
internal_error = 4
OTHERS = 5.
lt_tsftext = VALUE #( ( tdline = 'Testzeile' ) ).
CALL FUNCTION lv_fm_name
EXPORTING
textlines = lt_tsftext
IMPORTING
/1bcdwb/formoutput = ls_formoutput
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.
cl_gui_frontend_services=>get_file_separator(
CHANGING
file_separator = lv_separator
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
OTHERS = 4 ).
cl_gui_frontend_services=>environment_get_variable(
EXPORTING
variable = 'TMP'
CHANGING
value = lv_temp_dir
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
OTHERS = 4 ).
cl_gui_cfw=>flush( ).
lv_filename = |{ lv_temp_dir }{ lv_separator }{ sy-datum }_{ sy-uzeit }_Form.pdf|.
DATA(lt_solix) = cl_bcs_convert=>xstring_to_solix( iv_xstring = ls_formoutput-pdf ).
cl_scp_change_db=>xstr_to_xtab(
EXPORTING
im_xstring = ls_formoutput-pdf
IMPORTING
ex_xtab = DATA(lt_pdf) " Tabelle vom Typ X
ex_size = DATA(lv_laenge) " Größe des XSTRINGS
).
cl_gui_frontend_services=>gui_download(
EXPORTING
bin_filesize = lv_laenge
filename = lv_filename
filetype = 'BIN'
CHANGING
data_tab = lt_pdf " Übergabetabelle
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
not_supported_by_gui = 22
error_no_gui = 23
OTHERS = 24 ).
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty
NUMBER sy-msgno
WITH sy-msgv1
sy-msgv2
sy-msgv3
sy-msgv4.
ELSE. "PDF anzeigen
cl_abap_browser=>show_url(
EXPORTING
url = |file://{ lv_filename }|
title = |Formular: { con_formname }|
size = cl_abap_browser=>large
printing = abap_true
).
ENDIF.
Sei der Erste der einen Kommentar abgibt