Code: Alles auswählen.
FORM pdf_datei.
DATA: lo_print TYPE REF TO cl_salv_print,
gw_pparams TYPE pri_params,
gw_valid,
lw_print_ctrl TYPE alv_s_pctl.
lo_print = o_salv->get_print( ).
PERFORM update_fcat.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
no_dialog = 'X'
destination = 'LOCL'
IMPORTING
valid = gw_valid
out_parameters = gw_pparams
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
CONCATENATE wa_strtab '_' sy-datum '_' sy-uzeit INTO gw_pparams-prtxt.
lw_print_ctrl = lo_print->get_print_control( ).
lw_print_ctrl-pri_params = gw_pparams.
lo_print->set_print_control( lw_print_ctrl ).
lo_print->set_print_only( 'N' ).
lo_print->SET_PRINT_PARAMETERS_ENABLED( space ).
o_salv->display( ).
DATA: lv_bin_length TYPE i.
DATA: lv_xstring_pdf TYPE xstring,
binary_content TYPE solix_tab,
lv_spoolid TYPE tsp01-rqident.
lv_spoolid = sy-spono.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = lv_spoolid
no_dialog = abap_true
pdf_destination = 'X' " xstring
get_size_from_format = abap_true
IMPORTING
pdf_bytecount = lv_bin_length
bin_file = lv_xstring_pdf
EXCEPTIONS
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
OTHERS = 12.
binary_content = cl_bcs_convert=>xstring_to_solix( lv_xstring_pdf ).
cl_gui_frontend_services=>gui_download( EXPORTING
filename = gv_pfad
filetype = 'BIN'
bin_filesize = lv_bin_length
CHANGING
data_tab = binary_content ).
ENDFORM.