cancel
Showing results for 
Search instead for 
Did you mean: 

Open Adobe Print Form from ALV Int. Rprt using the XSTRING already present

Former Member
0 Kudos

Hello Friends,

I have a typicall issue that how to open a Adobe Print Form when a user double clicks in the ALV Report. Here when the user double clicks in the ALV Interactive Report using the unique ID I am getting the Adobe Form from a FTP location in the Form of XSTRING, now using the ABAP ADOBE PRINT FORM not using WebDynpro Application, I need to process this XSTRING and show up the Adobe Print Form.

OR

Is there a way to send the XSTRING to the Output Device or Printer to Display the PDF Form.

Friends please help me in solving this issue.

Thanks and Regards

Pradeep Goli

Edited by: Pradeep Goli on Mar 19, 2009 1:49 PM

Edited by: Pradeep Goli on Mar 19, 2009 2:51 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Pradeep Goli,

it is possible to show PDF in SAP GUI.

Michal

REPORT  ZTEST_DISPLAY_PDF.

* You must create dynpro 500 with custom control named HTML.
* In this custom control will be displayed PDF.

DATA: g_pdf              TYPE xstring,
      pdf_my_container   TYPE REF TO cl_gui_custom_container,
      pdf_html_control   TYPE REF TO cl_gui_html_viewer.

*****

START-OF-SELECTION.
PERFORM create_and_display.

*&---------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
FORM create_and_display.

*** Your code fo filling g_pdf

CALL SCREEN '500'.
ENDFORM.

* PDF preview in HTML control
module html_control output.
  perform pbo_html_control.
endmodule.

module html_control input.
  perform pai_html_control.
endmodule.

*&---------------------------------------------------------------------*
* PAI
*----------------------------------------------------------------------*
FORM pai_html_control.
  SET SCREEN '0'.
ENDFORM.

*&---------------------------------------------------------------------*
* Showing of PDF
*----------------------------------------------------------------------*
FORM pbo_html_control.
  DATA: l_pdf_alignment TYPE i,
        l_count         TYPE i,
        l_noprint       TYPE fpboolean,
        l_noarc         TYPE fpboolean,
        l_noprintarc    TYPE fpboolean.
*  CLEAR: fcode.
  SET PF-STATUS 'VIEW_PDF'.
* container
  IF pdf_my_container IS INITIAL.
    CREATE OBJECT pdf_my_container
      EXPORTING
        container_name = 'HTML'
      EXCEPTIONS
        OTHERS         = 1.
    IF sy-subrc <> 0.
      MESSAGE e150(FPRUNX).
      RETURN.
    ENDIF.
  ENDIF.
* html control
  IF pdf_html_control IS INITIAL.
    CREATE OBJECT pdf_html_control
      EXPORTING
        parent = pdf_my_container
      EXCEPTIONS
        OTHERS = 1.
    IF sy-subrc <> 0.
      MESSAGE e150(FPRUNX).
      RETURN.
    ENDIF.
*   alignment
    l_pdf_alignment = pdf_html_control->align_at_left  +
                    pdf_html_control->align_at_right +
                    pdf_html_control->align_at_top   +
                    pdf_html_control->align_at_bottom.
    CALL METHOD pdf_html_control->set_alignment
      EXPORTING
        alignment = l_pdf_alignment
      EXCEPTIONS
        OTHERS    = 1.
    IF sy-subrc <> 0.
      MESSAGE e150(FPRUNX).
      RETURN.
    ENDIF.
  ENDIF.
  PERFORM pdf_show USING g_pdf.
ENDFORM.

*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
FORM pdf_show USING p_pdf_data TYPE xstring.
  STATICS: ls_url           TYPE i.
  TYPES: lt_pdf_table(1000) TYPE x.
  DATA:  l_myurl(80)        TYPE c,
         l_url(80)          TYPE c,
         l_pdf_data         TYPE STANDARD TABLE OF lt_pdf_table,
         l_pdf_size         TYPE i,
         l_pdf_line         TYPE lt_pdf_table,
         l_offset           TYPE i,
         l_len              TYPE i.

  l_pdf_size = XSTRLEN( p_pdf_data ).
  l_len = l_pdf_size.
  WHILE l_len >= 1000.
    l_pdf_line = p_pdf_data+l_offset(1000).
    APPEND l_pdf_line TO l_pdf_data.
    ADD 1000 TO l_offset.
    SUBTRACT 1000 FROM l_len.
  ENDWHILE.
  IF l_len > 0.
    l_pdf_line = p_pdf_data+l_offset(l_len).
    APPEND l_pdf_line TO l_pdf_data.
  ENDIF.
  ADD 1 TO ls_url.
  l_myurl(8) = ls_url.
  CONCATENATE l_myurl '.pdf' INTO l_myurl.
  SHIFT l_myurl LEFT DELETING LEADING space.
  CALL METHOD pdf_html_control->load_data
    EXPORTING
      url          = l_myurl
      size         = l_pdf_size
      type         = 'application'                          "#EC NOTEXT
      subtype      = 'pdf'                                  "#EC NOTEXT
    IMPORTING
      assigned_url = l_url
    CHANGING
      data_table   = l_pdf_data
    EXCEPTIONS
      OTHERS       = 1.
  IF sy-subrc <> 0.
    MESSAGE e152(FPRUNX).
    RETURN.
  ENDIF.
* show data
  CALL METHOD pdf_html_control->show_data
    EXPORTING
      url    = l_url
    EXCEPTIONS
      OTHERS = 1.
  IF sy-subrc <> 0.
    MESSAGE e152(FPRUNX).
    RETURN.
  ENDIF.
ENDFORM.

Answers (0)