Hi Pedro.
I'm developer .NET and I was with similar problem.
I needed from a WS to generate PDF file to use in a Website.
We can't use GUI_DOWNLAOD, because this function must be called from GUI Interface Application.
But, you can export XSTRING (byte[] in C#, Java...) to convert it in other extension (ZIP, PDF etc) in you destination application.
My solution for this:
" Chama o converter de OTF
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = i_spoolno
no_dialog = ' '
* DST_DEVICE =
pdf_destination = 'X'
IMPORTING
pdf_bytecount = numbytes
pdf_spoolid = pdfspoolid
* OTF_PAGECOUNT =
btc_jobname = jobname
btc_jobcount = jobcount
bin_file = lv_bin_file
TABLES
pdf = pdf
EXCEPTIONS
err_no_otf_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_dstdevice = 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.
" Gera o array de bytes ** Generates byte[].
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = lv_bin_file
TABLES
binary_tab = pdf.
" Variavel export do tipo XSTRING ** Variable XSTRING
e_binario = lv_bin_file.
I hope this has helped you.