Skip to Content
0
Former Member
Sep 01, 2008 at 04:25 PM

Smart Form as PDF within iframe

92 Views

Hi all,

the problem i'm facing today is that i can't display a SMART FORM as a PDF in an <iframe> Tag.

If i call a simple PDF (which is stored on my PC as a local file) everything works fine and the PDF is

shown within the iframe Tag.

<html>
<head>
</head>
<body>
Test<p>
<iframe src="C:Test.pdf" width="90%" height="400" name="test"></iframe>
</body>
</html>

If i try to do the same with my test BSP the PDF is not shown within iframe Tag. Instead the iframe Tag

stays empty and the PDF is called directly by the Adobe Reader and not by my Browser (IE7).

<html>
<head>
</head>
<body>
Test<p>
<iframe src="https://vsapex2ci.daksap.de:44320/sap/bc/bsp/sap/zpdf_test/test.htm" 
width="90%" height="400" name="test"></iframe>
</body>
</html>

On my test.htm only OnInitialization is implemented. Here's the Code:

DATA: lv_pdf         TYPE xstring,
      ls_output_data TYPE ssfcrescl,
      ls_ctrl_param  TYPE ssfctrlop,
      lv_fm_name     TYPE rs38l_fnam,
      lt_lines       TYPE TABLE OF tline,
      lv_pdf_len     TYPE i.


  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
      formname           = 'ZTESTPDF'
    IMPORTING
      fm_name            = lv_fm_name
    EXCEPTIONS
      no_form            = 1
      no_function_module = 2
      OTHERS             = 3.

  ls_ctrl_param-no_dialog = 'X'.
  ls_ctrl_param-getotf    = 'X'.

  CALL FUNCTION lv_fm_name
    EXPORTING
     CONTROL_PARAMETERS         = ls_ctrl_param
     USER_SETTINGS              = space
    IMPORTING
     JOB_OUTPUT_INFO            = ls_output_data

* Conversion of output format OTF into PDF format
  CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
      format                = 'PDF'
    IMPORTING
      bin_filesize          = lv_pdf_len
      bin_file              = lv_pdf
    TABLES
      otf                   = ls_output_data-otfdata
      lines                 = lt_lines.

    response->set_header_field( name  = 'content-type'
                                value = 'application/pdf' ).

    response->set_header_field( name  = 'cache-control'
                                value = 'max-age=0' ).

    response->set_header_field( name  = 'content-disposition'
                                value = 'attachment; filename=test.pdf' ).

    lv_pdf_len = XSTRLEN( lv_pdf ).
    response->set_data( data   = lv_pdf
                        length = lv_pdf_len ).

    navigation->response_complete( ).

How can i display my generated PDF (SMART FORM) within an iframe Tag?

Regards

Mark-André