You are on page 1of 28

SCOT

Kurulum Admlar

Dr. Kerem Kseolu



7/6/2009

Contents
Kurulum ................................................................................................................................................... 3
Exchange / Relay Ayarlar ........................................................................................................................ 7
irket i E-Posta Senaryosu ................................................................................................................ 7
irket D E-Posta Senaryosu (Relay) .................................................................................................. 7
Exchange zerinde Dorudan Relay Ayar ...................................................................................... 8
Microsoft IIS zerinden Relay Ayarlar ............................................................................................ 8
Faydal pular ...................................................................................................................................... 14
rnek Kodlar ......................................................................................................................................... 14
E-Posta le Mesaj + Ek Gndermek ................................................................................................... 14
E-Posta le Mesaj + Ek Gndermek (<BR> le Satr Krarak) ............................................................... 18
E-Posta le SAP Ekranna Link Gndermek ........................................................................................ 22
Bir SmartForm ktsn PDF Olarak E-Mail le Gndermek ............................................................... 24
rnek SAP Programlar .................................................................................................................. 24
CONVERT_OTF Fonksiyonunu Kullanmak ..................................................................................... 24
Hatalar ve zmler .............................................................................................................................. 28
Internal error: SO_OBJECT_MIME_GET Exception: 2 ........................................................................ 28
PDF Trke Karakter Problemi .......................................................................................................... 28
Works Cited ........................................................................................................................................... 28

Kurulum
SCOT ayarlar, detayl bir ekilde 455140 numaral OSS notunda aklanmtr. Burada, basit bir
konfigrasyonun nasl yaplacan greceiz.
SCOT ilem koduna gidiyoruz.


Settings Send Jobs mensne giriyoruz. Burada, E-Posta gndermekten sorumlu RSCONN01
programn kuracaz. Ayn ilemi SE38 ierisinde RSCONN01i arka planda kurarak da
gerekletirebiliriz.


Settings Confirmation Of Receipt mensnde, E-Posta iletileri iin Gnderildi bilgisinin
istenmediini belirteceiz. Eer Gnderildi bilgisini istiyorsanz, yukarda belirtilen OSS notunu
inceleyin.


Settings Default Domain mensnde, irkete ait varsaylan alan adn gireceiz.Buraya
cozumevi.com yazacak olursak; SAP, SMTP sunucusuna balanldnda ilk olarak HELO
cozumevi.com komutunu gnderecektir.


Ayarlar tamamladmza gre, artk E-Posta ilevini aktive edebiliriz. View System Status
blmne girip, INT SMTPye ift tklyoruz. Alacak pencere, rnek olarak u ekilde konfigre
edilmi olmaldr:

Node In Use
Bu tk, ilemin aktif olduunu gstermektedir.

Mail Host & Port


Kullanlacak SMTP sunucusunun adresi ve portu buraya girilecektir. SMTP sunucusuyla ilgili
Relay ayarlar iin ltfen Exchange / Relay Ayarlar blmne bakn.

Code Page
Bu blmde, SAPde geerli Code Page deerini girin. Trke iin ISO-8859-9 veya Windows-
1254 kullanlabilir.
Bu bilgileri girdikten sonra, Internet seeneinin yanndaki SET dmesine tklyoruz.


Bu penceredeki Address area blm, hangi Domainlere ait E-Postalarn gnderilebileceini
belirtmektedir. Sade bir kurulumda, buraya * yazlmas gerekir.

Exchange / Relay Ayarlar


irket i E-Posta Senaryosu

SAP SCOT
(Authenvcavon
gndermiyor)

Exchange
(Authenvcavon'a
bakmyor)


Eer E-Posta iletileri sadece irketteki E-Posta adresleri arasnda gnderilecekse, Exchangein
varsaylan ayarlar herhangi bir Relay ayarlamas yapmadan bu ileme izin verecektir. Bu durumda,
Kurulum balndaki Mail Host & Port blmne dorudan doruya Exchange sunucusunun adresi
girilebilir. Baka bir ayara gerek yoktur.

irket D E-Posta Senaryosu (Relay)


