Report to send a List via mail
Hi everybody,
at the moment we hava a report which we have to start every day to generate a customer List. Via SAP Office we can send this list via email to a specific person. Now I like to automate this report and start it as a job which automativly send this list via mail.
Do you have an idea how this will work?
Thanks a lot for your help.
Kind regards
Christian
Hi Christian.
You could put the lines of your list in a table of type SOLISTI1 and then use the function module SO_NEW_DOCUMENT_SEND_API1 to send the content of this table. You have to fill the table RECEIVERS with the address you want to send the report to.
Hope that helps,
Timo.
Similar Messages
-
Function Module to send output list to mail.
Hi,
Could anyone let me know the function module to send output list to mail.
Regards,
RameshHi,
Please try with following sample code
Sending mail with attachment
This program will allowed you to send email with attachment.
First, specify the attachment file from your local hardisk and execute.
Next, specify the sender email address and click the send button.
report YUP_MAIL.
data method1 like sy-ucomm.
data g_user like soudnamei1.
data g_user_data like soudatai1.
data g_owner like soud-usrnam.
data g_receipients like soos1 occurs 0 with header line.
data g_document like sood4 .
data g_header like sood2.
data g_folmam like sofm2.
data g_objcnt like soli occurs 0 with header line.
data g_objhead like soli occurs 0 with header line.
data g_objpara like selc occurs 0 with header line.
data g_objparb like soop1 occurs 0 with header line.
data g_attachments like sood5 occurs 0 with header line.
data g_references like soxrl occurs 0 with header line.
data g_authority like sofa-usracc.
data g_ref_document like sood4.
data g_new_parent like soodk.
data: begin of g_files occurs 10 ,
text(4096) type c,
end of g_files.
data : fold_number(12) type c,
fold_yr(2) type c,
fold_type(3) type c.
parameters ws_file(4096) type c default 'c:\debugger.txt'.
Can me any file fromyour pc ....either xls or word or ppt etc ...
g_user-sapname = sy-uname.
call function 'SO_USER_READ_API1'
exporting
user = g_user
PREPARE_FOR_FOLDER_ACCESS = ' '
importing
user_data = g_user_data
EXCEPTIONS
USER_NOT_EXIST = 1
PARAMETER_ERROR = 2
X_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.
fold_type = g_user_data-outboxfol+0(3).
fold_yr = g_user_data-outboxfol+3(2).
fold_number = g_user_data-outboxfol+5(12).
clear g_files.
refresh : g_objcnt,
g_objhead,
g_objpara,
g_objparb,
g_receipients,
g_attachments,
g_references,
g_files.
method1 = 'SAVE'.
g_document-foltp = fold_type.
g_document-folyr = fold_yr.
g_document-folno = fold_number.
g_document-objtp = g_user_data-object_typ.
*g_document-OBJYR = '27'.
*g_document-OBJNO = '000000002365'.
*g_document-OBJNAM = 'MESSAGE'.
g_document-objdes = 'sap-img.com testing by program'.
g_document-folrg = 'O'.
*g_document-okcode = 'CHNG'.
g_document-objlen = '0'.
g_document-file_ext = 'TXT'.
g_header-objdes = 'sap-img.com testing by program'.
g_header-file_ext = 'TXT'.
call function 'SO_DOCUMENT_REPOSITORY_MANAGER'
exporting
method = method1
office_user = sy-uname
ref_document = g_ref_document
new_parent = g_new_parent
importing
authority = g_authority
tables
objcont = g_objcnt
objhead = g_objhead
objpara = g_objpara
objparb = g_objparb
recipients = g_receipients
attachments = g_attachments
references = g_references
files = g_files
changing
document = g_document
header_data = g_header
FOLMEM_DATA =
RECEIVE_DATA =
File from the pc to send...
method1 = 'ATTCREATEFROMPC'.
g_files-text = ws_file.
append g_files.
call function 'SO_DOCUMENT_REPOSITORY_MANAGER'
exporting
method = method1
office_user = g_owner
ref_document = g_ref_document
new_parent = g_new_parent
importing
authority = g_authority
tables
objcont = g_objcnt
objhead = g_objhead
objpara = g_objpara
objparb = g_objparb
recipients = g_receipients
attachments = g_attachments
references = g_references
files = g_files
changing
document = g_document
header_data = g_header
method1 = 'SEND'.
g_receipients-recnam = 'MK085'.
g_receipients-recesc = 'B'.
g_receipients-sndex = 'X'.
append g_receipients.
call function 'SO_DOCUMENT_REPOSITORY_MANAGER'
exporting
method = method1
office_user = g_owner
ref_document = g_ref_document
new_parent = g_new_parent
importing
authority = g_authority
tables
objcont = g_objcnt
objhead = g_objhead
objpara = g_objpara
objparb = g_objparb
recipients = g_receipients
attachments = g_attachments
references = g_references
files = g_files
changing
document = g_document
header_data = g_header.
*-- End of Program
Thanks,
-Pramod -
Submit Report as an attachement Excel via mail using planified job SM37
Hi,
I'm executing a program in background via job to get back the result of a report as an attachment XLS on mail.
the result of my program give me just title of Excel columns , but when i execute it manually , the result is perfect.
my code is :
******************************FORM MAIL*******************************
FORM mail.
CONCATENATE 'Expédition' 'TExp' 'PtOT' 'Crée' 'Crée le' 'St.' 'Déb.
chargt'
'Désignation' 'Div.' 'Doc. vente' 'Réceptionnaire' 'Nom1' 'Nom2'
'Volume' 'UQ' INTO it_mess_att
SEPARATED BY con_tab.
CONCATENATE con_cret it_mess_att INTO it_mess_att.
APPEND it_mess_att.
CONCATENATE SPACE SPACE INTO it_mess_att
SEPARATED BY con_tab.
CONCATENATE con_cret it_mess_att INTO it_mess_att.
APPEND it_mess_att.
*CLEAR it_mess_att.
LOOP AT it_tab into wa_tab.
*VAL = it_tab-ZQTEMAX.
CONCATENATE wa_tab-SHNUMBER wa_tab-SHTYPE
wa_tab-TPLST wa_tab-CRE_NAME
wa_tab-CRE_DATE wa_tab-OIG_SSTSF
wa_tab-LOAD_STDTA wa_tab-VMODE_TEXT
wa_tab-WERKS wa_tab-VBELN
wa_tab-KUNNR wa_tab-NAME1
wa_tab-CARRIER_DE
wa_tab-WGT_UOM INTO it_mess_att
SEPARATED BY con_tab.
CONCATENATE con_cret it_mess_att INTO it_mess_att.
APPEND it_mess_att.
*CLEAR it_mess_att.
ENDLOOP.
ENDFORM.
*************************FORM SEND_MAIL*******************************
FORM send_mail .
DATA: send_request TYPE REF TO cl_bcs,
document TYPE REF TO cl_document_bcs,
recipient TYPE REF TO cl_cam_address_bcs,
bcs_exception TYPE REF TO cx_bcs,
sent_to_all TYPE os_boolean,
lt_fields TYPE TABLE OF w3fields,
lt_html TYPE TABLE OF w3html.
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 sopcklsti1-obj_descr,
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.
*MOVE p_email TO mailid.
***************ADD ADRESS MAIL**************
p_email1-RECEIVER = mail .
append p_email1.
ld_email = mail.
ld_mtitle = gd_attachment_desc.
ld_format = 'XLS'.
ld_attdescription = gd_attachment_desc.
ld_attdescription = 'Liste expéditions PN'.
CONCATENATE ld_attdescription '.XLS' INTO ld_attfilename.
ld_attfilename = p_filename.
ld_sender_address = w_sender.
ld_sender_address_type = 'INT'.
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_mess_att INDEX 1.
w_doc_data-doc_size = ( w_cnt - 1 ) * 255 + STRLEN( it_mess_att ).
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = gd_attachment_desc.
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_mess_bod 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 it_mess_att 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.
loop at p_email1.
t_receivers-receiver = p_email1-receiver.
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
APPEND t_receivers.
endloop.
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 = it_mess_att
contents_txt = it_mess_bod
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.
WAIT UP TO 5 SECONDS.
SUBMIT rsconn01 WITH mode = 'INT' WITH output = 'X' AND RETURN.
ENDFORM. " send_mailHi,
I'm executing a program in background via job to get back the result of a report as an attachment XLS on mail.
the result of my program give me just title of Excel columns , but when i execute it manually , the result is perfect.
my code is :
******************************FORM MAIL*******************************
FORM mail.
CONCATENATE 'Expédition' 'TExp' 'PtOT' 'Crée' 'Crée le' 'St.' 'Déb.
chargt'
'Désignation' 'Div.' 'Doc. vente' 'Réceptionnaire' 'Nom1' 'Nom2'
'Volume' 'UQ' INTO it_mess_att
SEPARATED BY con_tab.
CONCATENATE con_cret it_mess_att INTO it_mess_att.
APPEND it_mess_att.
CONCATENATE SPACE SPACE INTO it_mess_att
SEPARATED BY con_tab.
CONCATENATE con_cret it_mess_att INTO it_mess_att.
APPEND it_mess_att.
*CLEAR it_mess_att.
LOOP AT it_tab into wa_tab.
*VAL = it_tab-ZQTEMAX.
CONCATENATE wa_tab-SHNUMBER wa_tab-SHTYPE
wa_tab-TPLST wa_tab-CRE_NAME
wa_tab-CRE_DATE wa_tab-OIG_SSTSF
wa_tab-LOAD_STDTA wa_tab-VMODE_TEXT
wa_tab-WERKS wa_tab-VBELN
wa_tab-KUNNR wa_tab-NAME1
wa_tab-CARRIER_DE
wa_tab-WGT_UOM INTO it_mess_att
SEPARATED BY con_tab.
CONCATENATE con_cret it_mess_att INTO it_mess_att.
APPEND it_mess_att.
*CLEAR it_mess_att.
ENDLOOP.
ENDFORM.
*************************FORM SEND_MAIL*******************************
FORM send_mail .
DATA: send_request TYPE REF TO cl_bcs,
document TYPE REF TO cl_document_bcs,
recipient TYPE REF TO cl_cam_address_bcs,
bcs_exception TYPE REF TO cx_bcs,
sent_to_all TYPE os_boolean,
lt_fields TYPE TABLE OF w3fields,
lt_html TYPE TABLE OF w3html.
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 sopcklsti1-obj_descr,
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.
*MOVE p_email TO mailid.
***************ADD ADRESS MAIL**************
p_email1-RECEIVER = mail .
append p_email1.
ld_email = mail.
ld_mtitle = gd_attachment_desc.
ld_format = 'XLS'.
ld_attdescription = gd_attachment_desc.
ld_attdescription = 'Liste expéditions PN'.
CONCATENATE ld_attdescription '.XLS' INTO ld_attfilename.
ld_attfilename = p_filename.
ld_sender_address = w_sender.
ld_sender_address_type = 'INT'.
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_mess_att INDEX 1.
w_doc_data-doc_size = ( w_cnt - 1 ) * 255 + STRLEN( it_mess_att ).
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = gd_attachment_desc.
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_mess_bod 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 it_mess_att 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.
loop at p_email1.
t_receivers-receiver = p_email1-receiver.
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
APPEND t_receivers.
endloop.
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 = it_mess_att
contents_txt = it_mess_bod
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.
WAIT UP TO 5 SECONDS.
SUBMIT rsconn01 WITH mode = 'INT' WITH output = 'X' AND RETURN.
ENDFORM. " send_mail -
Problem while sending Abap list to mail in the background
Hi all,
I am sending abap list to email in the background.
My code as folllows:
DATA: so_ali LIKE solisti1 OCCURS 100 WITH HEADER LINE.
DATA: listobject LIKE abaplist OCCURS 0 WITH HEADER LINE.
DATA: objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
DATA: objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE.
DATA: objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE.
DATA: reclist LIKE somlreci1 OCCURS 5 WITH HEADER LINE.
DATA: doc_chng LIKE sodocchgi1.
DATA: tab_lines LIKE sy-tabix.
DATA: lt_user TYPE soud3 OCCURS 0 WITH HEADER LINE.
*Start of modification Tix 14411 for transport request D82K929044
DATA: it_user like SODLIENTI1 occurs 0 with header line.
*End of modification for Tix 14411 for transport request D82K929044
CLEAR: listobject, so_ali, objpack, objhead, objtxt, reclist, doc_chng.
REFRESH :
listobject, so_ali, objpack, objhead, objtxt, reclist.
creation of the document to be sent
doc_chng-obj_name = 'BOFAREPORT'.
WRITE sy-datum TO doc_chng-obj_descr.
CONCATENATE 'Bank Activity Report for :'(025)
company_itab_tr-company_code '-' doc_chng-obj_descr INTO
doc_chng-obj_descr. "AN052799
objtxt = 'This is the bank activity report received for'(026).
APPEND objtxt.
CONCATENATE company_itab_tr-company_code '-'
company_itab_tr-company_name '-'
company_itab_tr-company_city INTO
objtxt.
APPEND objtxt.
WRITE sy-datum TO objtxt.
CONCATENATE 'Date Received : '(027) objtxt INTO objtxt.
APPEND objtxt.
WRITE sy-uzeit TO objtxt.
CONCATENATE 'Time Received : '(028) objtxt INTO objtxt.
APPEND objtxt.
DESCRIBE TABLE objtxt LINES tab_lines.
READ TABLE objtxt INDEX tab_lines.
doc_chng-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
Creation of the entry for the compressed document
CLEAR objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'RAW'.
APPEND objpack.
Creation of the document attachment
CALL FUNCTION 'SAVE_LIST'
EXPORTING
list_index = '0'
TABLES
listobject = listobject
EXCEPTIONS
list_index_invalid = 1
OTHERS = 2.
CALL FUNCTION 'TABLE_COMPRESS' "Schneller Tabellencopy
TABLES
in = listobject
out = so_ali.
DESCRIBE TABLE so_ali LINES tab_lines. "objbin
objhead = 'BOFA-REPORT'. APPEND objhead.
Creation of 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 = 'ALI'.
objpack-obj_name = 'BOFAREPORT'.
objpack-obj_descr = 'Bank Activity Report'.
objpack-doc_size = tab_lines * 255.
APPEND objpack.
Completing the recipient list
SELECT * FROM zwfi_yefap_paypr WHERE
bukrs = company_itab_tr-company_code.
IF NOT ( zwfi_yefap_paypr-list1 IS INITIAL ).
clear it_user[].
CALL FUNCTION 'SO_DLI_READ_API1'
EXPORTING
DLI_NAME = zwfi_yefap_paypr-list1
DLI_ID = ' '
SHARED_DLI = 'X'
IMPORTING
DLI_DATA =
TABLES
DLI_ENTRIES = it_user
EXCEPTIONS
DLI_NOT_EXIST = 1
OPERATION_NO_AUTHORIZATION = 2
PARAMETER_ERROR = 3
X_ERROR = 4
OTHERS = 5
IF SY-SUBRC = 0.
loop at it_user.
if it_user-member_typ = 'A'.
reclist-receiver = it_user-member_adr.
reclist-rec_type = 'U'.
reclist-com_type = 'INT'.
reclist-notif_del = 'X'.
reclist-notif_ndel = 'X'.
append reclist.
elseif it_user-member_typ = ''.
reclist-receiver = it_user-member_nam.
reclist-rec_type = 'B'.
reclist-express = 'X'.
append reclist.
Endif.
endloop.
ENDIF.
ENDIF.
IF NOT ( zwfi_yefap_paypr-list2 IS INITIAL ).
clear it_user[].
CALL FUNCTION 'SO_DLI_READ_API1'
EXPORTING
DLI_NAME = zwfi_yefap_paypr-list2
DLI_ID = ' '
SHARED_DLI = 'X'
IMPORTING
DLI_DATA =
TABLES
DLI_ENTRIES = it_user
EXCEPTIONS
DLI_NOT_EXIST = 1
OPERATION_NO_AUTHORIZATION = 2
PARAMETER_ERROR = 3
X_ERROR = 4
OTHERS = 5
IF SY-SUBRC = 0.
loop at it_user.
if it_user-member_typ = 'A'.
reclist-receiver = it_user-member_adr.
reclist-rec_type = 'U'.
reclist-com_type = 'INT'.
reclist-notif_del = 'X'.
reclist-notif_ndel = 'X'.
append reclist.
elseif it_user-member_typ = ''.
reclist-receiver = it_user-member_nam.
reclist-rec_type = 'B'.
reclist-express = 'X'.
append reclist.
Endif.
endloop.
ENDIF.
endif.
ENDSELECT.
CLEAR error_text.
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 = so_ali "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 'The document was sent'.
else.
CONCATENATE 'The document could not be sent to : '(029)
reclist-receiver(48) INTO error_text.
ENDIF.
ENDLOOP.
WHEN 1.
error_text = text-030.
WHEN 2.
error_text = 'Document could not be sent to any recipient'(031).
WHEN 4.
error_text = 'No send authorization'(032).
WHEN OTHERS.
error_text = 'Error occurred while sending'(033).
ENDCASE.
IF NOT ( error_text IS INITIAL ).
CONCATENATE 'Mail send Error : '(034) error_text INTO error_text.
PERFORM WRITE_LOG(YEFAP_APERAK) USING ERROR_TEXT.
PERFORM write_log(zwfi_yefap_bank_report) USING error_text.
ENDIF.
CALL FUNCTION 'LIST_FREE_MEMORY'
TABLES
listobject = listobject
EXCEPTIONS
OTHERS = 1.
When I excute the same program in the foreground, Attachment in the mail is showing all the pages of the report output.
But when I excute the same program in the background only last page is shown in the mail attachemnt.
I think the problem is with the function module SAVE_LIST function module.
I replaced the SAVE_LIST function module with LIST_TO_MEMORY and LIST_FROM_MEMORY function modules.
It is also giving the same result.
In the foreground excution email attachemnt showing all the pages and in the background excution only last page is shown in the attachemnt.
I want all the pages dispalyed in the background mode excution in the email attachment.
How to slove this issue.
Thanks in advance.
RajaI have seen this problem before. Please have a look at this example program. This works very well when ran in background as well as foreground
* This program works in the background,
report zrich_0003 .
data: maildata like sodocchgi1.
data: mailtxt like solisti1 occurs 10 with header line.
data: mailrec like somlrec90 occurs 0 with header line.
data: list type table of abaplist with header line.
data: ascilines(1024) type c occurs 0 with header line.
data: htmllines type table of w3html with header line.
parameters: p_check.
start-of-selection.
submit zrich_0004 exporting list to memory and return.
call function 'LIST_FROM_MEMORY'
tables
listobject = list
exceptions
not_found = 1
others = 2.
call function 'LIST_TO_ASCI'
tables
listobject = list
listasci = ascilines
exceptions
empty_list = 1
list_index_invalid = 2
others = 3.
call function 'WWW_HTML_FROM_LISTOBJECT'
tables
html = htmllines
listobject = list.
clear: maildata, mailtxt, mailrec.
refresh: mailtxt, mailrec.
maildata-obj_name = 'TEST'.
maildata-obj_descr = 'Test Subject'.
loop at htmllines.
mailtxt = htmllines.
append mailtxt.
endloop.
mailrec-receiver = '[email protected]'.
mailrec-rec_type = 'U'.
append mailrec.
call function 'SO_NEW_DOCUMENT_SEND_API1'
exporting
document_data = maildata
document_type = 'HTM'
put_in_outbox = 'X'
tables
object_header = mailtxt
object_content = mailtxt
receivers = mailrec
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.
wait up to 2 seconds.
submit rsconn01 with mode = 'INT'
with output = 'X'
and return.
Regards,
Rich Heilman -
Problem while sending Abap list to mail
Hi All,
I am sending an abap list to mail using function module SO_NEW_DOCUMENT_ATT_SEND_API1.
Report output is going to mail id but only last page is showing.
The flow i followed in the code is as follows:
First I used Function module SAVE_LIST
Next I used Function module TABLE_COMPRESS
And finally i used function module SO_NEW_DOCUMENT_ATT_SEND_API1
Report output is going to mail id but last page is showingup.
I want all the pages to show in the email.
How it can be solved?
Thanks in Advance,
RajaRaja,
Please provide your code that builds the ABAP List and the code that builds the mail package. -
How to run 2 reports to send 1 PDF e-mail attachment instead of 2 e-mails.
I used 9i Reports to create 2 reports in a PDF format. I run these reports from a 9i form using the web.show_document command. XML is used to send the 2 e-mails with the reports.
Is there a way I can combine the running of the reports to make one PDF to created 1 e-mail attachment or run the reports at the same time and attach 2 PDF files to 1 e-mail.
I have no problems running 1 report and sending 1 e-mail attacment!
This is example of the XML used in creating the e-mail:
- <destinations>
- <foreach>
- <file id="Test" name="REPORT_1.pdf" format="pdf" instance="XXXX">
<include src="report" />
</file>
</foreach>
- <!-- Send a mail with an attachment
-->
- <mail id="ex1" to="&DESNAME" from="&DESNAME" subject="&DESNAME;*;&p_postal_number: was submitted for
approval on &p_postal_date">
<body srcType="text">This is to notify you of a new submission that requires an approval before being
sent to out. Please use the URL link below to review the information as soon as possible.
https://xxxx.aaaa.sss.com:234/web_html/static.html AAAA Administrator</body>
- <attach format="pdf" name="Report_1&.pdf" srcType="report">
<include src="mainSection" />
</attach>
</mail>
</destinations>You can use iText to combine two PDF files into one.
-
How can I send a PDF via mail without it becoming an attached file?
Hi All!
I need to know how I am able to send a PDF file via mail, without it becoming an attached file. This means when the receiver opens the mail, he automatically sees the PDF without first having to read the normal mail text and scroll down to open the attached PDF file. Just like a spam newsletter
Also I want to know - I want some illustrations in my portfolio to be a hyperlink to a website, is this possible on a picture (not on an URL) - and if so - How?
Hope you can help me out here!
** I use Adobe Acrobat Reader Pro X 10.1.10 on a Macbook Pro 10.8.5**
Thanks,
CarlinskyCarlinsky wrote:
Hi All!
I need to know how I am able to send a PDF file via mail, without it becoming an attached file. This means when the receiver opens the mail, he automatically sees the PDF without first having to read the normal mail text and scroll down to open the attached PDF file. Just like a spam newsletter
Not possible with Adobe Reader or Adobe Acrobat. -
How to send html newsletter via Mail app
I want crystal and clear instruction as all the ones I have found either old fashioned and not relevant or skip that interesting part.
I have already done html page (newsletter). Now I want to transform it somehow and send via Mail app so my contacts could receive it as html newsletter. If I need to attach txt message please add it to the instruction. I need complete how to send html newsletter.alabanco wrote:
thanks. Now we've got to the most interesting part and intriguing one. Why should I upload html page to the server. I do understand uploading the images to server which will be used as links in my html mail. But why and how should I store that page in my server if I have CMS post instead from which I used pictures as links. SHould I create yet another type of post in CMS that is my html newsletter? That's not cool. What is the industry standard approach for that?
By the way Mail.app uses that baby design templates for your messages. Why don't we have an option to delete all these creepy childish templates and store solid bold corporate style templates for newsletters and send it somehow? Or will it just attach the images to the message then? If so then it is not what I want and it is really depressing.
The industry convention/"standard" is not to use html in email. Wheteher or not your html newsletter displays as you intended is at the mercy of the recipient and their email client settings.
If you want to preserve your html layout and styles, save your newsletter as a pdf document and attach the pdf document to your email. Or, as already suggested, use a web server to serve your html newsletter. -
Date formatting issue when sending excel file via mail
hello People ,
I am facing date issue .
I have inetrnal format of date as yyyymmdd.
I am converting it into YYYY-MM-DD.
CONCATENATE gs_output-end_date(4)
gs_output-end_date+4(2)
gs_output-end_date+6(2)
INTO lv_date_to SEPARATED BY gc_seperator. " gc_separator = '-'.
gs_output-end_date = lv_date_to.
I am writing this date and sending an excel file via MAIL . I get date result as MM/DD/YYYY always.
Now if i pass in YYYY.MM.DD and used the same code where gc_separtor = '.'.
I get output as YYYY.MM.DD.
Can any one give me an idea why in format YYYY-MM-DD it is getting overwritten but for yyyy.mm.dd it gives me as yyyy.mm.dd?
Regards,
Abhi..
Edited by: Thomas Zloch on Jul 11, 2011 2:30 PM - subject enhancedThanks , Rohit ,
I have change my date format in SU01 settings .
It is now made to [ YYYY-MM-DD] but still '-' is replaced by MM/DD/YYYY.
Also note that when i format in the following way
CONCATENATE gs_output-rdadate(4)
gs_output-rdadate+4(2)
gs_output-rdadate+6(2)
INTO lv_rda_date.
instead of
CONCATENATE gs_output-rdadate(4)
gs_output-rdadate+4(2)
gs_output-rdadate+6(2)
INTO lv_rda_date sepearted by '-'.
I get output as YYYYMMDD.
Regards,
Abhishek. -
Is there transaction for sending General maintenance task list (IA08) via ALE? I need to send Task list with Operations and Characteristic. There are similar QM t-codes like QM21, QM31, QM41 but I can't find releated t-codes for PM.
Dear
Please check in OPL8 - Order Type Dependent Parameters ,what's the Task List
selection. It must be 3 for Routing/Ref.Operation Set Optional - Automatic
Selection.Please check the same for your order type which you were trying to
check.
Also check in OPJF - Task List Selection - Select Automatically,whether the
entries has been made properly.
Regards
JH -
Problems sending a PDF via mail
Hi !! I have a report, runs in background, which obtains some information from sap tables and then generates an ALV. As it is executed in background, the ALV creates an spool order. After this, I convert this spool into a PDF object . And then I need to send a mail to an specific user with some text in its body and this PDF as attach. If I don't attach the PDF, the mail is sent ok. The problem is when I try to attach the PDF.. Here is my code so anybody can help me please... REPORT zautorizaciones_spool . TABLES : usr02, agr_texts, agr_users, adr6, usr21, adrp, itcpo, tsp01. TYPE-POOLS : slis. DATA: BEGIN OF i_tabla OCCURS 0, agr_name LIKE agr_texts-agr_name, text LIKE agr_texts-text, uname LIKE agr_users-uname, name_text LIKE adrp-name_text, END OF i_tabla. * Spool IDs TYPES: BEGIN OF t_tbtcp. INCLUDE STRUCTURE tbtcp. TYPES: END OF t_tbtcp. DATA: fieldcat TYPE slis_t_fieldcat_alv, fieldcat_ln LIKE LINE OF fieldcat, sortcat TYPE slis_t_sortinfo_alv. DATA: col_pos TYPE i, spos TYPE i. DATA: v_buffer TYPE string. DATA: BEGIN OF it_email OCCURS 0, smtp_addr LIKE adr6-smtp_addr. DATA: END OF it_email. DATA: mi_rqident LIKE tsp01-rqident, mi_bytecount TYPE i, mtab_pdf LIKE tline OCCURS 0 WITH HEADER LINE. DATA: it_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE, 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, doc_chng LIKE sodocchgi1, tab_lines LIKE sy-tabix, reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE, it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE. 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, it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0, wa_tbtcp TYPE t_tbtcp. CONSTANTS: c_dev LIKE sy-sysid VALUE 'DEV'. *----
Pantalla de selección *----------------------------------------------------------------------
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001. SELECT-OPTIONS: s_ustyp FOR usr02-ustyp, s_nomrol FOR agr_texts-agr_name, s_uflag FOR usr02-uflag, s_class FOR usr02-class, s_line FOR agr_texts-line, s_todat FOR agr_users-to_dat, s_spras FOR agr_texts-spras, s_gltgb FOR usr02-gltgb, s_correo FOR adr6-smtp_addr. SELECTION-SCREEN END OF BLOCK b1. *----
INITIALIZATION *----------------------------------------------------------------------
INITIALIZATION. CLEAR i_tabla. REFRESH i_tabla. *----
START-OF-SELECTION *----------------------------------------------------------------------
START-OF-SELECTION. PERFORM obtener_datos. IF NOT i_tabla[] IS INITIAL. IF sy-batch IS INITIAL. PERFORM listado. SKIP. WRITE:/ 'Para que la orden spool pueda ser creada, el programa', 'se debe de ejecutar en fondo.'. ELSE. MESSAGE s000(z2) WITH 'batch'. PERFORM listado. PERFORM get_job_details. PERFORM get_spool_number USING SY-REPID sy-uname CHANGING mi_rqident. PERFORM conver_spool_pdf. PERFORM enviar_mail. PERFORM delete_spool. IF sy-sysid = c_dev. WAIT UP TO 5 SECONDS. SUBMIT rsconn01 WITH mode = 'INT' WITH output = 'X' AND RETURN. ENDIF. ENDIF. ENDIF. *----
END-OF-SELECTION *---------------------------------------------------------------------
END-OF-SELECTION. *&----
*& Form obtener_datos *&--------------------------------------------------------------------
FORM obtener_datos. SELECT agr_textsagr_name agr_textstext agr_usersuname adrpname_text APPENDING CORRESPONDING FIELDS OF TABLE i_tabla FROM ( agr_users INNER JOIN usr02 ON usr02bname = agr_usersuname INNER JOIN agr_texts ON agr_textsagr_name = agr_usersagr_name INNER JOIN usr21 ON usr21bname = usr02bname INNER JOIN adrp ON adrppersnumber = usr21persnumber ) WHERE agr_usersagr_name IN s_nomrol AND agr_usersto_dat IN s_todat AND usr02class IN s_class AND usr02gltgb IN s_gltgb AND usr02uflag IN s_uflag AND usr02ustyp IN s_ustyp AND agr_textsline IN s_line AND agr_textsspras IN s_spras. ENDFORM *&--------------------------------------------------------------------
*& Form listado *&--------------------------------------------------------------------
FORM listado. PERFORM crear_catalogo. PERFORM imprimir. ENDFORM. *&--------------------------------------------------------------------
*& Form crear_catalogo *&--------------------------------------------------------------------
FORM crear_catalogo. PERFORM build_fieldcat USING : 'AGR_TEXTS' 'AGR_NAME' '' '' '' '30' '' 'L' 'Papel', 'AGR_TEXTS' 'TEXT' '' '' '' '80' '' 'L' 'Denominación papel', 'AGR_USERS' 'UNAME' '' '' '' '12' '' 'L' 'Usuario', 'NAME_TEXT' 'NAME_TEXT' '' '' '' '80' '' 'L' 'Nombre completo'. ENDFORM. *&--------------------------------------------------------------------
*& Form build_fieldcat *&--------------------------------------------------------------------
FORM build_fieldcat USING tabname fieldname key no_out hotspot outputlen do_sum ddictxt seltext_l. ADD 1 TO col_pos. fieldcat_ln-ref_tabname = tabname. fieldcat_ln-fieldname = fieldname. fieldcat_ln-key = key. fieldcat_ln-col_pos = col_pos. fieldcat_ln-no_out = no_out. fieldcat_ln-hotspot = hotspot. fieldcat_ln-do_sum = do_sum. fieldcat_ln-ddictxt = ddictxt. fieldcat_ln-seltext_l = seltext_l. fieldcat_ln-seltext_m = seltext_l. fieldcat_ln-seltext_s = seltext_l. IF NOT outputlen IS INITIAL. fieldcat_ln-outputlen = outputlen. ENDIF. APPEND fieldcat_ln TO fieldcat. CLEAR fieldcat_ln. ENDFORM. *&--------------------------------------------------------------------
*& Form imprimir *&--------------------------------------------------------------------
FORM imprimir. DATA : prg LIKE sy-repid. prg = sy-repid. DATA : salida TYPE slis_exit_by_user. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING i_callback_program = prg i_callback_user_command = 'ALV_USER_COMMAND' it_fieldcat = fieldcat it_sort = sortcat i_save = 'A' IMPORTING es_exit_caused_by_user = salida TABLES t_outtab = i_tabla EXCEPTIONS program_error = 1 OTHERS = 2. ENDFORM. *&--------------------------------------------------------------------
*& Form informar_cuerpo *&--------------------------------------------------------------------
FORM informar_cuerpo. objtxt-line = 'Estimado propietario de datos.'. APPEND objtxt. CLEAR objtxt. APPEND objtxt. CLEAR objtxt. CONCATENATE 'En el marco de la auditoría SOX, y para asegurar el cumplimiento' 'de uno de sus controles, le adjuntamos un/os informes para...' INTO objtxt-line SEPARATED BY space. APPEND objtxt. CLEAR objtxt. ENDFORM. " informar_cuerpo *&--------------------------------------------------------------------
*& Form enviar_mail *&--------------------------------------------------------------------
FORM enviar_mail. DATA: w_cnt TYPE i, t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE, cont type i. doc_chng-obj_name = 'Probando envio mail'. doc_chng-obj_descr = 'Probando asunto mail'. PERFORM informar_cuerpo. READ TABLE it_mess_att INDEX w_cnt. MESSAGE s000(z2) WITH 'w_cnt' w_cnt. MESSAGE s000(z2) WITH 'sy-subrc' sy-subrc. DESCRIBE TABLE objtxt LINES tab_lines. doc_chng-doc_size = ( w_cnt - 1 ) * 255 + STRLEN( it_mess_att ). CLEAR t_attachment. REFRESH t_attachment. t_attachment[] = it_mess_att[]. CLEAR objpack-transf_bin. objpack-head_start = 1. objpack-head_num = 0. objpack-body_start = 1. objpack-body_num = tab_lines. objpack-doc_type = 'RAW'. objpack-obj_descr = doc_chng-obj_descr. DESCRIBE TABLE t_attachment LINES objpack-body_num. objpack-doc_type = 'PDF'. objpack-obj_descr = 'OBJ_Descr'. objpack-obj_name = 'obj_name'. objpack-doc_size = objpack-body_num * 255. APPEND objpack. objhead = 'Envio mail'. READ TABLE objtxt INDEX tab_lines. IF sy-subrc = 0. MESSAGE s000(z2) WITH 'objtxt' tab_lines. ENDIF. reclist-receiver = p_mail. reclist-rec_type = 'U'. reclist-express = 'X'. reclist-com_type = 'INT'. APPEND reclist. CLEAR reclist. CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1' EXPORTING document_data = doc_chng TABLES packing_list = objpack object_header = objhead contents_bin = objbin contents_txt = objtxt receivers = 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. MESSAGE s000(z2) WITH 'sy-subrc' sy-subrc. ENDFORM. " enviar_mail *&--------------------------------------------------------------------
*& Form get_spool_number *&--------------------------------------------------------------------
FORM get_spool_number USING f_repid f_uname CHANGING f_rqident. DATA: lc_rq2name LIKE tsp01-rq2name. 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. CLEAR wa_tbtcp. READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1. IF sy-subrc = 0. f_rqident = wa_tbtcp-listident. MESSAGE s000(z2) WITH 'Se ha creado la orden spool' f_rqident. ELSE. MESSAGE s000(z2) WITH 'No se ha recuperado ninguna orden spool'. ENDIF. ENDFORM. " get_spool_number *&--------------------------------------------------------------------
*& Form informar_destinatario *&--------------------------------------------------------------------
FORM informar_destinatario USING p_correo. it_receivers-receiver = p_correo. it_receivers-rec_type = 'U'. it_receivers-express = 'X'. it_receivers-com_type = 'INT'. APPEND it_receivers. CLEAR it_receivers. ENDFORM. " informar_destinatario *&--------------------------------------------------------------------
*& Form get_job_details *&--------------------------------------------------------------------
FORM get_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. MESSAGE s000(z2) WITH 'job: ' gd_jobname. ENDFORM. " get_job_details *&--------------------------------------------------------------------
*& Form conver_spool_pdf *&--------------------------------------------------------------------
FORM conver_spool_pdf. CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF' EXPORTING src_spoolid = mi_rqident no_dialog = ' ' dst_device = 'LOCL' IMPORTING pdf_bytecount = mi_bytecount TABLES pdf = mtab_pdf EXCEPTIONS err_no_abap_spooljob = 1 err_no_spooljob = 2 err_no_permission = 3 err_conv_not_possible = 4 err_bad_destdevice = 5 user_cancelled = 6 err_spoolerror = 7 err_temseerror = 8 err_btcjob_open_failed = 9 err_btcjob_submit_failed = 10 err_btcjob_close_failed = 11 OTHERS = 12. CHECK sy-subrc = 0. LOOP AT mtab_pdf. TRANSLATE mtab_pdf USING ' '. CONCATENATE v_buffer mtab_pdf INTO v_buffer. ENDLOOP. TRANSLATE v_buffer USING ' '. DO. it_mess_att = v_buffer. APPEND it_mess_att. SHIFT v_buffer LEFT BY 255 PLACES. IF v_buffer IS INITIAL. EXIT. ENDIF. ENDDO. ENDFORM. " conver_spool_pdf *&--------------------------------------------------------------------
*& Form delete_spool *&----
FORM delete_spool. DATA: ld_spool_nr TYPE tsp01_sp0r-rqid_char, ld_status LIKE sy-subrc. CLEAR: ld_spool_nr, ld_status. ld_spool_nr = mi_rqident. CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ' EXPORTING spoolid = ld_spool_nr IMPORTING status = ld_status. ENDFORM. " delete_spool I don't know where the error can be and I've been working on it for 2 days... Do I have to download the PDF to a file ??? In that case, how do I attach then the file ?? Thanks a lot in advance, Regards !!Sorry, I wrote it as the code appears in SAP and didn't know I can format it..I hope I've done it ok now..
As I run the report through a job, I do it like this:
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.
Then I get the spool:
DATA: lc_rq2name LIKE tsp01-rq2name.
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.
CLEAR wa_tbtcp.
READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
IF sy-subrc = 0.
f_rqident = wa_tbtcp-listident.
After this I create the PDF:
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = mi_rqident
no_dialog = ' '
dst_device = 'LOCL'
IMPORTING
pdf_bytecount = mi_bytecount
TABLES
pdf = mtab_pdf.
LOOP AT mtab_pdf.
TRANSLATE mtab_pdf USING ' ~'.
CONCATENATE
v_buffer
mtab_pdf
INTO v_buffer.
ENDLOOP.
TRANSLATE v_buffer USING '~ '.
DO.
it_mess_att = v_buffer.
APPEND it_mess_att.
SHIFT v_buffer LEFT BY 255 PLACES.
ENDDO.
To send the mail..
DATA: w_cnt TYPE i
t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
cont type i.
doc_chng-obj_name = 'Probando envio mail'.
doc_chng-obj_descr = 'Probando asunto mail'.
READ TABLE it_mess_att INDEX w_cnt.
DESCRIBE TABLE objtxt LINES tab_lines.
doc_chng-doc_size = ( w_cnt - 1 ) * 255 + STRLEN( it_mess_att ).
CLEAR t_attachment.
REFRESH t_attachment. t_attachment[] = it_mess_att[].
CLEAR objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'RAW'.
objpack-obj_descr = doc_chng-obj_descr.
DESCRIBE TABLE t_attachment LINES objpack-body_num.
objpack-doc_type = 'PDF'.
objpack-obj_descr = 'OBJ_Descr'.
objpack-obj_name = 'obj_name'.
objpack-doc_size = objpack-body_num * 255.
APPEND objpack. objhead = 'Envio mail'.
READ TABLE objtxt INDEX tab_lines.
reclist-receiver = p_mail.
reclist-rec_type = 'U'.
reclist-express = 'X'.
reclist-com_type = 'INT'.
APPEND reclist.
CLEAR reclist.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = doc_chng
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
receivers = reclist .
Edited by: poketina on Nov 19, 2009 4:51 PM
Sorry, i don't know how to give format.... -
How can we send Error Idocs via mail
Hi,
I have read read through forums and understood that it can be achieved either through workflow or through report using table edidd & edids.
If workflow option is used , does the mail trigger for every error idoc ? How can we send daily error report to user say by EOD containing all error idocs using all possible options.
Regards,
RachelRachel,
I dont think so any direct Report will be available just to get Error IDOCs details. Although you can create a simple report to read the tables. An example is in below link.
http://wiki.scn.sap.com/wiki/display/Snippets/Custom+report+for+IDOC+Monitoring
Also, you can create a Query of EDIDC and EDIDS tables to obatin relevant information.
Thanks,
Ravi -
Force CalDAV calendar in iCal to send meeting invites via Mail
A handful of people are experiencing issues sending out meeting invite emails via a Google Apps (CalDAV) calendar that is setup in iCal. Meetings are showing up on invitees calendars, but they are not receiving email notifications about them.
Thread on that topic here: http://www.google.com/support/forum/p/Calendar/thread?tid=368ec40a6bdd7bb8&hl=en
and here: http://discussions.apple.com/thread.jspa?threadID=2707217&tstart=0
*So, my question is this*: Is there a way to force Mail.app to send out a meeting invitation of a CalDAV calendar that is setup in iCal, instead of using whatever system the CalDAV calendar uses (in my specific case, Google Apps). My assumption is that iCal uses the Mail.applescript or Mail.scpt file that is inside the iCal package (iCal > Show Package Contents > Resources > Mail.applescript) when sending out an invite from a local calendar. Any way to force a CalDAV calendar to use that script?I had that problem too.
I changed my mail preferences "Add invitations to iCal" from Automatically to Never and that seems to work for me.
Hope that helps -
Report output to be sent via mail
Hi Experts,
I want to send my customized ABAP report output to an email address (e.g my own email ID) as I need to send to the vendor (who doesn't have SAP access) as per the requirement.
Can you please let me know is there any transaction or any other way with the help of which i can just input this report name and the email Id and then it will automatically send the output of the report to that email id.
Thanks in advance.
Any helpful entry will be rewarded.
Warm regards,
Raman.You might want to write a small program that retrieves your spool information, and send the corresponding ALV (internal table) by converting it and sending it via SAP Connect. Here is a sample of hos to attach and send your internal table:
FORM send_file .
DATA: send_request TYPE REF TO cl_bcs,
text TYPE bcsy_text,
document TYPE REF TO cl_document_bcs,
recipient TYPE REF TO if_recipient_bcs,
copy TYPE ad_smtpadr,
bcs_exception TYPE REF TO cx_bcs,
sent_to_all TYPE os_boolean,
att_name TYPE sood-objdes,
subject TYPE so_obj_des.
Get attachment name
CONCATENATE g_ret_id '_' sy-datum sy-uzeit '_' g_fileid '.CSV' INTO
att_name.
TRY.
Create the send request
send_request = cl_bcs=>create_persistent( ).
Create the document with attachments
Main document
APPEND 'Attachment test' TO text.
document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = text
i_subject = subject ).
Add text attachment to document
document->add_attachment( i_attachment_type = 'CSV'
i_attachment_subject = att_name
i_att_content_text = itab_file ).
send_request->set_document( document ).
Create recipient and add to send request
LOOP AT itab_recipients INTO wa_recipients.
IF wa_recipients-copy IS INITIAL.
"To recipient
MOVE wa_recipients-address TO g_rec_send.
recipient = cl_cam_address_bcs=>create_internet_address(
g_rec_send ).
send_request->add_recipient( i_recipient = recipient ).
CLEAR g_rec_send.
ELSE.
"CC
MOVE wa_recipients-address TO g_rec_send.
recipient = cl_cam_address_bcs=>create_internet_address(
g_rec_send ).
send_request->add_recipient( i_recipient = recipient
i_copy = 'X' ).
CLEAR g_rec_send.
ENDIF.
ENDLOOP.
Send
sent_to_all = send_request->send( i_with_error_screen = 'X' ).
IF sent_to_all = 'X'.
MESSAGE s022.
ENDIF.
CATCH cx_bcs INTO bcs_exception.
MESSAGE e865 WITH bcs_exception->error_type.
ENDTRY.
ENDFORM. " send_file
REPORT TO EMAIL
ALV output to email
How to send ALV Grid report to Email?
Check the code...on http://sap4.com/wiki/index.php?title=ZOUTLOOK
sending the output of a program through an email
report output to email
Sending ABAP Report by email
Rewards if useful..............
Minal -
Send User Variables via Mail with Captivate 7
Hello,
I am looking for a way to send some self difined user Variables via e-Mail?
I only find solution for Quizes, but i´d like to have some of the Additional Viables als well.
Is there a Way?
Best Regards
BernhardYou'll need JavaScript. In his video tutorials about JS for Captivate, Jim Leichliter explains the work flow:
http://captivatedev.com/2014/01/02/javascript-video-series-adobe-captivate-7/
Lilybiri
Maybe you are looking for
-
Re-using Segments Created via API or Re-creating Every Time?
Hi All, Wanted to get your thoughts on this... We have been able to create Segments via the API, however, which way to go: OPTION 1: Re-use Segment if there are no additions or deletions (changes) to the list? or OPTION 2: Re-create the Segment every
-
Hi My SAP program will send an email to a Lotus inbox when triggered. But the mail received is addressed in 'CC'. When calling function module SO_NEW_DOCUMENT_ATT_SEND_API1, I have set the copy field to '' and express field to 'X'. Upon changing the
-
How to send an idoc of lower release to an External RFC server
Hi All, I am sending idocs from the sap system to an external rfc server(written using Sap RFC SDK). When an idoc is sent from the Sap system, I receive an IDOC_INBOUND_ASYNCHRONOUS call in the external RFC server with the Idoc data. Everything works
-
Class specific sequence factory for SQL server?
Hi Guys, I would like to use Kodo SequenceFactory to generate the Class sensitive primary keys. In other words, to have a sequence for each table(class). We are using Application identity, Kodo 2.4.2 and SQL Server as a database. I have seen referenc
-
Hi, I have BSP based iView which is working fine when i call directly or manually. if i call from this url from other application, URL parameters replaced with internal values. Could any help me on this. Thanks in advance!!! <h2> Not working: </h2