Answers for "pdf download in abap"

SQL
0

ABAP Download PDF

Parameters:
  p_fname type z1127582_upload-filename lower case,
  p_path type string lower case.
Data:
      gs_store_file type z1127582_upload,
      xstr_content type xstring,
      gt_content type standard table of tdline,
      len type i,
      str_fname type string.
Start-of-selection.
  select single * from z1127582_upload
    into gs_store_file
    where filename = p_fname.
  xstr_content  = gs_store_file-file_content.
  "Convert xstring/rawstring to binary ITAB
  call function 'SCMS_XSTRING_TO_BINARY'
    exporting
      buffer        = xstr_content
    importing
      output_length = len
    tables
      binary_tab    = gt_content.
  .
  if sy-subrc <> 0.
    message 'Unable to convert xstring to binary'
      type 'E'.
  endif.
  str_fname = p_fname.
  call function 'GUI_DOWNLOAD'
    exporting
      bin_filesize            = len
      filename                = p_path
      filetype                = 'BIN'
    tables
      data_tab                = gt_content
    exceptions
      file_write_error        = 1
      no_batch                = 2
      gui_refuse_filetransfer = 3
      invalid_type            = 4
      no_authority            = 5
      unknown_error           = 6
      header_not_allowed      = 7
      separator_not_allowed   = 8
      filesize_not_allowed    = 9
      header_too_long         = 10
      dp_error_create         = 11
      dp_error_send           = 12
      dp_error_write          = 13
      unknown_dp_error        = 14
      access_denied           = 15
      dp_out_of_memory        = 16
      disk_full               = 17
      dp_timeout              = 18
      file_not_found          = 19
      dataprovider_exception  = 20
      control_flush_error     = 21
      others                  = 22.
  if sy-subrc <> 0.
    message 'Unable to download file from SAP'
      type 'E'.
Posted by: Guest on April-20-2021

Code answers related to "SQL"

Browse Popular Code Answers by Language