Send Smartform as Email body not PDF attachment
Hello Experts,
I have a requirement where I need to send Smartform as Email body and NOT as PDF attachment.
I have spool ID generated for the smartform, how can I send this spool in Email body rather than as an attachment.
Hi K C
Try this.. Get the OTF data from the SMARTFORM, use the OTF data and pass this to FM'CONVERT_OTF', and use the format as PDF.
Then use the resultant converted PDF data as attachment while calling the 'SO_NEW_DOCUMENT_ATT_SEND_API1' FM.
let us know if this works.
Thanks
Rajesh Chowdary
Similar Messages
-
Hi All!
I need to send a SmarForm by email as an email body.
The SmartForm is a simple plain text form.
Does someone know how to do it?
Regards,
Alejandro.hi,
try this link u will have two codes.
Email Body
even if u dont understand check this code.
Here is the code to send the Smartform to mail as PDF attachment.
REPORT ZTEST_PDF_MAIL.
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 = 'ZTEST'
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.
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
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.
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 = 'mail id'.
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'
COMMIT_WORK = '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.
IF SY-SUBRC 0.
WRITE:/ 'Error When Sending the File', SY-SUBRC.
ELSE.
WRITE:/ 'Mail sent'.
ENDIF.
If you want to send some text as Body of the Mail then follow this once
when u r callin the FM'SO_NEW_DOCUMENT_ATT_SEND_API1'.. points to remember
1.u have to pass the body of content in table CONTENTS_TXT(ia m using I_OBJBIN) (each line a record) then. suppose i have appended 11 records to the table CONTENTS_TXT .
2.PACKING_LIST(iam usign I_OBJPACK) table u ahve to append a redord as follows
I_OBJPACK-TRANSF_BIN = ' '.
I_OBJPACK-HEAD_START = 000000000000001.
I_OBJPACK-HEAD_NUM = 000000000000001.
I_OBJPACK-BODY_START = 000000000000002
I_OBJPACK-BODY_NUM = 000000000000010.
I_OBJPACK-DOC_TYPE = 'RAW'.
append I_OBJPACK-.
by the above code system treat the first line in table I_OBJBIN as header and the 2nd line to 10 lines tread as body.
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.
reward me ig helpful. -
FM to send an email with a PDF attachment
Hello All,
Please suggest me some FMs to send an email along with PDF attachment.
Thanks,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***********************
w_objhead TYPE soli_tab,
w_ctrlop TYPE ssfctrlop,
w_compop TYPE ssfcompop,
w_return TYPE ssfcrescl,
w_doc_chng TYPE sodocchgi1,
w_data TYPE sodocchgi1,
w_buffer TYPE string."To convert from 132 to 255
data: v_len_in TYPE sood-objlen,
v_len_out TYPE sood-objlen,
v_len_outn TYPE i,
v_lines_txt TYPE i,
v_lines_bin TYPE i.
start-of-selection.
w_ctrlop-getotf = gv_abaptrue.
w_ctrlop-no_dialog = gv_abaptrue.
w_compop-tdnoprev = gv_abaptrue.
PERFORM call_smartform.
PERFORM convert_to_otf_format.
PERFORM pdf_formatting.
PERFORM build_mail_format.
PERFORM send_mail.
form call_smartform.
DATA:fm_name TYPE rs38l_fnam.
DATA:formname TYPE tdsfname VALUE 'ZSD_CRM_PROFORMA_INVOICE_001'.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = formname
IMPORTING
fm_name = fm_name.
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 fm_name
EXPORTING
control_parameters = w_ctrlop
output_options = w_compop
user_settings = ' '
v_vbeln = v_vbeln
v_erdat = gv_dat
wa_custaddr = gw_zcustaddr
v_stceg = gw_kna1-stceg
v_total = gv_total
vbak = vbak
v_lifnr = gw_kna1-lifnr
vbrp = vbrp
v_head = gv_heading
v_taxtext = gv_text
v_tax = gv_tax
v_gtotal = gv_gtot
IMPORTING
job_output_info = w_return
TABLES
it_det = gt_items
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.
endform.
form convert_to_otf_format.
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.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
endform.
form pdf_formatting.
* Convert PDF from 132 to 255.
LOOP AT i_tline.
* Replacing space by ~
TRANSLATE i_tline USING ' ~'.
CONCATENATE w_buffer i_tline INTO w_buffer.
ENDLOOP.
* Replacing ~ by space
TRANSLATE w_buffer USING '~ '.
DO.
i_record = w_buffer.
* Appending 255 characters as a record
APPEND i_record.
SHIFT w_buffer LEFT BY 255 PLACES.
IF w_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
endform.
FORM build_mail_format .
DATA:lv_dash(1) TYPE c VALUE '-'.
DATA:lv_xtn(4) TYPE c VALUE '.pdf'.
CONSTANTS:lv_esacpe TYPE so_escape VALUE 'U'.
CONSTANTS:lv_so_obj_tp TYPE so_obj_tp VALUE 'PDF'.
CONSTANTS:lv_so_obj_tp1 TYPE so_obj_tp VALUE 'RAW'.
CONSTANTS:lv_so_obj_sns TYPE so_obj_sns VALUE 'F'.
* Get Email ID's
SELECT * INTO TABLE gt_address[] FROM adr6
WHERE addrnumber = gw_kna1-adrnr.
REFRESH:i_reclist,
i_objtxt,
i_objbin,
i_objpack.
CLEAR w_objhead.
* Object with PDF.
i_objbin[] = i_record[].
DESCRIBE TABLE i_objbin[] LINES v_lines_bin.
* Object with main text of the mail.
i_objtxt = text-002.
APPEND i_objtxt.
DESCRIBE TABLE i_objtxt LINES v_lines_txt.
* Document information.
w_doc_chng-obj_name = text-005.
w_doc_chng-expiry_dat = sy-datum + 10.
IF gw_flg = 'T'.
w_doc_chng-obj_descr = text-003.
ELSE.
w_doc_chng-obj_descr = text-004.
ENDIF.
CONCATENATE w_doc_chng-obj_descr lv_dash v_vbeln INTO w_doc_chng-obj_descr.
w_doc_chng-sensitivty = lv_so_obj_sns. "Functional object
w_doc_chng-doc_size = v_lines_txt * 255.
* Pack to main body as RAW.
* Obj. to be transported not in binary form
CLEAR i_objpack-transf_bin.
* Start line of object header in transport packet
i_objpack-head_start = 1.
* Number of lines of an object header in object packet
i_objpack-head_num = 0.
* Start line of object contents in an object packet
i_objpack-body_start = 1.
* Number of lines of the object contents in an object packet
i_objpack-body_num = v_lines_txt.
* Code for document class
i_objpack-doc_type = lv_so_obj_tp1.
APPEND i_objpack.
* Packing as PDF.
i_objpack-transf_bin = gv_abaptrue.
i_objpack-head_start = 1.
i_objpack-head_num = 1.
i_objpack-body_start = 1.
i_objpack-body_num = v_lines_bin.
i_objpack-doc_type = lv_so_obj_tp.
i_objpack-obj_name = text-005.
CONCATENATE w_doc_chng-obj_descr lv_xtn INTO i_objpack-obj_descr.
i_objpack-doc_size = v_lines_bin * 255.
APPEND i_objpack.
* Document information.
CLEAR i_reclist.
* e-mail receivers.
LOOP AT gt_address INTO gw_adr6.
i_reclist-receiver = gw_adr6-smtp_addr.
i_reclist-express = gv_abaptrue.
i_reclist-rec_type = lv_esacpe. "Internet address
APPEND i_reclist.
ENDLOOP.
endform.
FORM send_mail .
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = w_doc_chng
put_in_outbox = ' '
TABLES
packing_list = i_objpack[]
object_header = w_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.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
COMMIT WORK.
ENDFORM.
hi this is a program for sending smartform as pdf attachment.
make the necessary modifications in the OTF part and use it
Edited by: Keshu Thekkillam on Jul 10, 2009 7:17 PM
Edited by: Keshu Thekkillam on Jul 10, 2009 7:17 PM -
How to send smartform output in body of email?
Hi all ,
I have to send smartform output in body of email (not as an attachement in mail) .PLease help me in this regard.
Thanks,
Ananth S.Hi Ananth
See these threads.
[https://forums.sdn.sap.com/click.jspa?searchID=23497094&messageID=6889194]
[https://forums.sdn.sap.com/click.jspa?searchID=23497094&messageID=6861330]
[https://forums.sdn.sap.com/click.jspa?searchID=23497094&messageID=6855364]
Regards
Hareesh Menon -
Please help, I'm unable to send an email with a pdf attachment
We have Windows 8 Pro on the pc, I have been trying to send a pdf document that my husband needs to his work and no matter how I try to send it (either from reader or directly from my email with the attachment it just will not send. Can anyone please help?
No worries. But it is strange that you cannot even send email with a PDF attachment from Microsoft Mail. At this point, no PDF viewers (e.g. Microsoft Reader, Adobe Reader Touch) are involved because you are not viewing PDF files.
Instead of saying "It won't send", you need to describe exactly what you see on the screen for every step. Where does the problem start?
Step 1: Attaching a PDF file to new email in Microsoft Mail
Are you able to find the PDF file and attach it to new email?
Step 2: Sending email with a PDF attachment
What happens when you click the Send button? Does it hang forever? Does it show an error message? Could you confirm that you can send email with other type of attachments (e.g. text file, Word file) from Microsoft Mail from the same PC?
You can provide the details to Microsoft for troubleshooting.
Alternatively, you can try to send email with the PDF attachment from other accounts like Gmail (Google Mail) or Yahoo Mail via the web browser (Internet Explorer) interface.
Sometimes, rebooting your system solves "mysterious" problems, too.
Good luck! -
I get a weekly email with a PDF attachment and when I open it it's to large to print and I know of no way to shrink or resize the doc. It's created in M/S excel. Can anymore assist....TX
From: Test Screen Name [email protected]
Sent: Sunday, August 04, 2013 11:32 AM
To: gunner0490
Subject: I'm not able to open PDF files in Adobe Reader XI.
Re: I'm not able to open PDF files in Adobe Reader XI.
created by Test Screen Name <http://forums.adobe.com/people/TestScreenName> in Adobe Reader - View the full discussion <http://forums.adobe.com/message/5565198#5565198 -
Send smartforms via email using action profiles
hi,
i am trying to send smartforms via email using action profiles and i would like to know if anyone has any document or know any steps to do the same. i have created the smartform and i created the action in an action profile. i selected the option "Smartforms Mail". and i have mentioned my smartform in it.
I have previously worked with action profiles to trigger workflows which sent a mail. That was relatively easier as i could mention that the mail be sent to my mailbox. But in the smartforms option, i dont know how to give the instruction that it be sent to my mailbox.. is there any place i can set it? The action is not person dependant and is done whenever saving a document.
Please guide.
Thanks,
NishaHi Nisha,
As u worked on Action profiles, i recommend u use action profile with permitted Process type as Smart Forms Mail to send the mails which contains the data in Smartform u created.
Use below mail setting
Form Name (u r ZSmartform)
Processing Class CL_DOC_PROCESSING_CRM_ORDER
Processing Method CRM_ACTIVITY_EXEC_SMART_FORM
Archive Mode 1 Mail only User
In Action definition details u can mentioned the Processing time, Partner dependent for action to who u want to send the mail, further in action condition using schedule and start condition u can set the criteria to mail trigger.
Hope it'll help u.
Regards,
Dipesh. -
Sending SAP Script output as a PDF attachment through mail
Dear Guru,
I am using SAP 4.0B version, DATABASE Oracle 8i, OS is sun solaris 7.5.
I want to send SAP script output as a
PDF attachement through mail.Please suggest a solution.
Regards,
RajeshHi Rajesh,
In your print program, while calling OPEN_FORM, pass options-TDGETOTF = 'X'. This is used for returning print output in OTF format.
Then in CLOSE_FORM, get the table OTFDATA returned from the function module. for example
DATA: OTF_DATA LIKE ITCOO OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT = RESULT
TABLES
OTFDATA = OTF_DATA.
now you can convert this OTF data to PDF using function module CONVERT_OTF
Then send this data as attachment to a mail using function module SO_NEW_DOCUMENT_ATT_SEND_API1
Regards,
Komal. -
My MS outlook on the PC is sending two invites in the icloud calandar. How can I stop this? I ony want the email send with my email address not the apple email.
My phone is the 4. Not the 4s. And I went there but it's nowhere the option to delete from server.
I only see: ask before deleting and it's on. -
PAGES: Sending an exported .pdf in the body of email and NOT as attachment
Hello to all you MAC geniuses out there. I am using Pages to design flyers for my business. Then exporting them to a pdf file and trying to figure out how to send them in the BODY of an email and not an attachemnt that they have to open. Not really sure if this is a mail or pages question. It is probably a very simple step I am missing, but never the less can't seem to fiugre it out. Thanks in advance!
GennOk, so what do I do then? My Question is this. I am using Pages to create email flyers for my business. I have been Exporting them into a PDF File, but they as you say, send as attachements. I need to know how to send them in an email, as an email and not as an attachement.
What do I do to save and send them differently. I know it can be done since I get craploads of Junk mail everyday that look like that. Please help, I have a deadline to meet approaching very soon. Thanks!!!!!!!!!!!!!!! -
Sending smartform through email as PDF attachment
Hi,
I want to send a smartform through email as pdf attachment.In the code I have hardcoded the receiver mail id.But I don't want this to be sent only to a particular receiver.I want this to be sent as many people as I can without hardcoding their mail id's in the program.How can I do that?
Regards,
Hema**Data Declarations
**Internal Table
DATA : BEGIN OF it_spfli OCCURS 0,
carrid LIKE spfli-carrid,
connid LIKE spfli-connid,
END OF it_spfli.
DATA: it_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
it_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
storing receivers
it_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
**storing file attachment data
it_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE, gd_doc_data LIKE sodocchgi1,
gd_error TYPE sy-subrc,
l_gntxt LIKE t357g_t-gntxt,
lv_message(100) TYPE c.
DATA: it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE. "storing mail body
DATA : psubject(30) TYPE c VALUE 'Sample Mail'. "subject of the mail
DATA : ld_format TYPE so_obj_tp , "file format
ld_attfilename TYPE so_obj_des, "file name
w_cnt TYPE i.
**Selecting the data
SELECT carrid connid INTO TABLE it_spfli FROM spfli WHERE carrid EQ 'AA'.
**Perform for populating mail body
PERFORM populate_message.
**Perform for populating file attachment
PERFORM populate_attachment.
**Perform for populating mail characteristic info
PERFORM populate_pack.
**Perform for populating receivers
PERFORM populate_receivers.
**Perform to send mail
PERFORM send_mail.
*& Form populate_message
text
--> p1 text
<-- p2 text
FORM populate_message .
**Populating the body
lv_message = 'Sample mail for testing purpose.'.
APPEND lv_message TO it_message.
ENDFORM. " populate_message
*& Form populate_attachment
text
--> p1 text
<-- p2 text
FORM populate_attachment .
**Populating the attachment file with the data from final intenal table
CONCATENATE 'CARRIER ID'
'CONNECTION ID'
INTO it_attachment SEPARATED BY
cl_abap_char_utilities=>horizontal_tab.
CONCATENATE cl_abap_char_utilities=>cr_lf it_attachment INTO
it_attachment.
APPEND it_attachment.
LOOP AT it_spfli.
CONCATENATE it_spfli-carrid it_spfli-connid INTO it_attachment SEPARATED BY
cl_abap_char_utilities=>horizontal_tab.
CONCATENATE cl_abap_char_utilities=>cr_lf it_attachment INTO
it_attachment.
APPEND it_attachment.
ENDLOOP.
ENDFORM. " populate_attachment
*& Form populate_receivers
text
--> p1 text
<-- p2 text
FORM populate_receivers .
**Populating Mail Recepients
**If there are more than one mail recepient then loop and append them to it_receivers
it_receivers-receiver = '[email protected]'.
it_receivers-rec_type = 'U'.
it_receivers-com_type = 'INT'.
it_receivers-notif_del = 'X'.
it_receivers-notif_ndel = 'X'.
it_receivers-express = 'X'.
APPEND it_receivers.
ENDFORM. " populate_receivers
*& Form populate_pack
text
--> p1 text
<-- p2 text
FORM populate_pack .
**File Type
ld_format = 'XLS'.
**File Name
ld_attfilename = 'File1'.
Fill the document data.
gd_doc_data-doc_size = 1.
Populate the subject/generic message attributes
gd_doc_data-obj_langu = sy-langu.
gd_doc_data-obj_name = 'SAPRPT'.
gd_doc_data-obj_descr = psubject .
gd_doc_data-sensitivty = 'F'.
Fill the document data and get size of attachment
CLEAR gd_doc_data.
Populate the subject/generic message attributes
gd_doc_data-obj_langu = sy-langu.
READ TABLE it_attachment INDEX w_cnt.
gd_doc_data-doc_size = ( w_cnt - 1 ) * 255 + STRLEN( it_attachment ).
gd_doc_data-obj_name = 'SAPRPT'.
gd_doc_data-obj_descr = psubject.
gd_doc_data-sensitivty = 'F'.
Describe the body of the message
CLEAR it_packing_list.
REFRESH it_packing_list.
it_packing_list-transf_bin = space.
it_packing_list-head_start = 1.
it_packing_list-head_num = 0.
it_packing_list-body_start = 1.
DESCRIBE TABLE it_message LINES it_packing_list-body_num.
it_packing_list-doc_type = 'RAW'.
APPEND it_packing_list.
**Describe the attachment info
it_packing_list-transf_bin = 'X'.
it_packing_list-head_start = 1.
it_packing_list-head_num = 1.
it_packing_list-body_start = 1.
DESCRIBE TABLE it_attachment LINES it_packing_list-body_num.
it_packing_list-doc_type = ld_format.
it_packing_list-obj_name = ld_attfilename.
it_packing_list-obj_descr = ld_attfilename.
it_packing_list-doc_size = it_packing_list-body_num * 255.
APPEND it_packing_list.
ENDFORM. " populate_pack
*& Form send_mail
text
--> p1 text
<-- p2 text
FORM send_mail .
**Function Module to send mail
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = gd_doc_data
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = it_packing_list
contents_bin = it_attachment
contents_txt = it_message
receivers = it_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_mail -
BI Publisher how to make email body not be a attachment (message.txt)
I am using Oracle Business Intelligence Publisher Release 10.1.3.4 Part Number E12602-01 with OBIEE 10g. When I schedule a BI pub PDF report send via email, my text in "BODY" text area shows up as an attachment (message.txt) not in the email body. How can I solve this. We don't need bursting.
Thanks in advance!jordansydney wrote:
I have literally tried everything! read all the forums! I need an actual solution!
If everything has been tried, there is nothing more to try. Just give up.
Or Troubleshooting FaceTime and iMessage activation issues -
Sending Purchase Order by Email as an PDF Attachment.
Dear Experts,
I would like to make use of the Standard Functionality Provided by SAP to Send PO by Email. I Reffered to SAP note 191470. And made sure that everything is Done.
Now the Problem is We are getting the Mail. But There is no attachment to the Mail.
Anyone can give some light to this issue?
Regards,
Lijo Josephhi Lijo,
Check these below threads it might help you.
PDF form as email attachment for purchase order
To send PDF file as an email
Error opening the PDF file while sending the PDF as an attachment
unable to e-mail a pdf through FM 'SO_NEW_DOCUMENT_ATT_SEND_API1'
Hope this helps!
Cheers
Alfred -
I create a document in Print Shop Delux download pictures from that program to make a flyer. I'am trying to send the flyer to someone and they do not want it as an attachment so I'd like to send it in the body of the e-mail. They lettering on the flyer copy and paste but the picture will not copy and paste. How do I get the picture to copy and paste in the body of the e-mail. I can't copy and paste the whole document because in did a insert text box for the picture.
Click the image , hold your mouse button, drag it and bring it to Firefox window from task bar below and release it into the body of your e-mail.Works on Gmail, Yahoomail , Hotmail....May not work on other e-mail service providers.
-
Email Smartforms with Email Body
Hello SAP Community,
Sorry if my question has been asked before, but I did not find any answeres yet.
I am using BO SOFMFOL and these FM to send my smartforms to external email:
- CREATE_RECIPIENT_OBJ_PPF
- CREATE_SENDER_OBJECT_PPF
- SO_USER_AUTOMATIC_INSERT
This is working fine. My question is: How do you add an Email Body? I am on ECC 6.0.
Appreciate any inputs on this issue.
Many thanks,
KimHi Kim,
I had a requirement to convert the out put into PDF format and send an email using the function module SO_NEW_DOCUMENT_ATT_SEND_API1.
I am providing my coding, hope it helps:
form SEND_EMAIL .
DATA: t_mailpack TYPE sopcklsti1 OCCURS 0 WITH HEADER LINE,
t_mailhead TYPE solisti1 OCCURS 0 WITH HEADER LINE,
t_mailbin TYPE solisti1 OCCURS 0 WITH HEADER LINE,
t_mailtxt TYPE solisti1 OCCURS 0 WITH HEADER LINE,
t_mailrec TYPE somlreci1 OCCURS 0 WITH HEADER LINE.
DATA: wa_maildata TYPE sodocchgi1,
l_filename(50) TYPE c,
l_fldname(30) TYPE c,
l_fldval(100) TYPE c,
l_lines TYPE i,
l_text TYPE text128 .
DATA: w_email_subrc TYPE i.
DATA: w_ship like vbfa-vbeln.
CLEAR: wa_maildata,
t_mailtxt,
t_mailbin,
t_mailpack,
t_mailhead,
t_mailrec.
REFRESH: t_mailtxt,
t_mailbin,
t_mailpack,
t_mailhead,
t_mailrec.
*-- Fill output file
*- Fill header
CLEAR: t_mailbin.
t_mailbin[] = pdf_tab[].
t_mailbin[] = it_att[]. "Uthaman
*This line is added to get the shipment no in Subject Line
SELECT SINGLE * FROM vbfa WHERE vbelv EQ nast-objky
AND vbtyp_v EQ c_vbtyp_v_j
AND vbtyp_n EQ c_vbtyp_n_8.
w_ship = vbfa-vbeln.
shift w_ship left deleting leading '0'.
*-- File name
if nast-kschl EQ 'ZFPL'.
CLEAR l_filename.
CONCATENATE 'Packing List -'
sy-datum4(2) sy-datum6(2) sy-datum(4) '.PDF' INTO l_filename.
*-- Creation of the document to be sent File Name
wa_maildata-obj_name = 'Packing List'.
*-- Mail Subject
CONCATENATE l_filename '-' 'Shipment No -' w_ship INTO wa_maildata-obj_descr SEPARATED BY space.
*-- Mail Contents
t_mailtxt-line = 'Packing List'.
APPEND t_mailtxt.
ENDIF.
if nast-kschl EQ 'ZFBA'.
CLEAR l_filename.
CONCATENATE 'Booking Advice -'
sy-datum4(2) sy-datum6(2) sy-datum(4) '.PDF'
INTO l_filename.
*-- Creation of the document to be sent File Name
wa_maildata-obj_name = 'Booking Advice'.
*-- Mail Subject
CONCATENATE l_filename '-' 'Shipment No -' w_ship INTO wa_maildata-obj_descr SEPARATED BY space.
*-- Mail Contents
t_mailtxt-line = 'Packing List'.
APPEND t_mailtxt.
ENDIF.
*-- Prepare Packing List
*-- Write Packing List (Main Subject)
CLEAR: l_lines, t_mailpack.
DESCRIBE TABLE t_mailtxt LINES l_lines.
READ TABLE t_mailtxt INDEX l_lines.
t_mailpack-doc_size = ( l_lines - 1 ) * 255 + STRLEN( t_mailtxt ).
CLEAR t_mailpack-transf_bin.
t_mailpack-transf_bin = ' '.
t_mailpack-head_start = 1.
t_mailpack-head_num = 0.
t_mailpack-body_start = 1.
t_mailpack-body_num = l_lines.
t_mailpack-doc_type = 'RAW'.
APPEND t_mailpack.
t_mailhead = l_filename.
APPEND t_mailhead.
*-- Write Packing List (Attachment)
CLEAR: l_lines, t_mailpack.
DESCRIBE TABLE pdf_tab[] LINES l_lines.
READ TABLE pdf_tab INDEX l_lines.
t_mailpack-doc_size = ( l_lines - 1 ) * 255 + STRLEN( t_mailbin ).
t_mailpack-transf_bin = 'X'.
t_mailpack-head_start = 1.
t_mailpack-head_num = 1.
t_mailpack-body_start = 1.
t_mailpack-body_num = l_lines.
t_mailpack-doc_type = 'PDF'.
t_mailpack-obj_name = l_filename.
t_mailpack-obj_descr = l_filename.
t_mailpack-obj_langu = 'E'.
APPEND t_mailpack.
*-- Set recipients
tables : ztotcemail.
SELECT SINGLE * FROM vbfa WHERE vbelv EQ nast-objky
AND vbtyp_v EQ c_vbtyp_v_j
AND vbtyp_n EQ c_vbtyp_n_8.
CLEAR vttk.
SELECT SINGLE * FROM vttk WHERE tknum EQ vbfa-vbeln.
SELECT SINGLE * FROM ztotcemail WHERE tplst = vttk-tplst
AND lifnr = vttk-tdlnr.
IF SY-SUBRC EQ 0.
t_mailrec-receiver = ztotcemail-smtp_addr. .
t_mailrec-rec_type = 'U'.
APPEND t_mailrec.
ENDIF.
**-- Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = wa_maildata
put_in_outbox = 'X'
commit_work = 'X' " N-16
TABLES
packing_list = t_mailpack
object_header = t_mailhead
contents_bin = t_mailbin[]
contents_txt = t_mailtxt[]
receivers = t_mailrec
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
OTHERS = 99.
w_email_subrc = sy-subrc.
IF sy-subrc EQ 0.
MESSAGE s000(zotc) WITH 'Email output sent successfully'.
ELSE.
MESSAGE s000(zotc) WITH 'Can not send email output'.
ENDIF.
endform. " SEND_EMAIL
Regards,
Kittu
Maybe you are looking for
-
When trying to launch iTunes on my PC running Windows 7 it freezes and I get the message: "Authentication Required. To access this site you need to log in to area "100656 on mellor.co. Your password will be sent in the clear." Because iTunes is frize
-
Does a connector from the Solo 15 to MacBook Pro exist?
Is anyone familiar with the Solo 15 from Brunton? If so can you let me know if an appropriate connector for a MacBook Pro exist? I've been trying for years to connect my Mac to Brunton's SolarRolls without any success. Now I'm thinking of getting Bru
-
Set system time in both unix and NT
i need to write a software to be run on the 2 platforms to set the system time if anyone know how to go about doing it please guide me along and provide me some code. thanks in advance
-
On a long trip, I would download the photos from my camera to my iPad in Photo. I have done this for years. In the process, I would tell Photo not to load the duplicates. Since I updated to iOS 7, Photo is now loading duplicates from my SD card ig
-
Upgrade during evaluation period?
Hi all, I have installed 2007 A at a client site (they have not gone live yet). I was wondering if it was possible to upgrade this cust to latest patch during evaluation period. They do not have a license yet. Thanks for any info. John