ICh hoffe mir kann jemand helfen oder mich auf jemanden verweisen
Ich möchte mein Smartform in meiner BSP Applikation nach PDF konvertieren und das PDF in einem neuen Fenster anzuzeigen.
Ich habe eine Seite mit einem Button(Druckansicht) implemtiert. Diesen habe ich im InputProcessing event implementiert. Auf einer neuen Seite soll nun der Smart form aufruf stattfinden und die anschließende Konvertierung nach pdf.
Wenn das PDF geöffnet werden soll, geht der Adobe Reade auf , ohne Inhalt und es kommt die Nachricht: Daei beginnt nicht mit "%-pdf".
Habe hierbei schon alles probiert.
Mein Code ist:
- Code: [Select all] [Expand/Collapse] [Download] (Untitled.txt)
- * event handler for data retrieval
- * parameters for generated function module
- ls_output_options type ssfcompop,
- ls_control_parameters type ssfctrlop,
- ls_output_data type ssfcrescl,
- l_devtype type rspoptype.
- * generated result: HTML with embedded CSS
- lt_html_raw type tsfixml,
- l_xstring type xstring, "needed for HTTP response
- l_html_xstring type xstring,
- l_xlength type i.
- * generated result: PDF format
- lt_lines type table of tline,
- ls_line type tline,
- l_pdf_len type i.
- * Cookie mit Eingabewerten holen
- cl_bsp_server_side_cookie=>get_server_cookie(
- EXPORTING
- name = 'lt_fields'
- application_namespace = 'NONE'
- application_name = 'NONE'
- username = 'NONE'
- session_id = 'NONE'
- data_name = 'NONE'
- "IMPORTING
- "expiry_date = date
- "expiry_time = time
- CHANGING
- data_value = lt_fields ).
- * Cookie mit Equipmentdaten holen
- cl_bsp_server_side_cookie=>get_server_cookie(
- EXPORTING
- name = 'ums_equip_ges'
- application_namespace = 'NONE'
- application_name = 'NONE'
- username = 'NONE'
- session_id = 'NONE'
- data_name = 'NONE'
- "IMPORTING
- "expiry_date = date
- "expiry_time = time
- CHANGING
- data_value = ums_equip ).
- *-----------------------------------------------------------------------
- * Get name of generated function module
- *-----------------------------------------------------------------------
- call function 'SSF_FUNCTION_MODULE_NAME'
- exporting formname = 'Z_REPKOST_GES'
- * variant = ' '
- * direct_call = ' '
- importing fm_name = l_function_module_name
- exceptions no_form = 1
- no_function_module = 2
- others = 3.
- * error handling
- with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
- exit.
- *---------------------------------------------------------------------------
- * get device type from language
- *---------------------------------------------------------------------------
- call function 'SSF_GET_DEVICE_TYPE'
- exporting
- i_language = sy-langu
- * i_application = 'SAPDEFAULT'
- importing
- e_devtype = l_devtype
- exceptions
- no_language = 1
- language_not_installed = 2
- no_devtype_found = 3
- system_error = 4
- others = 5.
- * error handling
- with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
- * set device type in output options
- ls_output_options-tdprinter = l_devtype.
- *-----------------------------------------------------------------------
- * Call the generated function module
- *-----------------------------------------------------------------------
- call function l_function_module_name
- exporting
- * archive_index =
- * archive_parameters =
- control_parameters = ls_control_parameters
- * mail_appl_obj =
- * mail_recipient =
- * mail_sender =
- output_options = ls_output_options
- user_settings = space
- UMS_EQUIP = UMS_EQUIP
- LT_FIELDS = LT_FIELDS
- importing
- * document_output_info =
- job_output_info = ls_output_data
- * job_output_options =
- * tables
- * zsystems = lt_sys
- exceptions formatting_error = 1
- internal_error = 2
- send_error = 3
- user_canceled = 4
- others = 5.
- * error handling
- with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
- *-----------------------------------------------------------------------
- * Conversion of output format OTF into PDF format
- *-----------------------------------------------------------------------
- * now convert the final document (OTF format) into PDF format
- call function 'CONVERT_OTF'
- exporting
- * MAX_LINEWIDTH = 132
- * ARCHIVE_INDEX = ' '
- * COPYNUMBER = 0
- importing
- bin_filesize = l_pdf_len
- bin_file = l_pdf_xstring " binary file
- otf = ls_output_data-otfdata
- lines = lt_lines
- exceptions
- err_max_linewidth = 1
- err_format = 2
- err_conv_not_possible = 3
- err_bad_otf = 4
- others = 5
- .
- * error handling
- with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
- CREATE OBJECT cached_response TYPE CL_HTTP_RESPONSE EXPORTING add_c_msg = 1.
- l_pdf_len = xstrlen( l_pdf_xstring ).
- length = l_pdf_len ).
- cached_response->set_header_field( name = if_http_header_fields=>content_type
- value = 'application/pdf' ).
- cached_response->set_status( code = 200 reason = 'OK' ).
- cached_response->server_cache_expire_rel( expires_rel = 180 ).
- CALL FUNCTION 'GUID_CREATE'
- IMPORTING
- ev_guid_32 = guid.
- cl_http_server=>server_cache_upload( url = display_url
- response = cached_response ).
- GeSHi ©
Hoffe mir kann einer sagen, wo der Fehler ist.
Danke.
Grüße