04-23-2009 9:17 AM
Hello,
Iam working on SRM system which is UNICODE,I have tos end the mail with pdf attachment from SRM system ,but the problem is i have to get the data from R/3 System(in which iam using CONVERT_OTFSPOOLJOB_2_PDF to convert the spool request number to PDF data),If i use the same converted PDF data in SRM iam unable to open the PDF in mail.
My code in SRM is like this ::
If i use the below code iam getting the PDF but with some RAW data ::
is there anything more i have to add ????/
options-tddest = 'LP01'.
options-tdimmed = 'X'.
options-tdnewid = 'X'.
options-tdgetotf = 'X'.
options-tdnoprev = 'X'.
***
call function 'PRINT_TEXT'
exporting
dialog = ' '
header = header
options = options
importing
result = result
tables
lines = textlines
otfdata = otf
exceptions
canceled = 1
device = 2
form = 3
options = 4
unclosed = 5
unknown = 6
format = 7
textformat = 8
communication = 9
bad_pageformat_for_print = 10
others = 11.
IF sy-subrc 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
call function 'CONVERT_OTF'
exporting
format = 'PDF'
importing
bin_file = ev_count
bin_filesize = filesize
tables
otf = otf
lines = it_lines
exceptions
err_conv_not_possible = 1
err_bad_otf = 2.
04-23-2009 9:25 AM
pls check in this link.
https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/convertSmartformtoPDFformat
04-23-2009 9:31 AM
here is the sample code
CALL FUNCTION 'RSPO_OUTPUT_SPOOL_REQUEST'
EXPORTING
COPIES = 0
DEVICE = LP01
DIVISION = '*'
ENDPAGE = 0
PRIO = 0
RECEIVER = '*'
REQEST_TITLE = '*'
spool_request_id = ls_spool_id
STARTPAGE = 0
TELELAN = '*'
TELENUM = '*'
POSNAME =
ACTTIME =
TABLES
ATTRIBUTES =
EXCEPTIONS
ARCHIVE_DEST_INVALID = 1
ARCHIVE_DEST_NOT_FOUND = 2
ARCHIVE_DEST_NO_RIGHT = 3
CANNOT_ARCHIVE = 4
CHANGE_ARCHDEST_NO_RIGHT = 5
CHANGE_COPIES_NO_RIGHT = 6
CHANGE_DEST_NO_RIGHT = 7
CHANGE_DEVTYPE_NO_RIGHT = 8
CHANGE_PRIO_NO_RIGHT = 9
CHANGE_TELENUM_NO_RIGHT = 10
CHANGE_TITLE_NO_RIGHT = 11
DEST_INVALID = 12
DEST_NOT_FOUND = 13
DEST_NO_RIGHT = 14
INTERNAL_PROBLEM = 15
INVALID_FAX_ATTRIBUTE = 16
INVALID_PARAMETERS = 17
NON_OWNER_NO_RIGHT = 18
NO_LAYOUT = 19
NO_SPOOL_REQUEST = 20
OUT_AGAIN_NO_RIGHT = 21
SPOOLER_PROBLEM = 22
OTHERS = 23
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = g_spool
TABLES
pdf = 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.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'C:\DOCUMENTS AND SETTINGS\JANAGAR_S\DESKTOP\TEST.PDF'
filetype = 'BIN'
TABLES
data_tab = pdf
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
04-23-2009 9:33 AM
04-23-2009 10:05 AM
Iam getting data which gets converted at Non-unicode system,Hence iam getting the error that "Could not open the document,because it is either not a supported format or may be data gets damaged"
Iam opening the pdf in UNICODE system.