Skip to Content
0
Aug 04, 2020 at 07:52 PM

PDF file downloading without extension from a portal designed using Web Dynpro ABAP

659 Views

pdf-error-upld.pngHello Everyone,

A portal designed using WebDynpro ABAP where a screen displays Invoices in a table and a PDF button is present clicking which the Invoice copy gets downloaded in PDF format.

But now on clicking the PDF button, the Invoice is getting downloaded without file type or extension.

Surprisingly, the issue is only happening when I access the portal using Google Chrome but the same works fine while I use Internet Explorer.

Since the Invoice are without file type, so as I try to open it I get an error as "the file does not have an app associated with it for performing this action".

Can anyone suggest me what might be the issue here?

Method PDF.<br><br> CONSTANTS : gc_objtp TYPE toav0-sap_object VALUE 'VBRK'.   <br> <br> gv_id = i_vbeln.                            "Passing the Invoice number to the variable <br><br> CALL FUNCTION 'ARCHIV_GET_CONNECTIONS'
    EXPORTING
      objecttype    = gc_objtp
      object_id     = gv_id
      until_ar_date = sy-datum
    TABLES
      connections   = gt_connect
      parameter     = gt_param.

  DESCRIBE TABLE gt_connect LINES gv_line.
  READ TABLE gt_connect INTO gwa_connect INDEX gv_line.
  IF sy-subrc = 0.
    CALL FUNCTION 'ALINK_RFC_TABLE_GET'
      EXPORTING
        im_docid    = gwa_connect-arc_doc_id
        im_crepid   = gwa_connect-archiv_id
      IMPORTING
        ex_message  = gwa_message
      TABLES
        ex_document = gt_doc.
    IF sy-subrc = 0.
      DESCRIBE TABLE gt_doc LINES gv_size.
      gv_size = gv_size * sy-tleng.
*Convert to XString
      CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
        EXPORTING
          input_length = gv_size
        IMPORTING
          buffer       = gt_content
        TABLES
          binary_tab   = gt_doc.

      gv_mimetype = 'application/pdf'.
      gv_name = gv_id.
    CALL METHOD cl_wd_runtime_services=>attach_file_to_response
      EXPORTING
        i_filename  = gv_name
        i_content   = gt_content
        i_mime_type = gv_mimetype.
    ENDIF.
   ENDIF.
ENDMETHOD.

Attachments

pdf-error-upld.png (108.2 kB)