on 02-26-2010 9:45 AM
Dear experts,
I am trying to download a spool file to PDF, using program RSTXPDFT4 (that uses function CONVERT_OTFSPOOLJOB_2_PDF)
but my GREEK characters come out as junk.
There is no place to input the greek codepage 1704.
Have you ever have a similar problem, maybe with other languages?? please help.
Thank you in advance,
Roxani
please check this one.
REPORT ztest.
*
*PARAMETERS : spoolno LIKE tsp01-rqident,
p_email1 LIKE somlreci1-receiver
DEFAULT 'emailadd',
p_sender LIKE somlreci1-receiver
DEFAULT 'emailadd'.
*
*
*
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,
is_otf.
*DATA: client LIKE tst01-dclient,
name LIKE tst01-dname,
objtype LIKE rststype-type,
jobname LIKE tbtcjob-jobname,
jobcount LIKE tbtcjob-jobcount,
pdfspoolid LIKE tsp01-rqident,
type LIKE rststype-type.
*DATA: gd_subject LIKE sodocchgi1-obj_descr,
it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
gd_sender_type LIKE soextreci1-adr_typ,
gd_attachment_desc TYPE so_obj_nam,
gd_attachment_name TYPE so_obj_des.
Job Runtime Parameters
*DATA: gd_eventid LIKE tbtcm-eventid,
gd_eventparm LIKE tbtcm-eventparm,
gd_external_program_active LIKE tbtcm-xpgactive,
gd_jobcount LIKE tbtcm-jobcount,
gd_jobname LIKE tbtcm-jobname,
gd_stepcount LIKE tbtcm-stepcount,
gd_error TYPE sy-subrc,
gd_reciever TYPE sy-subrc.
**DATA DECLARATION
*DATA: gd_recsize TYPE i,
w_recsize TYPE i.
*
*
*DATA pdf LIKE tline OCCURS 100 WITH HEADER LINE.
*DATA doctab LIKE docs OCCURS 1 WITH HEADER LINE.
*DATA: numbytes TYPE i.
*
Binary store for PDF
*DATA: BEGIN OF it_pdf_output OCCURS 0.
INCLUDE STRUCTURE tline.
*DATA: END OF it_pdf_output.
*
*CONSTANTS: c_dev LIKE sy-sysid VALUE 'DEV',
c_no(1) TYPE c VALUE ' ',
c_device(4) TYPE c VALUE 'LOCL'.
*TABLES: tsp01.
*
*SELECT SINGLE * FROM tsp01 WHERE rqident = spoolno.
**
IF itcpp-tdspoolid NE 0.
CLEAR tab_ausgabe.
tab_ausgabe-name = t042z-text1.
tab_ausgabe-dataset = itcpp-tddataset.
tab_ausgabe-spoolnr = itcpp-tdspoolid.
COLLECT tab_ausgabe.
ENDIF.
*client = tsp01-rqclient.
*name = tsp01-rqo1name.
*CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
EXPORTING
authority = 'SP01'
client = client
name = name
part = 1
IMPORTING
CHARCO =
CREATER =
CREDATE =
DELDATE =
MAX_CREDATE =
MAX_DELDATE =
NON_UNIQ =
NOOF_PARTS =
RECTYP =
SIZE =
STOTYP =
type = type
objtype = objtype
EXCEPTIONS
fb_error = 1
fb_rsts_other = 2
no_object = 3
no_permission = 4.
*IF objtype(3) = 'OTF'.
is_otf = 'X'.
*ELSE.
is_otf = space.
*ENDIF.
*IF is_otf = 'X'.
*
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = spoolno
no_dialog = ' '
DST_DEVICE =
PDF_DESTINATION =
IMPORTING
pdf_bytecount = numbytes
pdf_spoolid = pdfspoolid
OTF_PAGECOUNT =
btc_jobname = jobname
btc_jobcount = jobcount
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.
CHECK sy-subrc = 0.
*
Transfer the 132-long strings to 255-long strings
LOOP AT pdf.
TRANSLATE pdf USING ' ~'.
CONCATENATE gd_buffer pdf INTO gd_buffer.
ENDLOOP.
*
*ENDIF.
TRANSLATE gd_buffer USING '~ '.
*
DO.
it_mess_att = gd_buffer.
APPEND it_mess_att.
SHIFT gd_buffer LEFT BY 255 PLACES.
IF gd_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
*
*CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = 'BIN'
FILENAME = 'C:\TEMP\TEST12.PDF'
FILETYPE = 'BIN'
APPEND = ' '
CODEPAGE = ' '
NO_BYTEORDER_MARK = ' '
IMPORTING
FILELENGTH = c
TABLES
DATA_TAB = PDF
FORMAT_TAB =
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6.
**filename = fullpath.
*
PERFORM process_email.
*
*&----
**& Form PROCESS_EMAIL
*&----
*form PROCESS_EMAIL .
*
DESCRIBE TABLE it_mess_att LINES gd_recsize.
CHECK gd_recsize > 0.
PERFORM send_email USING p_email1.
*
*
*
*endform. " PROCESS_EMAIL
*&----
**& Form SEND_EMAIL
*&----
*form SEND_EMAIL using p_email.
CHECK NOT ( p_email IS INITIAL ).
*
REFRESH it_mess_bod.
*
Default subject matter
gd_subject = 'Subject'.
gd_attachment_desc = 'Attachname'.
CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
it_mess_bod = 'Message Body text, line 1'.
APPEND it_mess_bod.
it_mess_bod = 'Message Body text, line 2...'.
APPEND it_mess_bod.
*
If no sender specified - default blank
IF p_sender EQ space.
gd_sender_type = space.
ELSE.
gd_sender_type = 'INT'.
ENDIF.
*
*
Send file by email as .xls speadsheet
PERFORM send_file_as_email_attachment
tables it_mess_bod
it_mess_att
using p_email
'Example .xls documnet attachment'
'PDF'
gd_attachment_name
gd_attachment_desc
p_sender
gd_sender_type
changing gd_error
gd_reciever.
*
*
*endform. " SEND_EMAIL
*&----
**& Form SEND_FILE_AS_EMAIL_ATTACHMENT
*&----
*form SEND_FILE_AS_EMAIL_ATTACHMENT tables it_message
it_attach
using p_email
p_mtitle
p_format
p_filename
p_attdescription
p_sender_address
p_sender_addres_type
changing p_error
p_reciever.
*
DATA: ld_error TYPE sy-subrc,
ld_reciever TYPE sy-subrc,
ld_mtitle LIKE sodocchgi1-obj_descr,
ld_email LIKE somlreci1-receiver,
ld_format TYPE so_obj_tp ,
ld_attdescription TYPE so_obj_nam ,
ld_attfilename TYPE so_obj_des ,
ld_sender_address LIKE soextreci1-receiver,
ld_sender_address_type LIKE soextreci1-adr_typ,
ld_receiver LIKE sy-subrc.
*
*data: t_packing_list like sopcklsti1 occurs 0 with header line,
t_contents like solisti1 occurs 0 with header line,
t_receivers like somlreci1 occurs 0 with header line,
t_attachment like solisti1 occurs 0 with header line,
t_object_header like solisti1 occurs 0 with header line,
w_cnt type i,
w_sent_all(1) type c,
w_doc_data like sodocchgi1.
*
*
ld_email = p_email.
ld_mtitle = p_mtitle.
ld_format = p_format.
ld_attdescription = p_attdescription.
ld_attfilename = p_filename.
ld_sender_address = p_sender_address.
ld_sender_address_type = p_sender_addres_type.
*
*
Fill the document data.
w_doc_data-doc_size = 1.
*
Populate the subject/generic message attributes
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle .
w_doc_data-sensitivty = 'F'.
*
Fill the document data and get size of attachment
CLEAR w_doc_data.
READ TABLE it_attach INDEX w_cnt.
w_doc_data-doc_size =
( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle.
w_doc_data-sensitivty = 'F'.
CLEAR t_attachment.
REFRESH t_attachment.
t_attachment[] = it_attach[].
*
Describe the body of the message
CLEAR t_packing_list.
REFRESH t_packing_list.
t_packing_list-transf_bin = space.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = 1.
DESCRIBE TABLE it_message LINES t_packing_list-body_num.
t_packing_list-doc_type = 'RAW'.
APPEND t_packing_list.
*
Create attachment notification
t_packing_list-transf_bin = 'X'.
t_packing_list-head_start = 1.
t_packing_list-head_num = 1.
t_packing_list-body_start = 1.
*
DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
t_packing_list-doc_type = ld_format.
t_packing_list-obj_descr = ld_attdescription.
t_packing_list-obj_name = ld_attfilename.
t_packing_list-doc_size = t_packing_list-body_num * 255.
APPEND t_packing_list.
*
Add the recipients email address
CLEAR t_receivers.
REFRESH t_receivers.
t_receivers-receiver = ld_email.
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
APPEND t_receivers.
*
*
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_data
put_in_outbox = 'X'
sender_address = ld_sender_address
sender_address_type = ld_sender_address_type
commit_work = 'X'
IMPORTING
sent_to_all = w_sent_all
TABLES
packing_list = t_packing_list
contents_bin = t_attachment
contents_txt = it_message
receivers = t_receivers
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
*
*
*
*endform. " SEND_FILE_AS_EMAIL_ATTACHMENT
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
My problem is the same, but with some Hungarian characters. (o and u with double acute accent ( ˝ ) - the longer counterparts of ö and ü.)
I tried to create a new SAP printer with a device type 'I2PDF' and 'PDF1' as well.
And then I tried to download a spool file to PDF using program RSTXPDFT4.
But it didn't work. Always an X were at place of hungarian umlaut characters
Our system codepage is 1401. SAP version ECC 6.0
Can you help me, what should I set in transaction SPAD?
Thanks
Gyula Olá
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you pass it using the device type, usually PDF1, I2PDF, etc. (check SPAD transaction)
Greek is I7PDF.
Edited by: Sandra Rossi on Feb 26, 2010 1:49 PM
Should be used when you generate the spool !
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.