0

I'm working on a report which contains actions allowing the user to reach a a new page. In this new page pdf stored on the application server has to be displayed.

On the PDF view I created an interactive form linked with my context (PDF_DATA-PDF : xstring)

   gv_filepath = '/tmp/test.pdf'.


   " Open the file in binary mode
   OPEN DATASET gv_filepath FOR INPUT IN BINARY MODE.


   IF sy-subrc = 0.
     READ DATASET gv_filepath INTO gv_filedata.


       IF sy-subrc = 0.
            CLOSE DATASET gv_filepath. "Close the file

            " Convert the file from hex-string to Binary format
            CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
              EXPORTING
                buffer        = gv_filedata
              IMPORTING
                output_length = gv_filesize
              TABLES
                binary_tab    = gt_bin_data.

Here, I don't know what to do ....


        lo_node = wd_context->get_child_node( 'PDF_DATA' ).
        lo_node->set_attribute( name = 'PDF' value = ?).

        wd_comp_controller->gestion_affichage( ).

     ENDIF.

   ENDIF.

Please suggest how do I handle this?

Suncatcher
  • 10,355
  • 10
  • 52
  • 90
Stéphane
  • 1
  • 1
  • 2
  • Is the new page a Web Dynpro page at all or are you just shoving a PDF file back to the browser? – vwegert Jun 24 '16 at 18:32
  • As long I can show the pdf, one of the two solutions is fine to me. Do you have an idea how I can realise this ? – Stéphane Jun 25 '16 at 21:55

3 Answers3

0

There are a couple of ways to implement this:

  • Use a FileDownload element and perform the operations you described above in the Supply method of the context element. That's probably the easiest way to implement this, but it might have the drawback that the file is not displayed, but offered for download instead. It's worth giving it a try though since it's very easy to implement.
  • Create a new ICF service (not a WebDynpro application!) that will return the PDF file with an appropriate MIME type when requested. Then, open a new browser window with the URL of that service.
  • As before, but use an IFrame element to display the PDF file in-place. Be aware that the usage of this element is discouraged (although probably only to push customers towards EP...?).
vwegert
  • 18,371
  • 3
  • 37
  • 55
0

To display a PDF file in Web Dynpro ABAP page,

  • Add the InteractiveForm control to the View
  • Bind the pdfSource property to the Context node containing the PDF content
  • Load the PDF file to the context node

Here is an example with screen shots

Klaus Hopp
  • 41
  • 2
0

Well i solved my problem with my colleague, thank you I just have to add the following code after the OPEN DATASET

 CLEAR l_len.
   CLEAR l_data_tab.
   DO.
     READ DATASET gv_filepath INTO l_data actual LENGTH l_len.
     IF sy-subrc <> 0.
       IF l_len > 0.
         file_size = file_size + l_len.
         APPEND l_data to l_data_tab.
       ENDIF.
       EXIT.
     ENDIF.
     file_size = file_size + l_len.
     APPEND l_data to l_data_tab.
   ENDDO.
Stéphane
  • 1
  • 1
  • 2