Send smartform as html email
Hello all,
I've been searching SDN for help with creating an email in html format via smartforms. Pavan Bayyapu's blog was really helpful and I've also used program SF_XSF_DEMO_MAIL as the basis for my program. I followed their examples exactly but my emails always appear as a .MTL attachment, never as just the body of the email.
I tried removing the file name from lo_mime_helper->set_main_html and from lo_mime_helper->add_binary_part as suggested by some other folks but I haven't had any success.
Has anyone solved this same issue? Maximum points will be given to helpful suggestions.
Thank you.
(This message also posted on the ABAP forum)
hi
In print program of smart form use this function module.
WWW_LIST_TO_HTML
Thanks,
Usha
Similar Messages
-
Can you send out a html email from Out Look? Meaning I've
created a html page and would like to send it out as a html email
to my clients. I'm using Out Look and I'm on a PC. I would love to
be able to do this today? Any feed back would be great!sa_designer wrote:
> Can you send out a html email from Out Look? Meaning
I've created a html page
> and would like to send it out as a html email to my
clients. I'm using Out Look
> and I'm on a PC. I would love to be able to do this
today? Any feed back would
> be great!
>
Not sure how relevant this still is, its been around for some
time.
http://www.dwfaq.com/Tutorials/Miscellaneous/htmlemail.asp -
How to send smartform output through email
Hi,
I want to send smartform output through email.....
can u give me sample program to send it through email......
Regards,
Jenifer
MOderator Message: Basic and Frequently asked question. Please search before posting.
Edited by: kishan P on Nov 26, 2010 11:11 AMHi Jenifer,
There are many threads available on SDN.
Just have a look at this thread
<<link removed by moderator>>
Kindly search before you post.
Regard
Abhii
Moderator Message: You have been warned many times against point-hunting. Continuing ignoring of the Moderator warnings will lead to account deletion. Consider this your last warning
Edited by: kishan P on Nov 26, 2010 11:09 AM -
To send smartform output through email and fax
Hi,
I need to send smartform output through email if the email address is present else if the email address is present then it has to be sent through fax.If both the email address and fax are present,then it has to send an email.
Now the issue is I am able to send the email and I am getting the message as 'Output was successfully issued'.But the entry corresponding to this is not shown in SOST transaction.
Can anyone tell me what would be the reason for this?HI,
Try to look in transaction SCOT
Regards,
Egle -
Visual Studio 2010 Sending a fully html email.
I would like to send a fully html email via Visual Studio, is this possible?
Here you go.
This is my old code for sending email on VB6. Unfortunately I don't have the reference of it.
you can download the required dll and OCX from the link below.
Please download them, the link will not be valid after Jan 01, 2015
also you need to read the code below and do some modification based on the objects on your form.
Please pay attention to the required reference as well.
Link
' Required declaration of the vbSendMail component (withevents is optional)
' You also need a reference to the vbSendMail component in the Project References
Private WithEvents poSendMail As vbSendMail.clsSendMail
Attribute poSendMail.VB_VarHelpID = -1
' misc local vars
Dim bAuthLogin As Boolean
Dim bPopLogin As Boolean
Dim bHtml As Boolean
Dim MyEncodeType As ENCODE_METHOD
Dim etPriority As MAIL_PRIORITY
Dim bReceipt As Boolean
Private Sub cmdSend_Click()
' This is where all of the Components Properties are set / Methods called
cmdSend.Enabled = False
lstStatus.Clear
Screen.MousePointer = vbHourglass
With poSendMail
' Optional properties for sending email, but these should be set first
' if you are going to use them
.SMTPHostValidation = VALIDATE_NONE ' Optional, default = VALIDATE_HOST_DNS
.EmailAddressValidation = VALIDATE_SYNTAX ' Optional, default = VALIDATE_SYNTAX
.Delimiter = ";" ' Optional, default = ";" (semicolon)
' Basic properties for sending email
.SMTPHost = txtServer.text ' Required the fist time, optional thereafter
.From = txtFrom.text ' Required the fist time, optional thereafter
.FromDisplayName = txtFromName.text ' Optional, saved after first use
.Recipient = txtTo.text ' Required, separate multiple entries with delimiter character
.RecipientDisplayName = txtToName.text ' Optional, separate multiple entries with delimiter character
.CcRecipient = txtCc ' Optional, separate multiple entries with delimiter character
.CcDisplayName = txtCcName ' Optional, separate multiple entries with delimiter character
.BccRecipient = txtBcc ' Optional, separate multiple entries with delimiter character
.ReplyToAddress = txtFrom.text ' Optional, used when different than 'From' address
.Subject = txtSubject.text ' Optional
.Message = txtMsg.text ' Optional
.Attachment = Trim(txtAttach.text) ' Optional, separate multiple entries with delimiter character
' Additional Optional properties, use as required by your application / environment
.AsHTML = bHtml ' Optional, default = FALSE, send mail as html or plain text
.ContentBase = "" ' Optional, default = Null String, reference base for embedded links
.EncodeType = MyEncodeType ' Optional, default = MIME_ENCODE
.Priority = etPriority ' Optional, default = PRIORITY_NORMAL
.Receipt = bReceipt ' Optional, default = FALSE
.UseAuthentication = bAuthLogin ' Optional, default = FALSE
.UsePopAuthentication = bPopLogin ' Optional, default = FALSE
.UserName = txtUserName ' Optional, default = Null String
.Password = txtPassword ' Optional, default = Null String, value is NOT saved
.POP3Host = txtPopServer
.MaxRecipients = 100 ' Optional, default = 100, recipient count before error is raised
' Advanced Properties, change only if you have a good reason to do so.
' .ConnectTimeout = 10 ' Optional, default = 10
' .ConnectRetry = 5 ' Optional, default = 5
' .MessageTimeout = 60 ' Optional, default = 60
' .PersistentSettings = True ' Optional, default = TRUE
' .SMTPPort = 25 ' Optional, default = 25
' OK, all of the properties are set, send the email...
' .Connect ' Optional, use when sending bulk mail
.Send ' Required
' .Disconnect ' Optional, use when sending bulk mail
txtServer.text = .SMTPHost ' Optional, re-populate the Host in case
' MX look up was used to find a host End With
End With
Screen.MousePointer = vbDefault
cmdSend.Enabled = True
End Sub
' The following four Subs capture the Events fired by the vbSendMail component
Private Sub poSendMail_Progress(lPercentCompete As Long)
' vbSendMail 'Progress Event'
lblProgress = lPercentCompete & "% complete"
End Sub
Private Sub poSendMail_SendFailed(Explanation As String)
' vbSendMail 'SendFailed Event
MsgBox ("Your attempt to send mail failed for the following reason(s): " & vbCrLf & Explanation)
lblProgress = ""
Screen.MousePointer = vbDefault
cmdSend.Enabled = True
End Sub
Private Sub poSendMail_SendSuccesful()
' vbSendMail 'SendSuccesful Event'
MsgBox "Notification Successful!"
lblProgress = ""
End Sub
Private Sub poSendMail_Status(Status As String)
' vbSendMail 'Status Event'
lstStatus.AddItem Status
lstStatus.ListIndex = lstStatus.ListCount - 1
lstStatus.ListIndex = -1
End Sub
Private Sub Form_Load()
On Error GoTo ErrHan
' Required to activate the vbSendMail component.
Set poSendMail = New clsSendMail
With Me
.Move (Screen.width - .width) / 2, (Screen.height - .height) / 2
.fraOptions.height = 2475
.lblProgress = ""
End With
cboPriority.AddItem "Normal"
cboPriority.AddItem "High"
cboPriority.AddItem "Low"
cboPriority.ListIndex = 0
CenterControlsVertical 100, False, txtServer, txtPopServer, txtFromName, txtFrom, txtToName, txtTo, txtCcName, txtCc, txtBcc, txtSubject, txtMsg, txtAttach, lstStatus, lblProgress
AlignControlsTop False, txtServer, lblServer, cmdSend
CenterControlsHorizontal 300, False, lblServer, txtServer, cmdSend
AlignControlsLeft False, lblServer, lblPopServer, lblFromName, lblFrom, lblToName, lblTo, lblCcName, lblCC, lblBcc, lblSubject, lblMsg, lstStatus, lblAttach, lblStatus
CenterControlRelativeVertical lblServer, txtServer
CenterControlRelativeVertical lblPopServer, txtPopServer
CenterControlRelativeVertical cmdSend, txtServer
CenterControlRelativeVertical lblFromName, txtFromName
CenterControlRelativeVertical cmdReset, txtPopServer
CenterControlRelativeVertical lblFrom, txtFrom
CenterControlRelativeVertical lblToName, txtToName
CenterControlRelativeVertical CmdExit, txtFrom
CenterControlRelativeVertical lblTo, txtTo
CenterControlRelativeVertical lblCcName, txtCcName
CenterControlRelativeVertical lblCC, txtCc
CenterControlRelativeVertical lblBcc, txtBcc
CenterControlRelativeVertical lblSubject, txtSubject
CenterControlRelativeVertical lblAttach, txtAttach
CenterControlRelativeVertical cmdBrowse, txtAttach
AlignControlsTop False, txtMsg, lblMsg
AlignControlsTop False, lstStatus, lblStatus
fraOptions.Top = txtTo.Top - 135
AlignControlsLeft True, txtServer, txtPopServer, txtFromName, txtFrom, txtToName, txtTo, txtCcName, txtCc, txtBcc, txtSubject, txtMsg, lstStatus, txtAttach, lblProgress
AlignControlsLeft True, cmdSend, cmdReset, CmdExit, cmdBrowse, fraOptions
lblPopServer.Visible = False
txtPopServer.Visible = False
Me.Show
RetrieveSavedValues
Exit Sub
ErrHan:
If Err.Number = 429 Then
' Shell ("regsvr32 /s C:\Utility\Ref\vbSendMail.dll")
' Shell ("regsvr32 /s C:\Utility\Ref\MSWINSCK.OCX")
reg_ = "regsvr32 /s N:\Pic\vbSendMail.dll"
Shell (reg_)
reg_ = "regsvr32 /s N:\Pic\\MSWINSCK.OCX"
Shell (reg_)
' reg_ = "regsvr32 /s " & App.Path & "\Ref\vbSendMail.dll"
' Shell (reg_)
' reg_ = "regsvr32 /s " & App.Path & "\Ref\MSWINSCK.OCX"
' Shell (reg_)
Resume Next
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
' Unload the component before quiting.
Set poSendMail = Nothing
End Sub
Private Sub RetrieveSavedValues()
' Retrieve saved values by reading the components 'Persistent' properties
poSendMail.PersistentSettings = True
txtServer.text = poSendMail.SMTPHost
txtPopServer.text = poSendMail.POP3Host
txtFrom.text = poSendMail.From
txtFromName.text = poSendMail.FromDisplayName
txtUserName = poSendMail.UserName
optEncodeType(poSendMail.EncodeType).Value = True
If poSendMail.UseAuthentication Then ckLogin = vbChecked Else ckLogin = vbUnchecked
End Sub
Private Sub optEncodeType_Click(Index As Integer)
If optEncodeType(0).Value = True Then
MyEncodeType = MIME_ENCODE
cboPriority.Enabled = True
ckHtml.Enabled = True
ckReceipt.Enabled = True
ckLogin.Enabled = True
Else
MyEncodeType = UU_ENCODE
ckHtml.Value = vbUnchecked
ckReceipt.Value = vbUnchecked
ckLogin.Value = vbUnchecked
cboPriority.Enabled = False
ckHtml.Enabled = False
ckReceipt.Enabled = False
ckLogin.Enabled = False
End If
End Sub
Private Sub cboPriority_Click()
Select Case cboPriority.ListIndex
Case 0: etPriority = NORMAL_PRIORITY
Case 1: etPriority = HIGH_PRIORITY
Case 2: etPriority = LOW_PRIORITY
End Select
End Sub
Private Sub cboPriority_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case 38, 40
Case Else: KeyCode = 0
End Select
End Sub
Private Sub cboPriority_KeyPress(KeyAscii As Integer)
KeyAscii = 0
End Sub
Private Sub ckHtml_Click()
If ckHtml.Value = vbChecked Then bHtml = True Else bHtml = False
End Sub
Private Sub ckLogin_Click()
If ckLogin.Value = vbChecked Then
bAuthLogin = True
fraOptions.height = 3555
Else
bAuthLogin = False
If ckPopLogin.Value = vbUnchecked Then fraOptions.height = 2475
End If
End Sub
Private Sub ckPopLogin_Click()
If ckPopLogin.Value = vbChecked Then
bPopLogin = True
lblPopServer.Visible = True
txtPopServer.Visible = True
fraOptions.height = 3555
Else
bPopLogin = False
lblPopServer.Visible = False
txtPopServer.Visible = False
If ckLogin.Value = vbUnchecked Then fraOptions.height = 2475
End If
End Sub
Private Sub ckReceipt_Click()
If ckReceipt.Value = vbChecked Then bReceipt = True Else bReceipt = False
End Sub
Private Sub cmdBrowse_Click()
Dim sFilenames() As String
Dim i As Integer
On Local Error GoTo Err_Cancel
With cmDialog
.FileName = ""
.CancelError = True
.Filter = "All Files (*.*)|*.*|HTML Files (*.htm;*.html;*.shtml)|*.htm;*.html;*.shtml|Images (*.bmp;*.jpg;*.gif)|*.bmp;*.jpg;*.gif"
.FilterIndex = 1
.DialogTitle = "Select File Attachment(s)"
.MaxFileSize = &H7FFF
.Flags = &H4 Or &H800 Or &H40000 Or &H200 Or &H80000
.ShowOpen
' get the selected name(s)
sFilenames = Split(.FileName, vbNullChar)
End With
If UBound(sFilenames) = 0 Then
If txtAttach.text = "" Then
txtAttach.text = sFilenames(0)
Else
txtAttach.text = txtAttach.text & ";" & sFilenames(0)
End If
ElseIf UBound(sFilenames) > 0 Then
If Right$(sFilenames(0), 1) <> "\" Then sFilenames(0) = sFilenames(0) & "\"
For i = 1 To UBound(sFilenames)
If txtAttach.text = "" Then
txtAttach.text = sFilenames(0) & sFilenames(i)
Else
txtAttach.text = txtAttach.text & ";" & sFilenames(0) & sFilenames(i)
End If
Next
Else
Exit Sub
End If
Err_Cancel:
End Sub -
Trying to send SmartForm in HTML format - error
Hello
I am having some trouble when i try to send a smart form in a html format to some e-mail recipients. I have written an program in ABAP that does the extraction of smartform contents and translates in HTML (+CSS) format, ready to be send. I got the program here
/people/pavan.bayyapu/blog/2005/08/30/sending-html-email-from-sap-crmerp
and modified it just a little bit - no major changes.
I guess the problem is in a service that is not running on the system but i don't know which is that and even where to look for that. I also explained my problem to my BC group but they don't seem to have any ideas .
I checked the system info (which comp. version we are running):
Comp. version: CRM 5.0
Detailed view:
SAP_ABA 700 0006
SAP_BASI 700 0006
PI_BASI 2005_1_700 0006
ST-PI 2005_1_700 0001
SAP_BW 700 0006
SAP_AP 700 0003
BBPCRM 500 0003
I have this program properly WORKING on our other system.
Info:
Comp. version: BBPCRM 4.0
Detailed view:
SAP_BASIS 620 0046
SAP_ABA 620 0046
BBPCRM 400 0007
PI_BASIS 2004_1_620 0009
ST-PI 2005_1_620 0003
ST-A/PI 01G_CRM400 0000
I get the error below. Thanks for all your answers in advance!
error -
Service cannot be reached
What has happened?
URL http://localhost/SAP/BC/BSP/SAP/SMART_FORMS/DEFAULT.CSS call was terminated because the corresponding service is not available.
Note
The termination occurred in system TC1 with error code 403 and for the reason Forbidden.
The selected virtual host was 0 .
What can I do?
Please select a valid URL.
If you do not yet have a user ID, contact your system administrator.
ErrorCode:ICF-NF-http-c:005-u:UPUKOLBL-l:5-i:peca_TC1_48-v:0-s:403-r:Forbidden
HTTP 403 - Forbidden
Your SAP Internet Communication Framework Team
.ZETEDNIKSTYLE div#N1.par{ font-family : "Arial" ; font-size : 30pt ; font-weight : bold ; line-height : 4.23mm ; text-decoration : none ; text-align : left ; clear : both ;}.ZETEDNIKSTYLE div#N2.par{ font-family : "Arial" ; font-size : 30pt ; font-weight : bold ; line-height : 4.23mm ; text-decoration : none ; text-align : left ; color : #000000 ; clear : both ;}.ZETEDNIKSTYLE div#P1.par{ font-family : "Arial" ; font-size : 11pt ; font-weight : normal ; line-height : 4.23mm ; text-decoration : none ; text-align : left ; color : #000000 ; clear : both ;}.ZETEDNIKSTYLE div#P2.par{ font-family : "Arial" ; font-size : 12pt ; font-weight : normal ; line-height : 4.23mm ; text-decoration : underline ; text-align : left ; color : #0000FF ; clear : both ;}.ZETEDNIKSTYLE a#FIRST-001.page@media screen {#WINBACKGROUND.win{ overflow : hidden ;}}@media print {#WINBACKGROUND.win{ overflow : hidden ;}}#FIRST-001.page #WINBACKGROUND.win@media screen {#WINBODYTEXT.win{ overflow : auto ;}}@media print {#WINBODYTEXT.win{ overflow : hidden ;}}#FIRST-001.page #WINBODYTEXT.win@media screen {#WINLOGO.win{ overflow : hidden ;}}@media print {#WINLOGO.win{ overflow : hidden ;}}#FIRST-001.page #WINLOGO.winI have the same problem even the service in SICF is active. Is it something to do with the default.css url which pointing to localhost? http://localhost/SAP/BC/BSP/SAP/SMART_FORMS/DEFAULT.CSS
Pls help. -
How to get rendered JSF page (send it as HTML email)
Hello,
I would like to send notification email in my application. Could you please help me to find a way how to get HTML result of JSF page as string-file-stream. Simply anything I could handle and use it as email body or attachment.
My use case: User click to button (raise a action) which change something in DB and confirmation.xhtml(.jsf) is shown to him to confirm that this action was succesful. And I would like to send notification email to all other users with this page (simplified version).
I need a something like String getJsfPage(String url) but I could not find anything in JSF API.
Thanks for any clue.quote gimbal2: +...now write the code to generate the email body...+
Thanks for reply...
Is that mean that I could not use already written code (confirmation.xhtml)? The beuty on JSF is that JSF parser take care about CSS styles, EL, templating (ui: ...), ... When anybody (administrators) wants to change how this email looks - just change this XHTML file.
How should I write email body? I thought about several way but nothing what looks good:
- I really dont want to use StringBuilder do build HTML.
- I dont want to write my own parser of .xhtml template (confirmation.xhtml).
- Write HTML (xml) template and parse it with XSLT transformation seems to me acceptable but complicated. Needs a special library to perform XSLT, complicated template service (future changes)
- JSP page, more-or-less the same problems like JSF page
The sad is that this email (html) body is quite small but highly dynamic (css, language of texts, logos...). -
How to send smartform as an email or fax
Hi Friends,
Problem is i am getting smartform output, but how to send the output as an email or fax( say for ex it should be sent to vendor). Also kindly explain how to convert smartform to PDF output. Thanks in advance.Hi,
The below sample code is for 4.6C.Try this out.
Kindly reward points by clicking the star on the left of reply,if it helps.
Internal Table declarations
DATA: i_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
i_tline TYPE TABLE OF tline WITH HEADER LINE,
i_receivers TYPE TABLE OF somlreci1 WITH HEADER LINE,
i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,
Objects to send mail.
i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
i_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
Work Area declarations
wa_objhead TYPE soli_tab,
w_ctrlop TYPE ssfctrlop,
w_compop TYPE ssfcompop,
w_return TYPE ssfcrescl,
wa_doc_chng typE sodocchgi1,
w_data TYPE sodocchgi1,
wa_buffer TYPE string,"To convert from 132 to 255
Variables declarations
v_form_name TYPE rs38l_fnam,
v_len_in LIKE sood-objlen,
v_len_out LIKE sood-objlen,
v_len_outn TYPE i,
v_lines_txt TYPE i,
v_lines_bin TYPE i.
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = 'ZZZ_TEST1'
importing
fm_name = v_form_name
exceptions
no_form = 1
no_function_module = 2
others = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
w_ctrlop-getotf = 'X'.
w_ctrlop-no_dialog = 'X'.
w_compop-tdnoprev = 'X'.
CALL FUNCTION v_form_name
EXPORTING
control_parameters = w_ctrlop
output_options = w_compop
user_settings = 'X'
IMPORTING
job_output_info = w_return
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
i_otf[] = w_return-otfdata[].
call function 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = v_len_in
TABLES
otf = i_otf
lines = i_tline
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
others = 4.
Fehlerhandling
if sy-subrc <> 0.
endif.
loop at i_tline.
translate i_tline using '~'.
concatenate wa_buffer i_tline into wa_buffer.
endloop.
translate wa_buffer using '~'.
do.
i_record = wa_buffer.
append i_record.
shift wa_buffer left by 255 places.
if wa_buffer is initial.
exit.
endif.
enddo.
Attachment
refresh:
i_reclist,
i_objtxt,
i_objbin,
i_objpack.
clear wa_objhead.
i_objbin[] = i_record[].
Create Message Body
Title and Description
i_objtxt = 'test with pdf-Attachment!'.
append i_objtxt.
describe table i_objtxt lines v_lines_txt.
read table i_objtxt index v_lines_txt.
wa_doc_chng-obj_name = 'smartform'.
wa_doc_chng-expiry_dat = sy-datum + 10.
wa_doc_chng-obj_descr = 'smartform'.
wa_doc_chng-sensitivty = 'F'.
wa_doc_chng-doc_size = v_lines_txt * 255.
Main Text
wa_doc_chng-doc_size = ( v_lines_txt - 1 ) * 255 + strlen( i_objtxt )
clear i_objpack-transf_bin.
i_objpack-head_start = 1.
i_objpack-head_num = 0.
i_objpack-body_start = 1.
i_objpack-body_num = v_lines_txt.
i_objpack-doc_type = 'RAW'.
append i_objpack.
Attachment
(pdf-Attachment)
i_objpack-transf_bin = 'X'.
i_objpack-head_start = 1.
i_objpack-head_num = 0.
i_objpack-body_start = 1.
Länge des Attachment ermitteln
describe table i_objbin lines v_lines_bin.
read table i_objbin index v_lines_bin.
i_objpack-doc_size = v_lines_bin * 255 .
i_objpack-body_num = v_lines_bin.
i_objpack-doc_type = 'PDF'.
i_objpack-obj_name = 'smart'.
i_objpack-obj_descr = 'test'.
append i_objpack.
clear i_reclist.
i_reclist-receiver = [email protected]'.
i_reclist-rec_type = 'U'.
append i_reclist.
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = wa_doc_chng
put_in_outbox = 'X'
TABLES
packing_list = i_objpack
object_header = wa_objhead
CONTENTS_BIN = i_objbin
contents_txt = i_objtxt
receivers = i_reclist
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. -
Login prompt while sending graphic in html email (CRMD_EMAIL)
Scenario : We have created a new standard response in webclient email. The template for this is maintained via CRMD_EMAIL(or CRM_ERMS_MAILFORMS - both refer to the same program). We have created a text within the window with text type html. A web graphic has also been dragged and dropped onto the text part. This template can then be used to email the customer.
Issue : When the customer receives the email (say in gmail) and the display images setting is activated, this prompts for a login onto the SAP server(similar to the login on CRM_IC). In outlook the image is not being displayed(even after making the display images setting).Hi Naresh,
Thank you for your helpful input.
Howevr i am still facing some issues.My email id is not able to get authenticated,the logs read that the connection to outlook 2007 exchange server was established but it failed to authenticate my id.Now the latest error reads that the email id has been marked as invalid email id.Pls let me know if I am missing anything here.
I am attaching the error code.
DEBUG: setDebug: JavaMail version 1.4.1
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: trying to connect to host "xxx.xxx.com", port 25, isSSL false
220 xxx.xxx.com Microsoft ESMTP MAIL Service ready at Tue, 25 Oct 2011 15:09:14 +0530
DEBUG SMTP: connected to host "xxx.xxx.com", port: 25
EHLO xxxx
250-xxx.xxx.com Hello [xxxx]
250-SIZE
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-STARTTLS
250-X-ANONYMOUSTLS
250-AUTH NTLM
250-X-EXPS GSSAPI NTLM
250-8BITMIME
250-BINARYMIME
250-CHUNKING
250-XEXCH50
250 XRDST
DEBUG SMTP: Found extension "SIZE", arg ""
DEBUG SMTP: Found extension "PIPELINING", arg ""
DEBUG SMTP: Found extension "DSN", arg ""
DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""
DEBUG SMTP: Found extension "STARTTLS", arg ""
DEBUG SMTP: Found extension "X-ANONYMOUSTLS", arg ""
DEBUG SMTP: Found extension "AUTH", arg "NTLM"
DEBUG SMTP: Found extension "X-EXPS", arg "GSSAPI NTLM"
DEBUG SMTP: Found extension "8BITMIME", arg ""
DEBUG SMTP: Found extension "BINARYMIME", arg ""
DEBUG SMTP: Found extension "CHUNKING", arg ""
DEBUG SMTP: Found extension "XEXCH50", arg ""
DEBUG SMTP: Found extension "XRDST", arg ""
DEBUG SMTP: Attempt to authenticate
DEBUG SMTP: use8bit false
MAIL FROM:<[email protected]>
530 5.7.1 Client was not authenticated
DEBUG SMTP: got response code 530, with response: 530 5.7.1 Client was not authenticated
Thanks in advance
Edited by: bpm11gnewbie on 2011-okt-25 02:40 -
Sending Smartform as an Email Attachment
Hi All,
After executing the FM SO_NEW_DOCUMENT_ATT_SEND_API1, I' m getting sy-subrc as 0.
However in receivers table I'm getting the return code 27.
Can anybody please suggest what might went wrong.
Regards
AdiHi,
The return code 27 represents the error "receiver_not_exist". So check the entry passed into the "RECEIVERS" internal table into the FM. Mainly the values in "RECEIVER" and "REC_TYPE" field etc.
Regards,
Harish -
Html email rendering as attachment
I'm a developer sending out an html email. Web clients like Yahoo, Gmail, Hotmail render the email inline as expected, as do desktop email clients. But for one recipient, Sun Java System Messenger Express renders the html as an attachment. There is not boundary etc. like you would use for multipart mail or attachments, so what could be triggering this? The recipient can receive other similar html newsletters just fine. The html is relatively simple tables with images and some formatted text. The mail is being sent via php's mail function (sendmail).
Thanks,
aamchargue wrote:
I'm a developer sending out an html email. Web clients like Yahoo, Gmail, Hotmail render the email inline as expected, as do desktop email clients. But for one recipient, Sun Java System Messenger Express renders the html as an attachment. There is not boundary etc. like you would use for multipart mail or attachments, so what could be triggering this?You need to provide a sample email that is causing the problem, including all outer email headers.
I should also point out that Messenger Express is a deprecated client (i.e. Sun stopped providing fixes for this client a long time ago) and was replaced by UWC/Communications Express which has in turn been replaced by Convergence.
Regards,
Shane. -
I want users to click a button that uses URLRequest and navigateToURL to open the user's default email client with email body pre-populated with HTML email.
Even though I have tried to set the contentType property to one of the following, the HTML tags always display:
application/xml
application/html
var request:URLRequest = new URLRequest("mailto: ?subject=Test Email&body=<h1>Test Body</h1>");request.contentType = "multipart/form-data";
navigateToURL(request, "_self");
BTW, the above code is simplified, so I am using escape() on the subject and body text, etc.
So, is there any way to use mailto in this way to open the default email client and pre-populate with HTML email but not see the tags (BUT NOT REVERT TO PLAINTEXT)?FTQuest wrote:
@Jason
>The problem there however is that very few people actually set this up... (default mail client)
Jason, can I ask you: is it your assumption, or there is/was reliable polling showing that majority of users prefer manually go the mail server instead of using the mail client application of their choice - Outlook, FireBird, Mail, etc?
Igor Borodin
There are numerous reasons behind avoiding mailto links in relation to design. And it's been debated back and forth for years. Form vs Mailto link both have their pros and cons and intended usages.
After panelling groups of individuals for three seperate projects regarding various design perspectives in the RIAs we developed, it became quickly apparent that on numerous occasions users clicking a mailto link were unaware of what the resulting screen was actually for. Several had never set up the default mail client on their pc. Many thought that "Yahoo" was the only email service in the world... Now, with that said, the target demographic for those applcations may or may not be what his, yours, or anyone's project may be. The key there is going to be identifying your dedmographic and determining the tech prowness. Also, what exactly is the email's intended result? Refer a friend style? Might be better handled through a web form due to the possiblity of being able to properly track how many referrals were actually made. How many resulted in a visitor. Simply notifying admin that there is a problem on the site? Might be better to fire off a mailto.
Reliably sending a preformatted HTML email can only be guaranteed on the server side. Otherwise, you run into problems just like he is having here. Now, if the email is plain text, different story.
Again, it all comes down to identifying your usage and properly utilizng the available tools. -
Send Smart Forms within emails (html) Problems with format
Dear all,
the ABAP report SF_XSF_DEMO1 is a demo report which converts a certain smart form into HTML and then sends it as an email in html format.
Sending the email is possible without any problems but I am wondering about the email format.
<a href="http://www.imgbox.de/show/img/e4QvgzsS4L.jpg" title="Bilder hochladen">This screenshot shows how the email looks like.</a>
I am not happy with the email layout as the Smart Form "SF_XSF_DEMO1" is designed in a different way.
What do I have to adapt within the report in order to send an email that really looks like the Smart Form? Or is it a customizing issue?
(I would like to avoid having to send the Smart Form as PDF attachment...)
Thanks for you help!
Kristian KindlerHi Kristian,
When ever you send a smartform output as an HTML email, the system generates automatic style sheets which are not supported in many email clients such as Outlook 2007, hence you will face a formatting issue. We faced the same issue and had do it it like this:
Build a BSP page similar to the output which you want to send as an email. Now you can use the BSP URL to send the html email using cl_bcs class.
I have documented this in my article below-
http://divulgesap.com/blog.php?p=NDA=
Hope it helps.
Regards,
Ravikiran -
How to send a SmartForm output as Email to external id?
I want the Smartform output to email to extrenal email-id.
I don't want the Smartform output as any kind of attachment, but the Smartform output needs to be shown on the main email body. Can anyone pls. help me out?First, thanks for your responses.
I haven't found the demo program 'BCS_EXAMPLE_6' in SAP 4.7. But then I got it in SAP 5.0 version. But this program only describes how to send Form output as PDF attachment with email. But this is well-known and I haven't asked for this. I want the Smartform output within the mail-body without attachment.
The weblog at "/people/pavan.bayyapu/blog/2005/08/30/sending-html-email-from-sap-crmerp seems a more logical one, though I have already tried it out. Here the html page creation and graphics load -- everything is going right. But this HTML page is being delivered as an Attachment within the email. The normal HTML Email is not coming. I think this technique wouldn't work with all mailing tools. Here in the weblog, Pavan has shown the example with Microsoft Outlook. But I have tested with Lotus Notes and Yahoo. And In both cases, the mail is coming with attached HTML file (in .mht format), but not as a notmal html mail without attachments. -
Problem in sending the smartform as an email in a country specific language
Hi,
I am facing a problem in sending a smartform as a email for all other Languages except english and another problem is its sending the email but the output status is still in RED in the messages tab.
the program is working fine for english.
Please do find the below code using which i would be sending the smartform as an email for a PO along with the line item attachments.
Please help.
Arun.
Determine smartform function module for purchase document
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = lf_formname
IMPORTING
fm_name = lf_fm_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
IF sy-subrc <> 0.
error handling
ent_retco = sy-subrc.
IF sy-subrc = 1.
MESSAGE e001(/smb40/ssfcomposer).
ENDIF.
IF sy-subrc = 2.
MESSAGE e002(/smb40/ssfcomposer) WITH tnapr-sform.
ENDIF.
PERFORM protocol_update_i.
ENDIF.
*Start of changes <Arun K Singarapu> C082493 <04/28/2008>
*for print preview
IF sy-ucomm = 'PREVOUTPUT' OR sy-ucomm = 'VIEW'.
CALL FUNCTION lf_fm_name "'/1BCDWB/SF00000197'
EXPORTING
control_parameters = wa_ctrlop
output_options = wa_compop
user_settings = 'X'
is_ekko = l_doc-xekko
is_pekko = l_doc-xpekko
is_nast = l_nast
iv_from_mem = l_from_memory
iv_druvo = iv_druvo
iv_xfz = iv_xfz
IMPORTING
job_output_info = wa_return
TABLES
it_ekpo = l_doc-xekpo[]
it_ekpa = l_doc-xekpa[]
it_pekpo = l_doc-xpekpo[]
it_eket = l_doc-xeket[]
it_tkomv = l_doc-xtkomv[]
it_ekkn = l_doc-xekkn[]
it_ekek = l_doc-xekek[]
it_komk = l_xkomk[]
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
EXIT.
ELSE.
wa_ctrlop-LANGU = nast-spras.
wa_ctrlop-getotf = 'X'.
wa_ctrlop-no_dialog = 'X'.
wa_compop-tdnoprev = 'X'.
CALL FUNCTION lf_fm_name "'/1BCDWB/SF00000197'
EXPORTING
control_parameters = wa_ctrlop
output_options = wa_compop
user_settings = 'X'
is_ekko = l_doc-xekko
is_pekko = l_doc-xpekko
is_nast = l_nast
iv_from_mem = l_from_memory
iv_druvo = iv_druvo
iv_xfz = iv_xfz
IMPORTING
job_output_info = wa_return
TABLES
it_ekpo = l_doc-xekpo[]
it_ekpa = l_doc-xekpa[]
it_pekpo = l_doc-xpekpo[]
it_eket = l_doc-xeket[]
it_tkomv = l_doc-xtkomv[]
it_ekkn = l_doc-xekkn[]
it_ekek = l_doc-xekek[]
it_komk = l_xkomk[]
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*Convert the data from OTF to PDF format
it_otf[] = wa_return-otfdata[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = l_len_in
bin_file = lp_xcontent
TABLES
otf = it_otf
lines = it_tline
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
TRY.
---------- create persistent send request ----------------------
send_request = cl_bcs=>create_persistent( ).
len = XSTRLEN( lp_xcontent ).
transform to solix tab
lt_solix =
cl_document_bcs=>xstring_to_solix(
ip_xstring = lp_xcontent ).
Create Body to the E-mail.
APPEND Text-005 TO l_text.
Attachment Name
l_ponumber = text-004.
CONCATENATE l_ponumber l_doc-xekko-ebeln INTO l_ponumber.
Subject for the E-Mail.
l_subject = text-001.
CONCATENATE l_subject l_doc-xekko-ebeln INTO l_subject.
*create document E-Mail.
CALL METHOD cl_document_bcs=>create_document
EXPORTING
i_type = 'RAW'
i_subject = l_subject
i_length = '13'
i_text = l_text
RECEIVING
result = l_email_object.
*Create PDF Document
bcs_doc = cl_document_bcs=>create_document(
i_type = 'PDF'
i_subject = l_ponumber
i_length = len
i_language = nast-spras
i_hex = lt_solix
*Type casting
obj_pdf_file ?= bcs_doc.
Add PDF document as an attachment
CALL METHOD l_email_object->add_document_as_attachment
EXPORTING
im_document = obj_pdf_file.
get the attachments of the PO for each line item
SELECT ebeln
ebelp
FROM ekpo
INTO TABLE it_ekpo
WHERE ebeln = l_doc-xekko-ebeln.
concatenate PO and the Line Item Numebr to get the Object key
LOOP AT it_ekpo INTO wa_ekpo.
CONCATENATE wa_ekpo-ebeln wa_ekpo-ebelp INTO wa_temp-objky.
APPEND wa_temp TO it_temp.
CLEAR: wa_temp,wa_ekpo.
ENDLOOP.
*Get data from table DRAD
IF it_temp[] IS NOT INITIAL.
SELECT dokar
doknr
dokvr
doktl
objky
FROM drad
client specified
INTO TABLE it_drad
FOR ALL ENTRIES IN it_temp
WHERE mandt = sy-mandt
AND objky = it_temp-objky.
ENDIF.
IF NOT it_drad IS INITIAL.
SELECT * FROM dms_doc2loio
INTO TABLE it_dms_doc2loio
FOR ALL ENTRIES IN it_drad
WHERE dokar = 'SRM'
AND doknr = it_drad-doknr
AND dokvr = it_drad-dokvr
AND doktl = it_drad-doktl.
ENDIF.
Get the Physical object class and Object ID of the attachment
IF NOT it_dms_doc2loio IS INITIAL.
SELECT * FROM dms_ph_cd1
INTO TABLE it_dms_ph_cd1
FOR ALL ENTRIES IN it_dms_doc2loio
WHERE loio_id = it_dms_doc2loio-lo_objid.
ENDIF.
Get the file from the DMS server using the below function module.
LOOP AT it_dms_ph_cd1 INTO wa_dms_ph_cd1.
wa_object_id-class = wa_dms_ph_cd1-ph_class.
wa_object_id-objid = wa_dms_ph_cd1-phio_id.
CALL FUNCTION 'SDOK_PHIO_LOAD_CONTENT'
EXPORTING
object_id = wa_object_id
client = sy-mandt
TABLES
file_access_info = it_file_access_info
file_content_binary = it_sdokcntbin
EXCEPTIONS
not_existing = 1
not_authorized = 2
no_content = 3
bad_storage_type = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
READ TABLE it_file_access_info INTO wa_file_access_info INDEX 1.
IF wa_file_access_info-mimetype = 'application/msword'.
l_doc_type = 'DOC'.
CLEAR: a_xstring,len.
LOOP AT it_sdokcntbin INTO wa_sdokcntbin.
CONCATENATE a_xstring wa_sdokcntbin-line
INTO a_xstring IN BYTE MODE.
ENDLOOP.
len = XSTRLEN( a_xstring ).
transform to solix tab - adding additional attachments
REFRESH lt_solix.
lt_solix =
cl_document_bcs=>xstring_to_solix(
ip_xstring = a_xstring ).
CLEAR l_filename.
Get the file name
l_filename = wa_file_access_info-file_name.
bcs_doc1 = cl_document_bcs=>create_document(
i_type = l_doc_type
i_subject = l_filename
i_length = len
i_language = sy-langu
i_hex = lt_solix
*Type casting
obj_file ?= bcs_doc1.
Add Attachment as a document to the email object
CALL METHOD l_email_object->add_document_as_attachment
EXPORTING
im_document = obj_file.
for PDF document
ELSEIF wa_file_access_info-mimetype = 'application/pdf'.
l_doc_type = 'PDF'.
file_size = wa_file_access_info-file_size.
Convert the 1022 binary data to xstring
CLEAR a_xstring.
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
EXPORTING
input_length = file_size
IMPORTING
buffer = a_xstring
TABLES
binary_tab = it_sdokcntbin
EXCEPTIONS
failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
DATA: w_output_length TYPE i.
Convert Xstring to 255 RAW
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = a_xstring
IMPORTING
output_length = w_output_length
TABLES
binary_tab = lt_content_bin.
len = w_output_length.
CLEAR l_filename.
Get the file name
l_filename = wa_file_access_info-file_name.
bcs_doc1 = cl_document_bcs=>create_document(
i_type = l_doc_type
i_subject = l_filename
i_length = len
i_language = sy-langu
i_hex = lt_content_bin
type casting
obj_file ?= bcs_doc1.
Add Attachment as a document to the email object
CALL METHOD l_email_object->add_document_as_attachment
EXPORTING
im_document = obj_file.
for Excel Document
ELSEIF wa_file_access_info-mimetype = 'application/msexcel'.
l_doc_type = 'XLS'.
CLEAR: a_xstring,len.
LOOP AT it_sdokcntbin INTO wa_sdokcntbin.
CONCATENATE a_xstring wa_sdokcntbin-line
INTO a_xstring IN BYTE MODE.
ENDLOOP.
len = XSTRLEN( a_xstring ).
transform to solix tab - adding additional attachments
REFRESH lt_solix.
lt_solix =
cl_document_bcs=>xstring_to_solix(
ip_xstring = a_xstring ).
CLEAR l_filename.
Get the file name
l_filename = wa_file_access_info-file_name.
bcs_doc1 = cl_document_bcs=>create_document(
i_type = l_doc_type
i_subject = l_filename
i_length = len
i_language = sy-langu
i_hex = lt_solix
*Type casting
obj_file ?= bcs_doc1.
Add Attachment as a document to the email object
CALL METHOD l_email_object->add_document_as_attachment
EXPORTING
im_document = obj_file.
for text doxument
ELSEIF wa_file_access_info-mimetype = 'plain/text'.
l_doc_type = 'TXT'.
file_size = wa_file_access_info-file_size.
Get the file name
l_filename = wa_file_access_info-file_name.
CALL FUNCTION 'SCMS_BINARY_TO_TEXT'
EXPORTING
input_length = file_size
TABLES
binary_tab = it_sdokcntbin
text_tab = file_data
EXCEPTIONS
failed = 1
OTHERS = 2.
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 METHOD cl_document_bcs=>create_document
EXPORTING
i_type = l_doc_type
i_subject = l_filename
i_text = file_data
RECEIVING
result = bcs_doc1.
obj_file ?= bcs_doc1.
Add Attachment as a document to the email object
CALL METHOD l_email_object->add_document_as_attachment
EXPORTING
im_document = obj_file.
ENDIF.
CLEAR:it_file_access_info,it_sdokcntbin.
CLEAR:wa_object_id,wa_file_access_info,file_size.
ENDLOOP.
CALL METHOD send_request->set_document( l_email_object ).
*Get the address number for the vendor
SELECT SINGLE adrnr
FROM lfa1
INTO l_adrnr
WHERE lifnr = l_doc-xekko-lifnr.
MOVE l_adrnr TO l_addrno.
Get the Email Address for the vendor using address number
CALL FUNCTION 'ADDR_GET_REMOTE'
EXPORTING
addrnumber = l_addrno
TABLES
adsmtp = it_adsmtp
EXCEPTIONS
parameter_error = 1
address_not_exist = 2
internal_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
sender = cl_sapuser_bcs=>create( sy-uname ).
CALL METHOD send_request->set_sender
EXPORTING
i_sender = sender.
READ TABLE it_adsmtp INTO wa_adsmtp WITH KEY flg_nouse = 'X'.
IF sy-subrc = 0.
LOOP AT it_adsmtp INTO wa_adsmtp WHERE flg_nouse = 'X'.
CALL METHOD cl_cam_address_bcs=>create_internet_address
EXPORTING
i_address_string = wa_adsmtp-smtp_addr
RECEIVING
result = recipient.
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = 'X'.
ENDLOOP.
ELSE.
READ TABLE it_adsmtp INTO wa_adsmtp WITH KEY flgdefault = 'X'.
IF sy-subrc = 0.
CALL METHOD cl_cam_address_bcs=>create_internet_address
EXPORTING
i_address_string = wa_adsmtp-smtp_addr
RECEIVING
result = recipient.
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = 'X'.
ENDIF.
ENDIF.
CALL METHOD send_request->send(
EXPORTING
i_with_error_screen = 'X'
RECEIVING
result = l_sent_to_all ).
CATCH cx_bcs INTO bcs_exception.
WRITE: 'Fehler aufgetreten.'(001).
WRITE: 'Fehlertyp:'(002), bcs_exception->error_type.
EXIT.
ENDTRY.
ENDIF.Hi,
I am facing a problem in sending a smartform as a email for all other Languages except english and another problem is its sending the email but the output status is still in RED in the messages tab.
the program is working fine for english.
Please do find the below code using which i would be sending the smartform as an email for a PO along with the line item attachments.
Please help.
Arun.
Determine smartform function module for purchase document
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = lf_formname
IMPORTING
fm_name = lf_fm_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
IF sy-subrc <> 0.
error handling
ent_retco = sy-subrc.
IF sy-subrc = 1.
MESSAGE e001(/smb40/ssfcomposer).
ENDIF.
IF sy-subrc = 2.
MESSAGE e002(/smb40/ssfcomposer) WITH tnapr-sform.
ENDIF.
PERFORM protocol_update_i.
ENDIF.
*Start of changes <Arun K Singarapu> C082493 <04/28/2008>
*for print preview
IF sy-ucomm = 'PREVOUTPUT' OR sy-ucomm = 'VIEW'.
CALL FUNCTION lf_fm_name "'/1BCDWB/SF00000197'
EXPORTING
control_parameters = wa_ctrlop
output_options = wa_compop
user_settings = 'X'
is_ekko = l_doc-xekko
is_pekko = l_doc-xpekko
is_nast = l_nast
iv_from_mem = l_from_memory
iv_druvo = iv_druvo
iv_xfz = iv_xfz
IMPORTING
job_output_info = wa_return
TABLES
it_ekpo = l_doc-xekpo[]
it_ekpa = l_doc-xekpa[]
it_pekpo = l_doc-xpekpo[]
it_eket = l_doc-xeket[]
it_tkomv = l_doc-xtkomv[]
it_ekkn = l_doc-xekkn[]
it_ekek = l_doc-xekek[]
it_komk = l_xkomk[]
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
EXIT.
ELSE.
wa_ctrlop-LANGU = nast-spras.
wa_ctrlop-getotf = 'X'.
wa_ctrlop-no_dialog = 'X'.
wa_compop-tdnoprev = 'X'.
CALL FUNCTION lf_fm_name "'/1BCDWB/SF00000197'
EXPORTING
control_parameters = wa_ctrlop
output_options = wa_compop
user_settings = 'X'
is_ekko = l_doc-xekko
is_pekko = l_doc-xpekko
is_nast = l_nast
iv_from_mem = l_from_memory
iv_druvo = iv_druvo
iv_xfz = iv_xfz
IMPORTING
job_output_info = wa_return
TABLES
it_ekpo = l_doc-xekpo[]
it_ekpa = l_doc-xekpa[]
it_pekpo = l_doc-xpekpo[]
it_eket = l_doc-xeket[]
it_tkomv = l_doc-xtkomv[]
it_ekkn = l_doc-xekkn[]
it_ekek = l_doc-xekek[]
it_komk = l_xkomk[]
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*Convert the data from OTF to PDF format
it_otf[] = wa_return-otfdata[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = l_len_in
bin_file = lp_xcontent
TABLES
otf = it_otf
lines = it_tline
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
TRY.
---------- create persistent send request ----------------------
send_request = cl_bcs=>create_persistent( ).
len = XSTRLEN( lp_xcontent ).
transform to solix tab
lt_solix =
cl_document_bcs=>xstring_to_solix(
ip_xstring = lp_xcontent ).
Create Body to the E-mail.
APPEND Text-005 TO l_text.
Attachment Name
l_ponumber = text-004.
CONCATENATE l_ponumber l_doc-xekko-ebeln INTO l_ponumber.
Subject for the E-Mail.
l_subject = text-001.
CONCATENATE l_subject l_doc-xekko-ebeln INTO l_subject.
*create document E-Mail.
CALL METHOD cl_document_bcs=>create_document
EXPORTING
i_type = 'RAW'
i_subject = l_subject
i_length = '13'
i_text = l_text
RECEIVING
result = l_email_object.
*Create PDF Document
bcs_doc = cl_document_bcs=>create_document(
i_type = 'PDF'
i_subject = l_ponumber
i_length = len
i_language = nast-spras
i_hex = lt_solix
*Type casting
obj_pdf_file ?= bcs_doc.
Add PDF document as an attachment
CALL METHOD l_email_object->add_document_as_attachment
EXPORTING
im_document = obj_pdf_file.
get the attachments of the PO for each line item
SELECT ebeln
ebelp
FROM ekpo
INTO TABLE it_ekpo
WHERE ebeln = l_doc-xekko-ebeln.
concatenate PO and the Line Item Numebr to get the Object key
LOOP AT it_ekpo INTO wa_ekpo.
CONCATENATE wa_ekpo-ebeln wa_ekpo-ebelp INTO wa_temp-objky.
APPEND wa_temp TO it_temp.
CLEAR: wa_temp,wa_ekpo.
ENDLOOP.
*Get data from table DRAD
IF it_temp[] IS NOT INITIAL.
SELECT dokar
doknr
dokvr
doktl
objky
FROM drad
client specified
INTO TABLE it_drad
FOR ALL ENTRIES IN it_temp
WHERE mandt = sy-mandt
AND objky = it_temp-objky.
ENDIF.
IF NOT it_drad IS INITIAL.
SELECT * FROM dms_doc2loio
INTO TABLE it_dms_doc2loio
FOR ALL ENTRIES IN it_drad
WHERE dokar = 'SRM'
AND doknr = it_drad-doknr
AND dokvr = it_drad-dokvr
AND doktl = it_drad-doktl.
ENDIF.
Get the Physical object class and Object ID of the attachment
IF NOT it_dms_doc2loio IS INITIAL.
SELECT * FROM dms_ph_cd1
INTO TABLE it_dms_ph_cd1
FOR ALL ENTRIES IN it_dms_doc2loio
WHERE loio_id = it_dms_doc2loio-lo_objid.
ENDIF.
Get the file from the DMS server using the below function module.
LOOP AT it_dms_ph_cd1 INTO wa_dms_ph_cd1.
wa_object_id-class = wa_dms_ph_cd1-ph_class.
wa_object_id-objid = wa_dms_ph_cd1-phio_id.
CALL FUNCTION 'SDOK_PHIO_LOAD_CONTENT'
EXPORTING
object_id = wa_object_id
client = sy-mandt
TABLES
file_access_info = it_file_access_info
file_content_binary = it_sdokcntbin
EXCEPTIONS
not_existing = 1
not_authorized = 2
no_content = 3
bad_storage_type = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
READ TABLE it_file_access_info INTO wa_file_access_info INDEX 1.
IF wa_file_access_info-mimetype = 'application/msword'.
l_doc_type = 'DOC'.
CLEAR: a_xstring,len.
LOOP AT it_sdokcntbin INTO wa_sdokcntbin.
CONCATENATE a_xstring wa_sdokcntbin-line
INTO a_xstring IN BYTE MODE.
ENDLOOP.
len = XSTRLEN( a_xstring ).
transform to solix tab - adding additional attachments
REFRESH lt_solix.
lt_solix =
cl_document_bcs=>xstring_to_solix(
ip_xstring = a_xstring ).
CLEAR l_filename.
Get the file name
l_filename = wa_file_access_info-file_name.
bcs_doc1 = cl_document_bcs=>create_document(
i_type = l_doc_type
i_subject = l_filename
i_length = len
i_language = sy-langu
i_hex = lt_solix
*Type casting
obj_file ?= bcs_doc1.
Add Attachment as a document to the email object
CALL METHOD l_email_object->add_document_as_attachment
EXPORTING
im_document = obj_file.
for PDF document
ELSEIF wa_file_access_info-mimetype = 'application/pdf'.
l_doc_type = 'PDF'.
file_size = wa_file_access_info-file_size.
Convert the 1022 binary data to xstring
CLEAR a_xstring.
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
EXPORTING
input_length = file_size
IMPORTING
buffer = a_xstring
TABLES
binary_tab = it_sdokcntbin
EXCEPTIONS
failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
DATA: w_output_length TYPE i.
Convert Xstring to 255 RAW
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = a_xstring
IMPORTING
output_length = w_output_length
TABLES
binary_tab = lt_content_bin.
len = w_output_length.
CLEAR l_filename.
Get the file name
l_filename = wa_file_access_info-file_name.
bcs_doc1 = cl_document_bcs=>create_document(
i_type = l_doc_type
i_subject = l_filename
i_length = len
i_language = sy-langu
i_hex = lt_content_bin
type casting
obj_file ?= bcs_doc1.
Add Attachment as a document to the email object
CALL METHOD l_email_object->add_document_as_attachment
EXPORTING
im_document = obj_file.
for Excel Document
ELSEIF wa_file_access_info-mimetype = 'application/msexcel'.
l_doc_type = 'XLS'.
CLEAR: a_xstring,len.
LOOP AT it_sdokcntbin INTO wa_sdokcntbin.
CONCATENATE a_xstring wa_sdokcntbin-line
INTO a_xstring IN BYTE MODE.
ENDLOOP.
len = XSTRLEN( a_xstring ).
transform to solix tab - adding additional attachments
REFRESH lt_solix.
lt_solix =
cl_document_bcs=>xstring_to_solix(
ip_xstring = a_xstring ).
CLEAR l_filename.
Get the file name
l_filename = wa_file_access_info-file_name.
bcs_doc1 = cl_document_bcs=>create_document(
i_type = l_doc_type
i_subject = l_filename
i_length = len
i_language = sy-langu
i_hex = lt_solix
*Type casting
obj_file ?= bcs_doc1.
Add Attachment as a document to the email object
CALL METHOD l_email_object->add_document_as_attachment
EXPORTING
im_document = obj_file.
for text doxument
ELSEIF wa_file_access_info-mimetype = 'plain/text'.
l_doc_type = 'TXT'.
file_size = wa_file_access_info-file_size.
Get the file name
l_filename = wa_file_access_info-file_name.
CALL FUNCTION 'SCMS_BINARY_TO_TEXT'
EXPORTING
input_length = file_size
TABLES
binary_tab = it_sdokcntbin
text_tab = file_data
EXCEPTIONS
failed = 1
OTHERS = 2.
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 METHOD cl_document_bcs=>create_document
EXPORTING
i_type = l_doc_type
i_subject = l_filename
i_text = file_data
RECEIVING
result = bcs_doc1.
obj_file ?= bcs_doc1.
Add Attachment as a document to the email object
CALL METHOD l_email_object->add_document_as_attachment
EXPORTING
im_document = obj_file.
ENDIF.
CLEAR:it_file_access_info,it_sdokcntbin.
CLEAR:wa_object_id,wa_file_access_info,file_size.
ENDLOOP.
CALL METHOD send_request->set_document( l_email_object ).
*Get the address number for the vendor
SELECT SINGLE adrnr
FROM lfa1
INTO l_adrnr
WHERE lifnr = l_doc-xekko-lifnr.
MOVE l_adrnr TO l_addrno.
Get the Email Address for the vendor using address number
CALL FUNCTION 'ADDR_GET_REMOTE'
EXPORTING
addrnumber = l_addrno
TABLES
adsmtp = it_adsmtp
EXCEPTIONS
parameter_error = 1
address_not_exist = 2
internal_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
sender = cl_sapuser_bcs=>create( sy-uname ).
CALL METHOD send_request->set_sender
EXPORTING
i_sender = sender.
READ TABLE it_adsmtp INTO wa_adsmtp WITH KEY flg_nouse = 'X'.
IF sy-subrc = 0.
LOOP AT it_adsmtp INTO wa_adsmtp WHERE flg_nouse = 'X'.
CALL METHOD cl_cam_address_bcs=>create_internet_address
EXPORTING
i_address_string = wa_adsmtp-smtp_addr
RECEIVING
result = recipient.
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = 'X'.
ENDLOOP.
ELSE.
READ TABLE it_adsmtp INTO wa_adsmtp WITH KEY flgdefault = 'X'.
IF sy-subrc = 0.
CALL METHOD cl_cam_address_bcs=>create_internet_address
EXPORTING
i_address_string = wa_adsmtp-smtp_addr
RECEIVING
result = recipient.
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = 'X'.
ENDIF.
ENDIF.
CALL METHOD send_request->send(
EXPORTING
i_with_error_screen = 'X'
RECEIVING
result = l_sent_to_all ).
CATCH cx_bcs INTO bcs_exception.
WRITE: 'Fehler aufgetreten.'(001).
WRITE: 'Fehlertyp:'(002), bcs_exception->error_type.
EXIT.
ENDTRY.
ENDIF.
Maybe you are looking for
-
Firefox Crashes when opening PDF file with Acrobat 9.4 installed.
Everytime I attempt to open a PDF file, Firefox will crash. I have Adobe Reader 9.4 installled. This has been happening since 7/9/2010
-
OBIA data mismatch in EBS and OLAP
hi all, iam facing a situation in which in the date in OLAP end is coming different and the data in EBS end is coming different.So is it in the informatica mappings the error is coming or there is some other reason. Please help.
-
Hello All, Is there a way to schedule jobs to run M-F and skip Holidays without using a Factory Calendar or third party software? Thank you.
-
Cannot install Flash player 11 on Mac using 10.6.8
I have IOS 10.6.8. I had Flash player 10 installed but when trying to install FP 11 it asked me to uninstall the previous version. I did it. I have downloaded FP 11 but it does nothing! I cannot what you tube videos nor any other that plays using
-
Regarding Customer Service flow
Hi, Iam new to Customer Service Module, I want to know the flow of Customer Service 1. Whether Product produced from the factory will go outside as a Matl or Equipment, if it is a material why like pm module........f/l, equip, all there in CS. please