How to send dms document as email attachemnt
Dear Techies
Can you share the code to send the dms document as an email attachment through abap program.
Thanks in advance.
regards
Omer Humayun
Hi Omer,
Please have a look into SCN document http://wiki.scn.sap.com/wiki/display/Snippets/DMS+Document+send+as+email+attachment
Send DMS Document Attachments in Mail
Hope this helps.
Regards,
Deepak Kori
Similar Messages
-
How To send DMS(Documents cv01,cv03n,cv04n) from one sap system to othersap
Hello Experts,
I am working Document management system(CV01,cv02n,cv03n,cv04n)...
I want to send the documents from one SAP system to Other SAP system
Using ALE/Idocs....
Please Help on this any sample programs....or function module....
Thanks
PreethiHello,
Please refer to the thread:
How To send DMS(Documents cv01,cv03n,cv04n) from one sap system to othersap
Best Regards, Murugesh AS -
how to send active links in email from firefox. Works in IE but not Firefox... Is there a setting to change?
== This happened ==
Every time Firefox opened
== AlwaysCheck with your web mail service provider for help with that issue.
-
How to send a delayed notification email?
How to send a delayed notification email?
I have a requirement to send an email to the service requestor 2 days after the main fulfillment task is completed. I know I can create a task that auto-completes using the Dummy adapter, but is there a way to make it auto complete after a certain amount of time has elapsed? I was thinking about creating a second fulfillment task that would send this email upon completion, but I can't figure out how to delay its start or its end.Hi Tylor,
James is onto a potential approach here. However, the only way I know of that could work is to use the Scheduled Start feature. This would require that you compute/project the start date of the auto-complete task before the delivery moment begins.
You would need to do a date calculation and then store the projected date in a hidden field. You could then have your auto-complete task fire on that computed date, using the Scheduled Start feature.
The wrinkle here, of course, is t -
How to send active links in email from firefox
how to send active links in email from firefox. Works in IE but not Firefox... Is there a setting to change?
== Operating system ==
Windows 7Check with your web mail service provider for help with that issue.
-
How to send puchase report in email ?
how to send puchase report in email ?
Search SCN, you will get lot of post for this.
Here is an example.
http://scn.sap.com/thread/321890 -
How to: Send any document using mail via "Right click"
Hello-
Does anyone know how to send a document, whether it is a Word, Eccel, Pages doc, etc. via a "Right Click" or similiar key stroke as we can on a WinPC? I am certain it is possible, and the closest commandIi have found is the "Services:Mail" drop down which is seemingly useless (i.e. I do not know how to make use of it). Any suggestions are appreciated. Thx
MacBookPro 15" Mac OS X (10.4.6)thexr6,
Welcome to Apple Discussions.
Try this if you want to add an attachment to a new mail message:
1. Open Automator.
2. In the Library column, click on Mail.
3. In the Action column, double click on New Mail Message.
3. In the Action column, double click on Add Attachments to Front Message.
4. In Automator>File>Save As Plug-In...>Save Plug-in As: (Type your desired name here) Plug-in for: Finder>(Save)
Right click on the file you wish to attach and select Automator>(your desired name).
If you know where you actually want to send the message, enter the specific information required in step 3, and add/select "Send Outgoing Messages" after step 3.
;~) -
I cannot use "share" on Pages to send a document via email. I used to be able to do this. Not sure what I have done. Can anyone help me out?
No. iDisk service is not available in iCloud. There are other third-party services like Picassa, MediaFire, Photobucket, Tumblr.
Basic Information About Moving From MobileMe to iCloud
Apple IDs and iCloud
Creating an iCloud account- Frequently Asked Questions
Frequently asked questions about the MobileMe transition and iCloud
MobileMe services that no longer sync after moving to iCloud
MobileMe- About moving to iCloud -
How to send .CSV file via email in Oracle10g/11g PL/SQL
Hi Guys,
Can any one let me know or suggest me how to send .csv file via email attachment using Oracle PL/SQL.
Thanks in advance!
Regards,
LRKA FAQ. Use UTL_MAIL (if attachment is 32KB less). Else use UTL_SMTP. Search this forum. Search using google.
-
could someone please tell me how to attach a document to email as an icon that opens....so it does not appear as text in the email??
Paste this into Terminal and hit return. If this attachment is text, it should work. Not sure about jpegs.
defaults write com.apple.mail DisableInlineAttachmentViewing 1
To reverse the setting, change the 1 to a 0. -
How to send a document from pages in email
Can u send a document from pages in email that can be opened by a PC.
Ourdream wrote:
even if I dont have word it can be sent as word?
Yes, try Share > Send Via Mail -
How to send PDF attachment through Email For Purchase Order
Hi,
Can you please tell me how to send the Purchase Order with PDF attachment. Thank you.
Thanks & Regards,
Rani.Find the below example
*& Report ZSPOOLTOPDF *
*& Converts spool request into PDF document and emails it to *
*& recipicant. *
*& Execution *
*& This program must be run as a background job in-order for the write *
*& commands to create a Spool request rather than be displayed on *
*& screen *
REPORT zspooltopdf.
PARAMETER: p_email1 LIKE somlreci1-receiver
DEFAULT '[email protected]',
p_sender LIKE somlreci1-receiver
DEFAULT '[email protected]',
p_delspl AS CHECKBOX.
*DATA DECLARATION
DATA: gd_recsize TYPE i.
Spool IDs
TYPES: BEGIN OF t_tbtcp.
INCLUDE STRUCTURE tbtcp.
TYPES: END OF t_tbtcp.
DATA: it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0,
wa_tbtcp TYPE t_tbtcp.
Job Runtime Parameters
DATA: gd_eventid LIKE tbtcm-eventid,
gd_eventparm LIKE tbtcm-eventparm,
gd_external_program_active LIKE tbtcm-xpgactive,
gd_jobcount LIKE tbtcm-jobcount,
gd_jobname LIKE tbtcm-jobname,
gd_stepcount LIKE tbtcm-stepcount,
gd_error TYPE sy-subrc,
gd_reciever TYPE sy-subrc.
DATA: w_recsize TYPE i.
DATA: gd_subject LIKE sodocchgi1-obj_descr,
it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
gd_sender_type LIKE soextreci1-adr_typ,
gd_attachment_desc TYPE so_obj_nam,
gd_attachment_name TYPE so_obj_des.
Spool to PDF conversions
DATA: gd_spool_nr LIKE tsp01-rqident,
gd_destination LIKE rlgrap-filename,
gd_bytecount LIKE tst01-dsize,
gd_buffer TYPE string.
Binary store for PDF
DATA: BEGIN OF it_pdf_output OCCURS 0.
INCLUDE STRUCTURE tline.
DATA: END OF it_pdf_output.
CONSTANTS: c_dev LIKE sy-sysid VALUE 'DEV',
c_no(1) TYPE c VALUE ' ',
c_device(4) TYPE c VALUE 'LOCL'.
*START-OF-SELECTION.
START-OF-SELECTION.
Write statement to represent report output. Spool request is created
if write statement is executed in background. This could also be an
ALV grid which would be converted to PDF without any extra effort
WRITE 'Hello World'.
new-page.
commit work.
new-page print off.
IF sy-batch EQ 'X'.
PERFORM get_job_details.
PERFORM obtain_spool_id.
Alternative way could be to submit another program and store spool
id into memory, will be stored in sy-spono.
*submit ZSPOOLTOPDF2
to sap-spool
spool parameters %_print
archive parameters %_print
without spool dynpro
and return.
Get spool id from program called above
IMPORT w_spool_nr FROM MEMORY ID 'SPOOLTOPDF'.
PERFORM convert_spool_to_pdf.
PERFORM process_email.
if p_delspl EQ 'X'.
PERFORM delete_spool.
endif.
IF sy-sysid = c_dev.
wait up to 5 seconds.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
AND RETURN.
ENDIF.
ELSE.
SKIP.
WRITE:/ 'Program must be executed in background in-order for spool',
'request to be created.'.
ENDIF.
FORM obtain_spool_id *
FORM obtain_spool_id.
CHECK NOT ( gd_jobname IS INITIAL ).
CHECK NOT ( gd_jobcount IS INITIAL ).
SELECT * FROM tbtcp
INTO TABLE it_tbtcp
WHERE jobname = gd_jobname
AND jobcount = gd_jobcount
AND stepcount = gd_stepcount
AND listident <> '0000000000'
ORDER BY jobname
jobcount
stepcount.
READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
IF sy-subrc = 0.
message s004(zdd) with gd_spool_nr.
gd_spool_nr = wa_tbtcp-listident.
MESSAGE s004(zdd) WITH gd_spool_nr.
ELSE.
MESSAGE s005(zdd).
ENDIF.
ENDFORM.
FORM get_job_details *
FORM get_job_details.
Get current job details
CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
IMPORTING
eventid = gd_eventid
eventparm = gd_eventparm
external_program_active = gd_external_program_active
jobcount = gd_jobcount
jobname = gd_jobname
stepcount = gd_stepcount
EXCEPTIONS
no_runtime_info = 1
OTHERS = 2.
ENDFORM.
FORM convert_spool_to_pdf *
FORM convert_spool_to_pdf.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = gd_spool_nr
no_dialog = c_no
dst_device = c_device
IMPORTING
pdf_bytecount = gd_bytecount
TABLES
pdf = it_pdf_output
EXCEPTIONS
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
OTHERS = 12.
CHECK sy-subrc = 0.
Transfer the 132-long strings to 255-long strings
LOOP AT it_pdf_output.
TRANSLATE it_pdf_output USING ' ~'.
CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
ENDLOOP.
TRANSLATE gd_buffer USING '~ '.
DO.
it_mess_att = gd_buffer.
APPEND it_mess_att.
SHIFT gd_buffer LEFT BY 255 PLACES.
IF gd_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
ENDFORM.
FORM process_email *
FORM process_email.
DESCRIBE TABLE it_mess_att LINES gd_recsize.
CHECK gd_recsize > 0.
PERFORM send_email USING p_email1.
perform send_email using p_email2.
ENDFORM.
FORM send_email *
--> p_email *
FORM send_email USING p_email.
CHECK NOT ( p_email IS INITIAL ).
REFRESH it_mess_bod.
Default subject matter
gd_subject = 'Subject'.
gd_attachment_desc = 'Attachname'.
CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
it_mess_bod = 'Message Body text, line 1'.
APPEND it_mess_bod.
it_mess_bod = 'Message Body text, line 2...'.
APPEND it_mess_bod.
If no sender specified - default blank
IF p_sender EQ space.
gd_sender_type = space.
ELSE.
gd_sender_type = 'INT'.
ENDIF.
Send file by email as .xls speadsheet
PERFORM send_file_as_email_attachment
tables it_mess_bod
it_mess_att
using p_email
'Example .xls documnet attachment'
'PDF'
gd_attachment_name
gd_attachment_desc
p_sender
gd_sender_type
changing gd_error
gd_reciever.
ENDFORM.
FORM delete_spool *
FORM delete_spool.
DATA: ld_spool_nr TYPE tsp01_sp0r-rqid_char.
ld_spool_nr = gd_spool_nr.
CHECK p_delspl <> c_no.
CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
EXPORTING
spoolid = ld_spool_nr.
ENDFORM.
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
Send email
FORM send_file_as_email_attachment tables it_message
it_attach
using p_email
p_mtitle
p_format
p_filename
p_attdescription
p_sender_address
p_sender_addres_type
changing p_error
p_reciever.
DATA: ld_error TYPE sy-subrc,
ld_reciever TYPE sy-subrc,
ld_mtitle LIKE sodocchgi1-obj_descr,
ld_email LIKE somlreci1-receiver,
ld_format TYPE so_obj_tp ,
ld_attdescription TYPE so_obj_nam ,
ld_attfilename TYPE so_obj_des ,
ld_sender_address LIKE soextreci1-receiver,
ld_sender_address_type LIKE soextreci1-adr_typ,
ld_receiver LIKE sy-subrc.
data: t_packing_list like sopcklsti1 occurs 0 with header line,
t_contents like solisti1 occurs 0 with header line,
t_receivers like somlreci1 occurs 0 with header line,
t_attachment like solisti1 occurs 0 with header line,
t_object_header like solisti1 occurs 0 with header line,
w_cnt type i,
w_sent_all(1) type c,
w_doc_data like sodocchgi1.
ld_email = p_email.
ld_mtitle = p_mtitle.
ld_format = p_format.
ld_attdescription = p_attdescription.
ld_attfilename = p_filename.
ld_sender_address = p_sender_address.
ld_sender_address_type = p_sender_addres_type.
Fill the document data.
w_doc_data-doc_size = 1.
Populate the subject/generic message attributes
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle .
w_doc_data-sensitivty = 'F'.
Fill the document data and get size of attachment
CLEAR w_doc_data.
READ TABLE it_attach INDEX w_cnt.
w_doc_data-doc_size =
( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle.
w_doc_data-sensitivty = 'F'.
CLEAR t_attachment.
REFRESH t_attachment.
t_attachment[] = it_attach[].
Describe the body of the message
CLEAR t_packing_list.
REFRESH t_packing_list.
t_packing_list-transf_bin = space.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = 1.
DESCRIBE TABLE it_message LINES t_packing_list-body_num.
t_packing_list-doc_type = 'RAW'.
APPEND t_packing_list.
Create attachment notification
t_packing_list-transf_bin = 'X'.
t_packing_list-head_start = 1.
t_packing_list-head_num = 1.
t_packing_list-body_start = 1.
DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
t_packing_list-doc_type = ld_format.
t_packing_list-obj_descr = ld_attdescription.
t_packing_list-obj_name = ld_attfilename.
t_packing_list-doc_size = t_packing_list-body_num * 255.
APPEND t_packing_list.
Add the recipients email address
CLEAR t_receivers.
REFRESH t_receivers.
t_receivers-receiver = ld_email.
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
APPEND t_receivers.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_data
put_in_outbox = 'X'
sender_address = ld_sender_address
sender_address_type = ld_sender_address_type
commit_work = 'X'
IMPORTING
sent_to_all = w_sent_all
TABLES
packing_list = t_packing_list
contents_bin = t_attachment
contents_txt = it_message
receivers = t_receivers
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
Populate zerror return code
ld_error = sy-subrc.
Populate zreceiver return code
LOOP AT t_receivers.
ld_receiver = t_receivers-retrn_code.
ENDLOOP.
ENDFORM.
Reward if helpful.
Thanks,
Kishore S N -
Sending DMS Document as Attachment thru e-mail
Hi,
I am attaching the DMS document in purchase order & I am sending the PO thru email to vendor.But while doing so the attached document shuld be sent as attachment But in my present config setting it is not doing so.
Pl suggest
RgdsHi,
With my solution you will be able to send the PO and all link document in a mail at the same time you print it.
First Step
Create a new message with transaction NACE , this message will use support 8 ( external program) . The print program should be a copy the same as for printing your PO but add a new form entry inside.
Second step .
In the print program , create the new form entry and add the code . bellow a sample code i wrote . Some object are specific so you have to create it . If you need i can give you te detail of thoses objects.
DATA : bin_file TYPE xstring ,
bin_filesize TYPE i ,
w_objky TYPE objky,
my_sender TYPE zcl_send_mail=>ty_sender,
mail_line TYPE LINE OF soli_tab,
w_attsub TYPE so_obj_des.
DATA: l_druvo TYPE t166k-druvo,
l_nast TYPE nast,
l_from_memory,
l_doc TYPE meein_purchase_doc_print.
DATA : v_parvw2 TYPE nast-parvw,
v_parnr2 TYPE nast-parnr,
v_lifnr TYPE konv-lifnr,
v_adrnr TYPE lfa1-adrnr,
st_address TYPE addr1_sel,
st_sadr TYPE sadr.
* definition des tables internes
DATA : it_otf TYPE STANDARD TABLE OF itcoo ,
it_line TYPE STANDARD TABLE OF tline ,
it_fill TYPE STANDARD TABLE OF drad,
it_new TYPE STANDARD TABLE OF drad ,
itb_xtkomv TYPE STANDARD TABLE OF komv WITH HEADER LINE,
itb_xekpo TYPE STANDARD TABLE OF ekpo WITH HEADER LINE,
it_ekpo TYPE HASHED TABLE OF ekpo WITH UNIQUE KEY ebeln ebelp ,
it_draw TYPE HASHED TABLE OF draw WITH UNIQUE KEY dokar
doknr
dokvr
doktl ,
it_drat TYPE HASHED TABLE OF drat WITH UNIQUE KEY dokar
doknr
dokvr
doktl
langu,
my_attachement_list TYPE zcl_send_mail=>attachement_list,
my_recipient_list TYPE zcl_send_mail=>recipient_list ,
it_hexa TYPE solix_tab ,
it_body TYPE soli_tab.
CONSTANTS : c_object TYPE dokob VALUE 'EKPO' .
FIELD-SYMBOLS : <ekpo> TYPE ekpo,
<drad> TYPE drad ,
<draw> TYPE draw,
<drat> TYPE drat .
DATA : my_mail TYPE REF TO zcl_send_mail . => Specific object
** Here write your own code like you print the PO form in order to be able to retrieve it from memory
** don't send it to the printer only in spool .
* Get OTF from Memory.
CALL FUNCTION 'READ_OTF_FROM_MEMORY'
EXPORTING
memory_key = nast-objky
TABLES
otf = it_otf
EXCEPTIONS
memory_empty = 1.
CHECK sy-subrc EQ 0.
* Transform OTF into PDF
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
IMPORTING
bin_filesize = bin_filesize
bin_file = bin_file
TABLES
otf = it_otf
lines = it_line
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
err_bad_otf = 4.
* Transform PDF as Binary Table
it_hexa = cl_document_bcs=>xstring_to_solix( ip_xstring = bin_file ).
* Add PO as PDF file to the mail
zcl_send_mail=>add_attachement_to_list(
EXPORTING
type = 'PDF'
subject = 'PO'
content_hexa = it_hexa
CHANGING
attachement_list = my_attachement_list
EXCEPTIONS
no_content_for_attachement = 1
no_application_type = 2 ).
* Get PO Item because DIR are link to item only.
SELECT * FROM ekpo
APPENDING CORRESPONDING FIELDS OF TABLE it_ekpo
WHERE ebeln = nast-objky.
* Search for DIR .
FREE : it_draw , it_drat .
LOOP AT it_ekpo ASSIGNING <ekpo>.
FREE : it_fill , it_new.
CONCATENATE <ekpo>-ebeln <ekpo>-ebelp INTO w_objky.
CALL FUNCTION 'CV140_SELECT_DRAD_DOCUMENTS'
EXPORTING
pf_key = w_objky
pf_object = c_object
TABLES
pt_fill_drad = it_fill
pt_new_drad = it_new
EXCEPTIONS
no_document = 1.
* For each DIR , retrieve physical content
LOOP AT it_fill ASSIGNING <drad>.
IF <draw> IS ASSIGNED.
UNASSIGN <draw>.
ENDIF.
READ TABLE it_draw ASSIGNING <draw>
WITH TABLE KEY dokar = <drad>-dokar
doknr = <drad>-doknr
dokvr = <drad>-dokvr
doktl = <drad>-doktl.
IF NOT <draw> IS ASSIGNED.
SELECT * FROM draw
APPENDING CORRESPONDING FIELDS OF TABLE it_draw
WHERE dokar = <drad>-dokar
AND doknr = <drad>-doknr
AND dokvr = <drad>-dokvr
AND doktl = <drad>-doktl.
SELECT * FROM drat
APPENDING CORRESPONDING FIELDS OF TABLE it_drat
WHERE dokar = <drad>-dokar
AND doknr = <drad>-doknr
AND dokvr = <drad>-dokvr
AND doktl = <drad>-doktl
AND langu = sy-langu.
READ TABLE it_draw ASSIGNING <draw>
WITH TABLE KEY dokar = <drad>-dokar
doknr = <drad>-doknr
dokvr = <drad>-dokvr
doktl = <drad>-doktl.
ENDIF.
CHECK <draw> IS ASSIGNED.
READ TABLE it_drat ASSIGNING <drat>
WITH TABLE KEY dokar = <drad>-dokar
doknr = <drad>-doknr
dokvr = <drad>-dokvr
doktl = <drad>-doktl
langu = sy-langu.
IF <drat> IS ASSIGNED.
w_attsub = <drat>-dktxt.
ELSE.
CONCATENATE <drad>-dokar <drad>-doknr <drad>-dokvr <drad>-doktl
INTO w_attsub SEPARATED BY '/'.
ENDIF.
PERFORM add_fid_to_attachement USING <draw>
w_attsub
CHANGING my_attachement_list.
CHECK <drat> IS ASSIGNED.
UNASSIGN <drat>.
ENDLOOP.
LOOP AT it_new ASSIGNING <drad>.
IF <draw> IS ASSIGNED.
UNASSIGN <draw>.
ENDIF.
READ TABLE it_draw ASSIGNING <draw>
WITH TABLE KEY dokar = <drad>-dokar
doknr = <drad>-doknr
dokvr = <drad>-dokvr
doktl = <drad>-doktl.
IF NOT <draw> IS ASSIGNED.
SELECT * FROM draw
APPENDING CORRESPONDING FIELDS OF TABLE it_draw
WHERE dokar = <drad>-dokar
AND doknr = <drad>-doknr
AND dokvr = <drad>-dokvr
AND doktl = <drad>-doktl.
SELECT * FROM drat
APPENDING CORRESPONDING FIELDS OF TABLE it_drat
WHERE dokar = <drad>-dokar
AND doknr = <drad>-doknr
AND dokvr = <drad>-dokvr
AND doktl = <drad>-doktl
AND langu = sy-langu.
READ TABLE it_draw ASSIGNING <draw>
WITH TABLE KEY dokar = <drad>-dokar
doknr = <drad>-doknr
dokvr = <drad>-dokvr
doktl = <drad>-doktl.
ENDIF.
CHECK <draw> IS ASSIGNED.
READ TABLE it_drat ASSIGNING <drat>
WITH TABLE KEY dokar = <drad>-dokar
doknr = <drad>-doknr
dokvr = <drad>-dokvr
doktl = <drad>-doktl
langu = sy-langu.
IF <drat> IS ASSIGNED.
w_attsub = <drat>-dktxt.
ELSE.
CONCATENATE <drad>-dokar <drad>-doknr <drad>-dokvr <drad>-doktl
INTO w_attsub SEPARATED BY '/'.
ENDIF.
PERFORM add_fid_to_attachement USING <draw>
w_attsub
CHANGING my_attachement_list.
CHECK <drat> IS ASSIGNED.
UNASSIGN <drat>.
ENDLOOP.
ENDLOOP.
* Send mail to PO creator
* Sender
my_sender-mail = '****' . => Set the sender mail adress
* Add Recipient
zcl_send_mail=>add_recipient_to_list(
EXPORTING
uname = sy-uname
CHANGING
recipient_list = my_recipient_list
EXCEPTIONS
no_recipient_to_add = 1 ).
* Mail body
mail_line = 'PO by mail with Attachment'.
APPEND mail_line TO it_body.
* Create send request
CREATE OBJECT my_mail.
* Send Mail
my_mail->send_mail(
sender = my_sender
mail_subject = 'E-mail PO'
mail_body = it_body
recipient_list = my_recipient_list
attachement_list = my_attachement_list ).
Bellow the code for the routine ADD_FID_TO_ATTACHEMENT
DATA : w_cout TYPE dms_checkout_def,
w_dttrg TYPE dttrg, "Name of data carrier
w_docfile TYPE dms_doc_file,
w_dappl TYPE dappl, "Application
w_tabix TYPE i ,
w_tdwa TYPE tdwa ,
w_phio TYPE dms_phio,
w_frontend TYPE dms_frontend_data.
DATA : it_drao TYPE STANDARD TABLE OF drao WITH HEADER LINE,
it_kpro TYPE dms_tbl_file .
CONSTANTS : "c_print_option TYPE apptp VALUE '3', "Print option
c_hostname TYPE ntadr VALUE 'DEFAULT', "Hostname
c_type TYPE typdt VALUE 'PC', "Type
c_system TYPE char4 VALUE 'WN32'. "System
FIELD-SYMBOLS : <kpro> TYPE LINE OF dms_tbl_file,
<phio> TYPE LINE OF dms_tbl_phio .
CLEAR : w_tdwa .
* Check if for DIR type KPRO is used
CALL FUNCTION 'CV200_DB_TDWA_SELECT'
EXPORTING
pf_dokar = in_draw-dokar
IMPORTING
psx_tdwa = w_tdwa
EXCEPTIONS
not_found = 1.
w_frontend-frontend_type = c_type. "'PC'.
w_frontend-hostname = c_hostname. "'DEFAULT'.
w_frontend-winsys = c_system. "'WN32'.
w_frontend-platform = 0.
w_cout-comp_get = abap_true.
w_cout-kpro_use = w_tdwa-kpro_use.
w_cout-batchmode = abap_true.
w_cout-content_provide = 'TBL'.
CALL FUNCTION 'CV120_KPRO_MASTER_DATA_GET'
EXPORTING
pf_dokar = in_draw-dokar
pf_doknr = in_draw-doknr
pf_dokvr = in_draw-dokvr
pf_doktl = in_draw-doktl
TABLES
ptx_data = it_kpro
EXCEPTIONS
not_found = 1
error = 2.
CASE w_tdwa-kpro_use.
WHEN abap_true.
CALL FUNCTION 'CV120_KPRO_MASTER_DATA_GET'
EXPORTING
pf_dokar = in_draw-dokar
pf_doknr = in_draw-doknr
pf_dokvr = in_draw-dokvr
pf_doktl = in_draw-doktl
TABLES
ptx_data = it_kpro
EXCEPTIONS
not_found = 1
error = 2.
w_frontend-frontend_type = 'KP'.
LOOP AT it_kpro ASSIGNING <kpro>.
FREE it_drao.
LOOP AT <kpro>-tbl_phios ASSIGNING <phio>.
MOVE-CORRESPONDING <phio> TO w_phio.
CALL FUNCTION 'CV120_DOC_CHECKOUT_VIEW'
EXPORTING
ps_cout_def = w_cout
ps_doc_file = w_docfile
ps_draw = in_draw
ps_phio = w_phio
ps_frontend = w_frontend
TABLES
ptx_content = it_drao
EXCEPTIONS
error = 1.
PERFORM transform_fid_to_binary TABLES it_drao
USING <kpro>-dappl
in_attsub
CHANGING attachement_list .
ENDLOOP.
ENDLOOP.
WHEN abap_false.
DO 2 TIMES.
CLEAR : w_docfile .
FREE : it_drao.
w_tabix = sy-index.
w_docfile-fileno = w_tabix.
CASE w_tabix.
WHEN 1.
w_dappl = in_draw-dappl.
w_dttrg = in_draw-dttrg.
WHEN 2.
w_dappl = in_draw-dappl1.
w_dttrg = in_draw-dttrg1.
ENDCASE.
w_docfile-dappl = w_dappl.
w_docfile-dttrg = w_dttrg.
CALL FUNCTION 'CV120_DOC_CHECKOUT'
EXPORTING
ps_cout_def = w_cout
ps_draw = in_draw
ps_doc_file = w_docfile
TABLES
ptx_drao = it_drao
EXCEPTIONS
error = 1
OTHERS = 2.
PERFORM transform_fid_to_binary TABLES it_drao
USING w_dappl
in_attsub
CHANGING attachement_list .
ENDDO.
ENDCASE.
Bellow the code for routine TRANSFORM_FID_TO_BINARY
FIELD-SYMBOLS : <drao> TYPE drao ,
<source> TYPE x ,
<dest> TYPE x,
<hexa> TYPE solix .
DATA : w_filelong TYPE i ,
w_long TYPE i,
w_longdes TYPE i .
DATA : it_hexa TYPE solix_tab .
CHECK it_drao[] IS NOT INITIAL.
* Transform Physical document into Binary
LOOP AT it_drao ASSIGNING <drao>.
IF w_filelong IS INITIAL.
w_filelong = <drao>-orln.
ENDIF.
ASSIGN <drao>-orblk TO <source>.
DESCRIBE FIELD <source> LENGTH w_long IN BYTE MODE.
CLEAR w_longdes.
WHILE w_long GT 0.
ASSIGN <source>+w_longdes(w_long) TO <source>.
APPEND INITIAL LINE TO it_hexa ASSIGNING <hexa>.
ASSIGN <hexa>-line TO <dest>.
DESCRIBE FIELD <dest> LENGTH w_longdes IN BYTE MODE.
MOVE <source> TO <dest>.
w_filelong = w_filelong - w_longdes.
w_long = w_long - w_longdes.
CHECK w_filelong LE w_longdes.
IF w_long NE 0.
w_long = w_filelong.
ENDIF.
CHECK w_long LE 0.
w_long = 0.
ENDWHILE.
ENDLOOP.
* Add file to list of attachment
CHECK NOT it_hexa[] IS INITIAL.
zcl_send_mail=>add_attachement_to_list(
EXPORTING
type = w_dappl
subject = in_attsub
content_hexa = it_hexa
CHANGING
attachement_list = attachement_list
EXCEPTIONS
no_content_for_attachement = 1
no_application_type = 2 ).
In my complete solution, an additionnal screen have been define in the header of PO to allow user managing recipient list . If you need so i can give you the code also .
Let me know.
Best regards -
How To Send ALV Output By Email.
Hi !
I wanted to ask how to send ALV output of report by email.
I know that i have to use the fms :
1. 'WWW_HTML_FROM_LISTOBJECT' - in order to convert the table to HTML.
2. 'SO_NEW_DOCUMENT_ATT_SEND_API1' - in order to send the HTML file.
My problem is how to convert the ALV screen output to the apropriate table parameter of the function 'WWW_HTML_FROM_LISTOBJECT' to listobject type ?
thanks
mosheHi look at the following program.
*& Report ZSM17_EMAIL1
REPORT zsm17_email.
tables : mara.
data: begin of it_mara occurs 0,
matnr like mara-matnr,
ernam like mara-ernam,
mtart like mara-mtart,
matkl like mara-matkl,
end of it_mara.
data: begin of it_final occurs 0,
v_string(255),
end of it_final.
*DATA: objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE,
objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE,
objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
reclist LIKE somlreci1 OCCURS 5 WITH HEADER LINE.
DATA: objpack LIKE sopcklsti1 OCCURS 0 with header line,
objhead LIKE solisti1 OCCURS 0 WITH HEADER LINE,
objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE.
data: wa_objbin like line of objbin.
DATA: doc_chng LIKE sodocchgi1.
DATA: tab_lines LIKE sy-tabix.
select-options s_matnr for mara-matnr.
*--- Selecting data from mara
select matnr
ernam
mtart
matkl
into table it_mara
from mara
where matnr in s_matnr.
if sy-subrc ne 0.
write:/ 'no data found'.
exit.
else.
loop at it_mara.
concatenate it_mara-matnr
it_mara-ernam
it_mara-mtart
it_mara-matkl
into it_final-v_string separated by '~'.
append it_final.
clear it_final.
endloop.
endif.
Creating the document to be sent
doc_chng-obj_name = 'TEST'. "name of the document
title of document or subject
doc_chng-obj_descr = 'Test Email program'.
body of the mail
objtxt = 'A test report'.
APPEND objtxt.
objtxt = 'is enclosed as an attachment.'.
APPEND objtxt.
*clear objtxt.
DESCRIBE TABLE objtxt LINES tab_lines.
Size of SAPoffice Document (for API1)
doc_chng-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
Creating the entry for the compressed attachment
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'RAW'.
*objpack-obj_name = 'ATTACHMENT'.
*objpack-obj_descr = 'Test Email Program'.
*objpack-doc_size = tab_lines * 255.
APPEND objpack..
*--- Populating the records in the attachment
data: w_str(255) TYPE c.
loop at it_final into wa_objbin.
append wa_objbin to objbin.
append objbin.
clear wa_objbin.
endloop.
DESCRIBE TABLE objbin LINES tab_lines.
tab_lines = tab_lines + 1.
objhead = 'test_report.txt'.
append objhead.
Creating the entry for the compressed attachment
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 1.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'txt'.
objpack-obj_name = 'txt'.
objpack-obj_descr = 'Test Email Program'.
objpack-doc_size = tab_lines * 255.
APPEND objpack..
*write:/ 'object text', objtxt.
Entering names in the distribution list
reclist-receiver = '[email protected]'.
reclist-rec_type = 'U'.
APPEND reclist.
Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = doc_chng
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
receivers = reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
OTHERS = 99.
CASE sy-subrc.
WHEN 0.
WRITE: / 'Result of the send process:'.
LOOP AT reclist.
WRITE: reclist-receiver(48), ':'.
IF reclist-retrn_code = 0.
WRITE 'sent successfully'.
ELSE.
WRITE 'not sent'.
ENDIF.
ENDLOOP.
loop at objbin.
write: objbin-line.
endloop.
WHEN 1.
WRITE: / 'no authorization to send to the specified number of' .
"'recipients!'.
WHEN 2.
WRITE: / 'document could not be sent to any of the recipients!'.
WHEN 4.
WRITE: / 'no authorization to send !'.
WHEN OTHERS.
WRITE: / 'error occurred during sending !'.
ENDCASE. -
TS1702 can't send Pages document as email from iPhone
Trying to send a document from Pages on iphone as an email. Email sends without the attached document. Can someone advise please how to resolve this problem?
http://help.apple.com/pages/iphone/1.7/#tan72489eaa
Maybe you are looking for
-
Hi floks, i`m new to JSF world plese help me out in generating a pop up window in the page. Here is my requirement i will be having a list of links in my master page(parent) on click of each link i need to show a pop up which contains some details ,w
-
Recently I've run into issues with my superdrive -- end result, it's shot. I've owned it for almost two years now, and burned many DVD's, so it is to be expected. My question -- It is a PIONEER DVD-RW DVR-106D, according to the system profiler. I fou
-
Well Im getting a Macbook for school. Only thinks I dont like about it are the single button trackpad since I will be using Bootcamp and the small size and costs for upgrading the internal HDD. My first questions is. What suggestions do you have for
-
FND_REQUEST_SET.FNDRSSUB
Hi, I want to submit FND_REQUEST_SET.FNDRSSUB as a anoymous block It has two IN parameters appl_id and set_id How can i get these parameters?? basic reason why am submitting this from backend is...i have a CP which has a executable FNDRSSUB and the C
-
Photoshop Elements trial version problem
I'm from the UK but am in France. I want to download P/S Elements 30 day trial UK version for my Mac OS 10.7.4. The screen was in French but I changed the version to say "UK". Download Assistant was in English, but it then seemed to be downloading th