SAPnin E-Posta gnderme mekanizmas, SMTP Authentication desteklememektedir1. Exchange
sunucular ise, (varsaylan ayarlarnda) Relay (irket d E-Posta) gnderimi sz konusu olduunda
mutlaka SMTP Authentication istemektedir. Bu yzden; ya Exchange sunucusu zerinde SAPden
gelen iletilerde Authentication istemeyecei ekilde bir ayar yaplmaldr, ya da araya SMTP
Authentication yapabilecek bir IIS SMTP servisi kurulmaldr.
Bu Relay alternatiflerini ve kurulum detaylarn aada bulabilirsiniz.

Detaylar iin OSSe girip 782611 numaral nota bakabilirsiniz.

Exchange zerinde Dorudan Relay Ayar

SAP SCOT
(Authenvcavon
gndermiyor)

Exchange
(Authenvcavon'a
bakmyor)


Eer mterinin kendi Exchange sunucusu varsa, Kurulum balndaki Mail Host & Port blmne
dorudan doruya Exchange sunucusunun adresini girebilirsiniz. Exchangei ise, SAPden gelecek olan
Relay iletilerinde Authentication istemeyecei ekilde ayarlamalsnz. Bu ayari yle yaplmaktadr:
Exchange System Manager altindan Server`imiza ulasiyoruz. Bunun altindaki protocols bolumunden
smtp detayina giriyoruz. Default Smtp Virtual Server properties icinde access menu altinda relay
restrictions bolumune girerek SAP server ip adresini bu listeye ekliyoruz (only the list below secenegi
checkli olacak sekilde).
Microsoft IIS zerinden Relay Ayarlar

SAP SCOT
(Authenvcavon
gndermiyor)

IIS SMTP
(Authenvcavon
ekliyor)

Exchange
(Authenvcavon'a
bakyor)

Dardan Hosting hizmeti ald iin Exchange ayarlarna dorudan mdahele ans olmayan bir firma,
irketin a zerindeki bir Windows 2003 makinasna SMTP servisi kurulabilir. SAP, E-Posta iletilerini
bu servise gnderir, servis ise irketin dardaki gerek SMTP sunucusuna (Authentication yaparak)
Relay eder. Kurulum balndaki Mail Host & Port blmne Exchangein adresini deil, aradaki IIS
makinasnn adresi girilmelidir. IIS ayarlarn aada bulabilirsiniz.
Herhangi bir bilgisayara IIS kurulur. Bu makina, srekli ak kalabilecek bir makina olmaldr. Sz
konusu makina kapanacak olursa E-Posta kayb olmaz, ancak gnderimler kesintiye urar. Kurulum
srasnda SMTP servisi Seilmelidir.


-start-settings-control panel-Administrative Tools-IIS ift tklanr.
iis ynetim konsoluna gelip Default SMTP Virtual Server altnda bulunan Domains zerine gelip
sa tkladktan sonra New domain seenei tklanr


Remote Seeneini Seip Next ile ilerleyiniz


Burada hangi uzantl adreslere mail gnderilecek ise*.com , *.org. , *.net vb.
ayr ayr girilmelidir.


Eklediimiz domain zerinde sa tu zellikler sekmesine geliyoruz
General sekmesinde select incoming mail to be relayed for your remote domain seeneini
seiyoruz
forward all mail tos mart host alanna asl domain ismimizi yazyoruz(rnek : limak.com.tr)


Outbound security butonuna basp, Basic authentication seeneini seiyoruz. user name= gerek
domainimizde bulunan bir mail adresi girilir. ok.

Daha sonra, SMTP virtual Server zerinde satu zelliklere gidip ip adresi alanna relay ilemi iin
kurduumuz smtp servisinin bulunduu bilgisayarn ip si girilir.


Relay butonu tklanr


add butonu tklanr ve domain name alanna = gerek domain adresi girilir(rnek:limak.com.tr)



Ok diyerek ilem tamamlanr
Sonu : yaptmz bu ayarlar sonucunda Sap den mail gnderildii zaman mail,ilk olarak
smtp servisini kurduumuz makinaya gelecek servis kendisine gelen maili gerek mail servera Relay
edecektir.

Faydal pular
Srada bekleyen / gnderilemeyen E-Posta iletileri, SOST ilem kodunda izlenebilir. Ayn yerde,
gnderilemeyen iletiler tekrar gnderilebilir.

rnek Kodlar
E-Posta le Mesaj + Ek Gndermek
function zaswf_send_msg_as_email.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(I_BNAME) TYPE XUBNAME
*" REFERENCE(I_MSGID) TYPE SY-MSGID
*" REFERENCE(I_MSGNO) TYPE SY-MSGNO
*" REFERENCE(I_MSGV1) OPTIONAL
*" REFERENCE(I_MSGV2) OPTIONAL
*" REFERENCE(I_MSGV3) OPTIONAL

*" REFERENCE(I_MSGV4) OPTIONAL


*" REFERENCE(I_MESAP) TYPE ZASWF_MESAP OPTIONAL
*" REFERENCE(I_MEMAI) TYPE ZASWF_MEMAI OPTIONAL
*" REFERENCE(I_ATTYP) TYPE SOODK-OBJTP OPTIONAL
*" REFERENCE(I_ATSUB) TYPE SOOD-OBJDES OPTIONAL
*" REFERENCE(I_ATTXT) TYPE SOLI_TAB OPTIONAL
*"----------------------------------------------------------------------

data:
lt_cont type standard table of solisti1 with header line,
lt_rece type standard table of somlreci1 with header line,
lf_docdat type sodocchgi1,

begin of lf_split,
len type i,
pos1 type i,
pos2 type i,
plen type i,
con(1),
end of lf_split,

lv_class type dokhl-object,
lv_msgnr type char3,
lv_langu type char1,
lv_text type string.

data:
lo_email type ref to cl_bcs,
lo_docum type ref to cl_document_bcs,
lo_sende type ref to cl_sapuser_bcs,
lo_recip type ref to if_recipient_bcs,

lt_attx type soli_tab,
lt_text type soli_tab with header line,
lv_subj type so_obj_des,

lv_atsiz type sood-objlen,
lv_statu type bcs_stml,
lv_rstat type bcs_rqst,
lv_saddr type adr6-smtp_addr,
lv_uname type uname.

refresh:
lt_cont,
lt_rece.

lf_docdat-obj_name = 'SAPOFFICE'.

call function 'MESSAGE_TEXT_BUILD'
exporting
msgid = i_msgid
msgnr = i_msgno
msgv1 = i_msgv1
msgv2 = i_msgv2
msgv3 = i_msgv3
msgv4 = i_msgv4
importing
message_text_output = lf_docdat-obj_descr.

lv_class = i_msgid.
lv_msgnr = i_msgno.
lv_langu = sy-langu.

call function 'SVMCRT_INT_GETMSG_LONGTEXT'
exporting
msg_class = lv_class
msg_nr = lv_msgnr
language = lv_langu
importing
text = lv_text.

replace all occurrences of:
'&V1&' in lv_text with i_msgv1,
'&V2&' in lv_text with i_msgv2,
'&V3&' in lv_text with i_msgv3,
'&V4&' in lv_text with i_msgv4.

clear lf_split.
lf_split-con = 'X'.
lf_split-len = strlen( lv_text ).
do.
lf_split-pos1 = lf_split-pos2.
add 255 to lf_split-pos2.
if lf_split-pos2 gt lf_split-len.
lf_split-pos2 = lf_split-len.
clear lf_split-con.
endif.

lf_split-plen = lf_split-pos2 - lf_split-pos1.
lt_cont-line = lv_text+lf_split-pos1(lf_split-plen).
append lt_cont.

if lf_split-con is initial.
exit.
endif.
enddo.

if i_memai eq 'X'.
clear lt_rece.

select single smtp_addr into lt_rece-receiver
from adr6
where addrnumber eq ( select addrnumber from usr21
where bname eq i_bname )
and persnumber eq ( select persnumber from usr21
where bname eq i_bname ).
lt_rece-rec_type = 'U'.

if not lt_rece-receiver is initial.
append lt_rece.
endif.
endif.

if i_mesap eq 'X'.
clear lt_rece.

lt_rece-receiver = i_bname.
lt_rece-rec_type = 'B'.

lt_rece-express = 'X'.
append lt_rece.
endif.

check not lt_rece[] is initial.

* Send mail
lo_email = cl_bcs=>create_persistent( ).

call function 'SO_RAW_TO_RTF'
tables
objcont_old = lt_cont
objcont_new = lt_text.

lv_subj = lf_docdat-obj_descr.
lo_docum = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = lt_text[]
i_subject = lv_subj ).

if not i_attxt[] is initial.
call function 'SO_RAW_TO_RTF'
tables
objcont_old = i_attxt
objcont_new = lt_attx.

call method lo_docum->add_attachment
exporting
i_attachment_type = i_attyp
i_attachment_subject = i_atsub
i_att_content_text = lt_attx[].
endif.

call method lo_email->set_document( lo_docum ).
lo_sende = cl_sapuser_bcs=>create( sy-uname ).

call method lo_email->set_sender
exporting
i_sender = lo_sende.

loop at lt_rece.

case lt_rece-rec_type.
when 'U'.
lv_saddr = lt_rece-receiver.

translate lv_saddr to lower case.
lo_recip = cl_cam_address_bcs=>create_internet_address(
lv_saddr ).
when 'B'.
lv_uname = lt_rece-receiver.
lo_recip = cl_sapuser_bcs=>create( lv_uname ).
endcase.


call method lo_email->add_recipient
exporting
i_recipient = lo_recip
i_express = 'X'

i_copy = ' '


i_blind_copy = ' '
i_no_forward = ' '.
endloop.

move 'N' to lv_rstat.
lv_statu = lv_rstat.

call method lo_email->set_status_attributes
exporting
i_requested_status = lv_rstat
i_status_mail = lv_statu.

call method lo_email->send( ).

commit work and wait.


endfunction.

E-Posta le Mesaj + Ek Gndermek (<BR> le Satr Krarak)


FUNCTION zsp_dms_sendmail.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(I_EMAIL) TYPE AD_SMTPADR
*" REFERENCE(I_MSGID) TYPE SY-MSGID
*" REFERENCE(I_MSGNO) TYPE SY-MSGNO
*" REFERENCE(I_MSGV1) OPTIONAL
*" REFERENCE(I_MSGV2) OPTIONAL
*" REFERENCE(I_MSGV3) OPTIONAL
*" REFERENCE(I_MSGV4) OPTIONAL
*" REFERENCE(I_ATTYP) TYPE SOODK-OBJTP OPTIONAL
*" REFERENCE(I_ATSUB) TYPE SOOD-OBJDES OPTIONAL
*" REFERENCE(I_ATTXT) TYPE SOLI_TAB OPTIONAL
*" REFERENCE(I_ATTY2) TYPE SOODK-OBJTP OPTIONAL
*" REFERENCE(I_ATSU2) TYPE SOOD-OBJDES OPTIONAL
*" REFERENCE(I_ATTX2) TYPE SOLI_TAB OPTIONAL
*"----------------------------------------------------------------------

DATA:
lt_cont TYPE STANDARD TABLE OF solisti1 WITH HEADER LINE,
lt_rece TYPE STANDARD TABLE OF somlreci1 WITH HEADER LINE,
lf_docdat TYPE sodocchgi1,

BEGIN OF lf_split,
len TYPE i,
pos1 TYPE i,
pos2 TYPE i,
plen TYPE i,
con(1),
spc(1),
END OF lf_split,

lv_class TYPE dokhl-object,


lv_msgnr TYPE char3,
lv_langu TYPE char1,
lv_text TYPE string.

DATA:
lo_email TYPE REF TO cl_bcs,
lo_docum TYPE REF TO cl_document_bcs,
lo_sende TYPE REF TO cl_sapuser_bcs,
lo_recip TYPE REF TO if_recipient_bcs,

lt_attx TYPE soli_tab,
lt_text TYPE soli_tab WITH HEADER LINE,
lv_subj TYPE so_obj_des,

lv_atsiz TYPE sood-objlen,
lv_statu TYPE bcs_stml,
lv_rstat TYPE bcs_rqst,
lv_saddr TYPE adr6-smtp_addr,
lv_uname TYPE uname.

REFRESH:
lt_cont,
lt_rece.

lf_docdat-obj_name = 'SAPOFFICE'.

CALL FUNCTION 'MESSAGE_TEXT_BUILD'
EXPORTING
msgid = i_msgid
msgnr = i_msgno
msgv1 = i_msgv1
msgv2 = i_msgv2
msgv3 = i_msgv3
msgv4 = i_msgv4
IMPORTING
message_text_output = lf_docdat-obj_descr.

lv_class = i_msgid.
lv_msgnr = i_msgno.
lv_langu = sy-langu.

CALL FUNCTION 'SVMCRT_INT_GETMSG_LONGTEXT'
EXPORTING
msg_class = lv_class
msg_nr = lv_msgnr
language = lv_langu
IMPORTING
text = lv_text.

REPLACE ALL OCCURRENCES OF:
'&V1&' IN lv_text WITH i_msgv1,

'&V2&' IN lv_text WITH i_msgv2,


'&V3&' IN lv_text WITH i_msgv3,
'&V4&' IN lv_text WITH i_msgv4,
'<BR>' IN lv_text WITH cl_abap_char_utilities=>newline,
'<br>' IN lv_text WITH cl_abap_char_utilities=>newline,
'<Br>' IN lv_text WITH cl_abap_char_utilities=>newline,
'<bR>' IN lv_text WITH cl_abap_char_utilities=>newline.

CLEAR lf_split.
lf_split-len = STRLEN( lv_text ).
DO.
IF lf_split-pos1 GE lf_split-len.
IF NOT lt_cont-line IS INITIAL.
APPEND lt_cont.
ENDIF.

EXIT.
ENDIF.

lf_split-con = lv_text+lf_split-pos1(1).

IF lf_split-con EQ cl_abap_char_utilities=>newline.
APPEND lt_cont.
CLEAR lt_cont.
ELSE.
if lf_split-con is initial.
lf_split-spc = 'X'.
else.
if lf_split-spc is initial.
CONCATENATE lt_cont-line lf_split-con INTO lt_cont-line.
else.
CONCATENATE lt_cont-line ` ` lf_split-con INTO lt_cont-line.
endif.

clear lf_Split-spc.
endif.
ENDIF.

ADD 1 TO lf_split-pos1.
ENDDO.

CLEAR lt_rece.

lt_rece-receiver = i_email.
lt_rece-rec_type = 'U'.

IF NOT lt_rece-receiver IS INITIAL.
APPEND lt_rece.
ENDIF.

CHECK NOT lt_rece[] IS INITIAL.

* Send mail
lo_email = cl_bcs=>create_persistent( ).

lv_subj = lf_docdat-obj_descr.
lo_docum = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = lt_CONT[]
i_subject = lv_subj ).

IF NOT i_attxt[] IS INITIAL.
REFRESH lt_attx.

CALL FUNCTION 'SO_RAW_TO_RTF'
TABLES
objcont_old = i_attxt
objcont_new = lt_attx.

CALL METHOD lo_docum->add_attachment
EXPORTING
i_attachment_type = i_attyp
i_attachment_subject = i_atsub
i_att_content_text = lt_attx[].
ENDIF.

IF NOT i_attx2[] IS INITIAL.
REFRESH lt_attx.

CALL FUNCTION 'SO_RAW_TO_RTF'
TABLES
objcont_old = i_attx2
objcont_new = lt_attx.

CALL METHOD lo_docum->add_attachment
EXPORTING
i_attachment_type = i_atty2
i_attachment_subject = i_atsu2
i_att_content_text = lt_attx[].
ENDIF.

CALL METHOD lo_email->set_document( lo_docum ).
lo_sende = cl_sapuser_bcs=>create( sy-uname ).

CALL METHOD lo_email->set_sender
EXPORTING
i_sender = lo_sende.

LOOP AT lt_rece.

CASE lt_rece-rec_type.
WHEN 'U'.
lv_saddr = lt_rece-receiver.

TRANSLATE lv_saddr TO LOWER CASE.


lo_recip = cl_cam_address_bcs=>create_internet_address(
lv_saddr ).
WHEN 'B'.
lv_uname = lt_rece-receiver.
lo_recip = cl_sapuser_bcs=>create( lv_uname ).
ENDCASE.


CALL METHOD lo_email->add_recipient
EXPORTING
i_recipient = lo_recip
i_express = 'X'
i_copy = ' '
i_blind_copy = ' '
i_no_forward = ' '.
ENDLOOP.

MOVE 'N' TO lv_rstat.
lv_statu = lv_rstat.

CALL METHOD lo_email->set_status_attributes
EXPORTING
i_requested_status = lv_rstat
i_status_mail = lv_statu.

CALL METHOD lo_email->send( ).

COMMIT WORK AND WAIT.


ENDFUNCTION.

E-Posta le SAP Ekranna Link Gndermek


function zaswf_send_link_as_email.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(I_BNAME) TYPE XUBNAME
*" REFERENCE(I_MSGID) TYPE SY-MSGID
*" REFERENCE(I_MSGNO) TYPE SY-MSGNO
*" REFERENCE(I_MSGV1) OPTIONAL
*" REFERENCE(I_MSGV2) OPTIONAL
*" REFERENCE(I_MSGV3) OPTIONAL
*" REFERENCE(I_MSGV4) OPTIONAL
*" REFERENCE(I_MESAP) TYPE ZASWF_MESAP OPTIONAL
*" REFERENCE(I_MEMAI) TYPE ZASWF_MEMAI OPTIONAL
*" REFERENCE(I_CMD) TYPE CHAR200
*"----------------------------------------------------------------------

data:
lt_text type soli_tab with header line.


define apptxt2.
concatenate
&1
'='
&2
into lt_text-line.

append lt_text.
end-of-definition.

define apptxt.
lt_text-line = &1.
append lt_text.
end-of-definition.

* rnek bir I_CMD u formatta olabilir:
* *ZCZMAS003 S_EBELN-LOW=6100000017;

* CMD' formatlayalm
apptxt '[System]'.
apptxt2:
'Name' sy-sysid,
'Description' space,
'Client' sy-mandt.

apptxt '[User]'.
apptxt2:
'Name' i_bname,
'Language' sy-langu.

apptxt '[Function]'.
apptxt2:
'Title=' space,
'Command' i_cmd,
'Type' 'Transaction'.

apptxt '[Configuration]'.
apptxt2:
'GuiSize' 'Normal window'.

* letiyi gnderelim
call function 'ZASWF_SEND_MSG_AS_EMAIL'
exporting
i_bname = i_bname
i_msgid = i_msgid
i_msgno = i_msgno
i_msgv1 = i_msgv1
i_msgv2 = i_msgv2
i_msgv3 = i_msgv3
i_msgv4 = i_msgv4
i_mesap = i_mesap

i_memai = i_memai
i_attyp = 'SAP'
i_atsub = 'EXECUTE'
i_attxt = lt_text[].

endfunction.

Bir SmartForm ktsn PDF Olarak E-Mail le Gndermek


rnek SAP Programlar
RSTXPDFT2 ve BCS_EXAMPLE_8 programlar, bu konuda kullanlabilecek hazr kodlar iermektedir.
CONVERT_OTF Fonksiyonunu Kullanmak
*&---------------------------------------------------------------------*
*& Form send_mail
*&---------------------------------------------------------------------*
FORM send_mail .

DATA: lt_solix TYPE STANDARD TABLE OF solix WITH HEADER LINE,
lt_objcont TYPE STANDARD TABLE OF soli WITH HEADER LINE,
lt_objhead TYPE STANDARD TABLE OF soli WITH HEADER LINE,
lt_receivers TYPE STANDARD TABLE OF soos1 WITH HEADER LINE,
lt_lines TYPE STANDARD TABLE OF tline WITH HEADER LINE,

ls_control TYPE ssfctrlop,
ls_job TYPE ssfcrescl,
ls_object_hd_change TYPE sood1,
ls_soli TYPE soli,
ls_addr TYPE szadr_addr1_complete,
ls_smtp TYPE szadr_adsmtp_line,

l_document_type TYPE soodk-objtp,
l_originator TYPE soos1-recextnam,
l_size TYPE i,
l_bin_file TYPE xstring,
l_i TYPE i,
l_n TYPE i.

FIELD-SYMBOLS: <ptr_hex> TYPE solix.

*&------------------------------
*& OTF DATA
*&------------------------------

* Get OTF data
ls_control-no_dialog = 'X'.
ls_control-preview = space.
ls_control-getotf = 'X'.

CALL FUNCTION w_fnam
EXPORTING
control_parameters = ls_control

* OUTPUT_OPTIONS =
* USER_SETTINGS = 'X'
i_vbeln_va = w_vbeln_va
i_vbeln_vl = p_vbeln
i_vbeln_vf = w_vbeln_vf
i_kunnr = w_kunnr
i_name1 = w_name1
IMPORTING
job_output_info = ls_job
TABLES
i_pack = wt_pack
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
LEAVE LIST-PROCESSING.
ENDIF.

* Convert OTF to regular lines
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
* ARCHIVE_INDEX = ' '
* COPYNUMBER = 0
* ASCII_BIDI_VIS2LOG = ' '
* PDF_DELETE_OTFTAB = ' '
IMPORTING
bin_filesize = l_size
bin_file = l_bin_file
TABLES
otf = ls_job-otfdata
lines = lt_lines
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
err_bad_otf = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid type 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
LEAVE LIST-PROCESSING.
ENDIF.

*&------------------------------
*& E-MAIL PARAMETERS

*&------------------------------

* OTF Lines -> Internal table
l_n = XSTRLEN( l_bin_file ).
WHILE l_i < l_n.
CLEAR lt_solix.
lt_solix-line = l_bin_file+l_i.
APPEND lt_solix.
ADD 255 TO l_i.
ENDWHILE.

LOOP AT lt_solix.
CLEAR ls_soli.
ASSIGN ls_soli TO <ptr_hex> CASTING.
MOVE lt_solix TO <ptr_hex>.
APPEND ls_soli TO lt_objcont.
ENDLOOP.

* Header information
ls_object_hd_change-objnam = 'EMAIL'.
MESSAGE s023(ztr) WITH p_vbeln INTO ls_object_hd_change-objdes. " Subject
ls_object_hd_change-objla = sy-langu.
ls_object_hd_change-objsns = 'O'.
ls_object_hd_change-objlen = l_size.
ls_object_hd_change-file_ext = 'PDF'.

* Receiver
CALL FUNCTION 'ADDR_GET_COMPLETE'
EXPORTING
addrnumber = w_adrnr
IMPORTING
addr1_complete = ls_addr
EXCEPTIONS
parameter_error = 1
address_not_exist = 2
internal_error = 3
wrong_access_to_archive = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
LEAVE LIST-PROCESSING.
ENDIF.

LOOP AT ls_addr-adsmtp_tab INTO ls_smtp WHERE date_from LE sy-datum.
CLEAR lt_receivers.
lt_receivers-recextnam = ls_smtp-adsmtp-SMTP_ADDR.
lt_receivers-recesc = 'E'.
lt_receivers-sndart = 'INT'.
APPEND lt_receivers.
ENDLOOP.

IF lt_receivers[] IS INITIAL.
MESSAGE s024(ztr).
LEAVE LIST-PROCESSING.
ENDIF.

* Document type & originator
l_document_type = 'EXT'.
l_originator = sy-uname.

*&------------------------------
*& SEND MAIL
*&------------------------------

CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
object_hd_change = ls_object_hd_change
object_type = l_document_type
originator = l_originator
originator_type = 'B'
* importing
* sent_to_all = x_sent_to_all
TABLES
objcont = lt_objcont
objhead = lt_objhead
receivers = lt_receivers
EXCEPTIONS
active_user_not_exist = 1
communication_failure = 2
component_not_available = 3
folder_not_exist = 4
folder_no_authorization = 5
forwarder_not_exist = 6
note_not_exist = 7
object_not_exist = 8
object_not_sent = 9
object_no_authorization = 10
object_type_not_exist = 11
operation_no_authorization = 12
owner_not_exist = 13
parameter_error = 14
substitute_not_active = 15
substitute_not_defined = 16
system_failure = 17
too_much_receivers = 18
user_not_exist = 19
x_error = 20
OTHERS = 21.

IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
LEAVE LIST-PROCESSING.

ENDIF.

ENDFORM. " send_mail

Hatalar ve zmler
Internal error: SO_OBJECT_MIME_GET Exception: 2
SOST ilem kodunda grlebilecek bu hatann sebebi byk ihtimalle SCOT penceresinde Default
Domain veya Default Codepage deerlerinin atanmamasdr.

PDF Trke Karakter Problemi


Eer stteki yntem ile oluturup E-Posta ile gnderdiiniz PDF dosyalarnda Trke karakterler
dzgn grntlenemiyorsa, ktdaki Fontlar deitirmeyi deneyin. Yaplan bir denemede, Courier
yerine Helvetica fontu kullanldnda, yaanan Trke karakter probleminin ortadan kalkt
gzlemlenmitir.

Works Cited
SAP AG. (2007, 04 27). Note 625818 - PDF conversion: Turkish support (ISO 8859-9). 12 24, 2009
tarihinde SAP OSS: https://websmp230.sap-
ag.de/sap/bc/bsp/spn/sapnotes/index2.htm?numm=625818 adresinden alnd

You might also like