* Spool to PDF conversions
data: gd_spool_nr like tsp01-rqident,
gd_destination like rlgrap-filename,
gd_bytecount like tst01-dsize,
gd_buffer type string.


 data : it_pdf_output like tline occurs 0 with header line.
 data: numbytes type i,
pdfspoolid like tsp01-rqident,
it_mess_att like solisti1 occurs 0 with header line.


data:
     p_padest like  tsp03-padest.

p_padest = 'ZHP2'.
  call function 'CONVERT_OTFSPOOLJOB_2_PDF'
    exporting
      src_spoolid         = gd_spool_nr     "buraya spool numarasını yazıyoruz
      dst_device          = p_padest
    importing
      pdf_bytecount       = numbytes
      pdf_spoolid         = pdfspoolid
    tables
      pdf                 = it_pdf_output
    exceptions
      err_no_otf_spooljob = 1
      others              = 12.





*--- DOWNLOAD TO PC {bu form için kerem köseoğlu'na teşekkür ediyoruz }
  data:
      p_file like rlgrap-filename  .
  data cancel.
  p_file = 'C:\temp\file.pdf'.
  perform download_w_ext tables it_pdf_output
  using p_file
  '.pdf'
  'BIN'
  numbytes
  cancel.




FORM download_w_ext
 TABLES datatab
USING
filename LIKE rlgrap-filename
value(extension) TYPE c
mode TYPE c
bin_filesize TYPE i
cancel TYPE c.


DATA: name TYPE string,
path TYPE string,
fullpath TYPE string,
ext TYPE string,
filter TYPE string,
size TYPE i,
uact TYPE i.

IF mode <> 'ASC' AND mode <> 'BIN'.
sy-subrc = 1. EXIT.
ENDIF.
CLEAR cancel.
ext = extension.
IF ext(1) = '.'.
SHIFT ext.
ENDIF.
name = filename.
IF name IS INITIAL.
name = 'test.*'.
REPLACE '$' WITH ext INTO name.
ELSEIF name NA '.'. "name has no extension, add ext
CONCATENATE name '.' ext INTO name.
ENDIF.
filter = '(*.$)|*.$|'.
REPLACE '$' WITH ext INTO filter.
REPLACE '$' WITH ext INTO filter.

fullpath = name.

CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = bin_filesize
filename = fullpath
filetype = mode
TABLES
data_tab = datatab
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6.
filename = fullpath.
ENDFORM. "download_w_ext



*******************************************************
Konu ile ilgili detaylı içerik ve örnek ABAP Kodları,daha sonra eklenecektir.

SAP ve ABAP ile ilgili tüm sorularınızı
serkurumsal@yandex.com
E-Mail adresi ile bize ulaşarak sorabilirsiniz.

Serkan AKKAVAK
Bilgisayar Mühendisi