Advertisement
Guest User

Untitled

a guest
Oct 29th, 2019
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ABAP 3.69 KB | None | 0 0
  1. form zf_download_pdf  using    pt_smartform type zctsd_venda_comi_cab
  2.                                p_revend
  3.                                p_comissao
  4.                                p_filename.
  5.  
  6.   data: l_formname   type tdsfname value 'ZSFSD_VENDA_COMISS',
  7.         l_fm_name    type rs38l_fnam,
  8.         lw_ssfcompop type ssfcompop,
  9.         lw_control   type ssfctrlop,
  10.         l_devtype    type rspoptype,
  11.         l_job_output type ssfcrescl,
  12.         l_lines      type table of tline,
  13.         l_size       type i .
  14.  
  15.   call function 'SSF_FUNCTION_MODULE_NAME'
  16.     exporting
  17.       formname           = l_formname
  18.     importing
  19.       fm_name            = l_fm_name
  20.     exceptions
  21.       no_form            = 1
  22.       no_function_module = 2
  23.       others             = 3.
  24.   if sy-subrc <> 0.
  25.     message id sy-msgid type sy-msgty number sy-msgno
  26.             with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  27.   endif.
  28.  
  29.   call function 'SSF_GET_DEVICE_TYPE'
  30.     exporting
  31.       i_language             = sy-langu
  32.     importing
  33.       e_devtype              = l_devtype
  34.     exceptions
  35.       no_language            = 1
  36.       language_not_installed = 2
  37.       no_devtype_found       = 3
  38.       system_error           = 4
  39.       others                 = 5.
  40.  
  41.   lw_ssfcompop-tdprinter = l_devtype.
  42.   lw_control-no_dialog   = c_x.
  43.   lw_control-getotf      = c_x.
  44.  
  45.   call function l_fm_name
  46.     exporting
  47.       control_parameters = lw_control
  48.       output_options     = lw_ssfcompop
  49.       i_revend           = p_revend
  50.       i_comissao         = p_comissao
  51.     importing
  52.       job_output_info    = l_job_output
  53.     tables
  54.       it_venda_comi      = pt_smartform
  55.     exceptions
  56.       formatting_error   = 1
  57.       internal_error     = 2
  58.       send_error         = 3
  59.       user_canceled      = 4
  60.       others             = 5.
  61.   if sy-subrc <> 0.
  62.     message id sy-msgid type sy-msgty number sy-msgno
  63.             with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  64.   endif.
  65.  
  66.   call function 'CONVERT_OTF'
  67.     exporting
  68.       format                = 'PDF'
  69.     importing
  70.       bin_filesize          = l_size
  71.     tables
  72.       otf                   = l_job_output-otfdata
  73.       lines                 = l_lines
  74.     exceptions
  75.       err_max_linewidth     = 1
  76.       err_format            = 2
  77.       err_conv_not_possible = 3
  78.       err_bad_otf           = 4
  79.       others                = 5.
  80.   if sy-subrc <> 0.
  81.     message id sy-msgid type sy-msgty number sy-msgno
  82.             with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  83.   endif.
  84.  
  85.   call function 'GUI_DOWNLOAD'
  86.     exporting
  87.       bin_filesize            = l_size
  88.       filename                = p_filename
  89.       filetype                = 'BIN'
  90.     tables
  91.       data_tab                = l_lines
  92.     exceptions
  93.       file_write_error        = 1
  94.       no_batch                = 2
  95.       gui_refuse_filetransfer = 3
  96.       invalid_type            = 4
  97.       no_authority            = 5
  98.       unknown_error           = 6
  99.       header_not_allowed      = 7
  100.       separator_not_allowed   = 8
  101.       filesize_not_allowed    = 9
  102.       header_too_long         = 10
  103.       dp_error_create         = 11
  104.       dp_error_send           = 12
  105.       dp_error_write          = 13
  106.       unknown_dp_error        = 14
  107.       access_denied           = 15
  108.       dp_out_of_memory        = 16
  109.       disk_full               = 17
  110.       dp_timeout              = 18
  111.       file_not_found          = 19
  112.       dataprovider_exception  = 20
  113.       control_flush_error     = 21
  114.       others                  = 22.
  115.   if sy-subrc <> 0.
  116.     message id sy-msgid type sy-msgty number sy-msgno
  117.             with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  118.   endif.
  119.  
  120. endform.                    " ZF_DOWNLOAD_PDF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement