Send sapscript to customer
Hi,
could I use the function USE_SEND_OBJECT to send a sapscript (an invoice) to an external mail (customer email) ?
Thanks!!!!
Hi Juan
Go through the follwoing Code
DATA: ITCPO LIKE ITCPO,
TAB_LINES LIKE SY-TABIX.
* Variables for EMAIL functionality
DATA: MAILDATA LIKE SODOCCHGI1.
DATA: MAILPACK LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.
DATA: MAILHEAD LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE.
DATA: MAILBIN LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: MAILTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: MAILREC LIKE SOMLREC90 OCCURS 0 WITH HEADER LINE.
DATA: SOLISTI1 LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE.
PERFORM SEND_FORM_VIA_EMAIL.
* FORM SEND_FORM_VIA_EMAIL *
FORM SEND_FORM_VIA_EMAIL.
CLEAR: MAILDATA, MAILTXT, MAILBIN, MAILPACK, MAILHEAD, MAILREC.
REFRESH: MAILTXT, MAILBIN, MAILPACK, MAILHEAD, MAILREC.
* Creation of the document to be sent File Name
MAILDATA-OBJ_NAME = 'TEST'.
* Mail Subject
MAILDATA-OBJ_DESCR = 'Subject'.
* Mail Contents
MAILTXT-LINE = 'Here is your file'.
APPEND MAILTXT.
* Prepare Packing List
PERFORM PREPARE_PACKING_LIST.
* Set recipient - email address here!!!
MAILREC-RECEIVER = '[email protected]'.
MAILREC-REC_TYPE = 'U'.
APPEND MAILREC.
* Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = MAILDATA
PUT_IN_OUTBOX = ' '
TABLES
PACKING_LIST = MAILPACK
OBJECT_HEADER = MAILHEAD
CONTENTS_BIN = MAILBIN
CONTENTS_TXT = MAILTXT
RECEIVERS = MAILREC
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
OPERATION_NO_AUTHORIZATION = 4
OTHERS = 99.
ENDFORM.
* Form PREPARE_PACKING_LIST
FORM PREPARE_PACKING_LIST.
CLEAR: MAILPACK, MAILBIN, MAILHEAD.
REFRESH: MAILPACK, MAILBIN, MAILHEAD.
DESCRIBE TABLE MAILTXT LINES TAB_LINES.
READ TABLE MAILTXT INDEX TAB_LINES.
MAILDATA-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( MAILTXT ).
* Creation of the entry for the compressed document
CLEAR MAILPACK-TRANSF_BIN.
MAILPACK-HEAD_START = 1.
MAILPACK-HEAD_NUM = 0.
MAILPACK-BODY_START = 1.
MAILPACK-BODY_NUM = TAB_LINES.
MAILPACK-DOC_TYPE = 'RAW'.
APPEND MAILPACK.
* Creation of the document attachment
* This form gets the OTF code from the SAPscript form.
* If you already have your OTF code, I believe that you may
* be able to skip this form. just do the following code, looping thru
* your SOLISTI1 and updating MAILBIN.
PERFORM GET_OTF_CODE.
LOOP AT SOLISTI1.
MOVE-CORRESPONDING SOLISTI1 TO MAILBIN.
APPEND MAILBIN.
ENDLOOP.
DESCRIBE TABLE MAILBIN LINES TAB_LINES.
MAILHEAD = 'TEST.OTF'.
APPEND MAILHEAD.
** Creation of the entry for the compressed attachment
MAILPACK-TRANSF_BIN = 'X'.
MAILPACK-HEAD_START = 1.
MAILPACK-HEAD_NUM = 1.
MAILPACK-BODY_START = 1.
MAILPACK-BODY_NUM = TAB_LINES.
MAILPACK-DOC_TYPE = 'OTF'.
MAILPACK-OBJ_NAME = 'TEST'.
MAILPACK-OBJ_DESCR = 'Subject'.
MAILPACK-DOC_SIZE = TAB_LINES * 255.
APPEND MAILPACK.
ENDFORM.
* Form GET_OTF_CODE
FORM GET_OTF_CODE.
DATA: BEGIN OF OTF OCCURS 0.
INCLUDE STRUCTURE ITCOO .
DATA: END OF OTF.
DATA: ITCPO LIKE ITCPO.
DATA: ITCPP LIKE ITCPP.
CLEAR ITCPO.
ITCPO-TDGETOTF = 'X'.
* Start writing OTF code
CALL FUNCTION 'OPEN_FORM'
EXPORTING
FORM = 'ZTEST_FORM'
LANGUAGE = SY-LANGU
OPTIONS = ITCPO
DIALOG = ' '
EXCEPTIONS
OTHERS = 1.
CALL FUNCTION 'START_FORM'
EXCEPTIONS
ERROR_MESSAGE = 01
OTHERS = 02.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
WINDOW = 'MAIN'
EXCEPTIONS
ERROR_MESSAGE = 01
OTHERS = 02.
* Close up Form and get OTF code
CALL FUNCTION 'END_FORM'
EXCEPTIONS
ERROR_MESSAGE = 01
OTHERS = 02.
MOVE-CORRESPONDING ITCPO TO ITCPP.
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT = ITCPP
TABLES
OTFDATA = OTF
EXCEPTIONS
OTHERS = 1.
* Move OTF code to structure SOLI form email
CLEAR SOLISTI1. REFRESH SOLISTI1.
LOOP AT OTF.
SOLISTI1-LINE = OTF.
APPEND SOLISTI1.
ENDLOOP.
ENDFORM.
Check this links
SAPscript: Sending mail from Sapscript in 4.7
Script- converting in PDF and sending by mail.
Reward all helpfull answers
regards
Pavan
Similar Messages
-
Requirement of sending Sapscript through mail and fax
I need help in code for sending sapscript through email or fax as the data is maintained in customer master table . If anybody has done so please help. I do not want to use CONVERT_OTF function and SO...API1 function.
Check the following code it may help u.
***INCLUDE RVADOPFO .
DATA: LVS_ITCPO TYPE ITCPO,
LVF_DEVICE(30) TYPE C,
LVF_DIALOG(1) TYPE C VALUE ' ',
LVS_RECIPIENT LIKE SWOTOBJID,
LVS_SENDER LIKE SWOTOBJID,
LVS_SNAST TYPE SNAST,
LVF_PROGRAM LIKE SY-REPID,
LVS_COMM_TYPE TYPE AD_COMM,
LVS_COMM_VALUES TYPE SZADR_COMM_VALUES.
reset return code
RETCODE = 0.
if there is a communication strategy used ...
IF NOT NAST-TCODE IS INITIAL AND NAST-NACHA EQ '5'.
... use stratagy to get communication type
CALL FUNCTION 'ADDR_GET_NEXT_COMM_TYPE'
EXPORTING
STRATEGY = NAST-TCODE
ADDRESS_TYPE =
ADDRESS_NUMBER = VBDKA-ADRNR
PERSON_NUMBER = VBDKA-ADRNP
ADDRESS_NUMBER = ADDR_KEY-ADDRNUMBER
PERSON_NUMBER = ADDR_KEY-PERSNUMBER
IMPORTING
COMM_TYPE = LVS_COMM_TYPE
COMM_VALUES = LVS_COMM_VALUES
TABLES
STRATEGY_TABLE =
EXCEPTIONS
ADDRESS_NOT_EXIST = 1
PERSON_NOT_EXIST = 2
NO_COMM_TYPE_FOUND = 3
INTERNAL_ERROR = 4
PARAMETER_ERROR = 5
OTHERS = 6.
IF SY-SUBRC <> 0.
retcode = sy-subrc.
SYST-MSGTY = 'E'.
perform protocol_update.
ENDIF.
ENDIF.
convert communication data
MOVE-CORRESPONDING NAST TO LVS_SNAST.
MOVE SY-REPID TO LVF_PROGRAM.
CALL FUNCTION 'CONVERT_COMM_TYPE_DATA'
EXPORTING
PI_COMM_TYPE = LVS_COMM_TYPE
PI_COMM_VALUES = LVS_COMM_VALUES
PI_SCREEN = US_SCREEN
PI_NEWID =
PI_COUNTRY = US_COUNTRY
PI_REPID = LVF_PROGRAM
PI_SNAST = LVS_SNAST
IMPORTING
PE_ITCPO = LVS_ITCPO
PE_DEVICE = LVF_DEVICE
PE_MAIL_RECIPIENT = LVS_RECIPIENT
PE_MAIL_SENDER = LVS_SENDER
EXCEPTIONS
COMM_TYPE_NOT_SUPPORTED = 1
RECIPIENT_CREATION_FAILED = 2
SENDER_CREATION_FAILED = 3
OTHERS = 4.
IF SY-SUBRC <> 0.
RETCODE = SY-SUBRC.
SYST-MSGTY = 'E'.
PERFORM PROTOCOL_UPDATE.
ENDIF.
check retcode eq 0.
if there is no communication type
IF LVS_COMM_TYPE IS INITIAL.
set device
CASE NAST-NACHA.
WHEN '1'.
LVF_DEVICE = 'PRINTER'.
WHEN '2'.
LVF_DEVICE = 'TELEFAX'.
LVS_ITCPO-TDTELENUM = NAST-TELFX.
IF NAST-TLAND IS INITIAL.
LVS_ITCPO-TDTELELAND = US_COUNTRY.
ELSE.
LVS_ITCPO-TDTELELAND = NAST-TLAND.
ENDIF.
LVS_ITCPO-TDSENDDATE = NAST-VSDAT.
LVS_ITCPO-TDSENDTIME = NAST-VSURA.
LVS_ITCPO-TDFAXUSER = NAST-USNAM.
WHEN '3'.
LVF_DEVICE = 'TELETEX'.
LVS_ITCPO-TDTELENUM = NAST-TELTX.
IF NAST-TLAND IS INITIAL.
LVS_ITCPO-TDTELELAND = US_COUNTRY.
ELSE.
LVS_ITCPO-TDTELELAND = NAST-TLAND.
ENDIF.
LVS_ITCPO-TDSENDDATE = NAST-VSDAT.
LVS_ITCPO-TDSENDTIME = NAST-VSURA.
WHEN '4'.
LVF_DEVICE = 'TELEX'.
LVS_ITCPO-TDTELENUM = NAST-TELX1.
IF NAST-TLAND IS INITIAL.
LVS_ITCPO-TDTELELAND = US_COUNTRY.
ELSE.
LVS_ITCPO-TDTELELAND = NAST-TLAND.
ENDIF.
LVS_ITCPO-TDSENDDATE = NAST-VSDAT.
LVS_ITCPO-TDSENDTIME = NAST-VSURA.
WHEN OTHERS.
LVF_DEVICE = 'PRINTER'.
ENDCASE.
ENDIF.
fill structure itcpo
ITCPO = LVS_ITCPO.
open form
CALL FUNCTION 'OPEN_FORM'
EXPORTING
APPLICATION = 'TX'
ARCHIVE_INDEX = TOA_DARA
ARCHIVE_PARAMS = ARC_PARAMS
DEVICE = LVF_DEVICE
DIALOG = ' '
FORM = TNAPR-FONAM
LANGUAGE = NAST-SPRAS
OPTIONS = LVS_ITCPO
MAIL_SENDER = LVS_SENDER
MAIL_RECIPIENT = LVS_RECIPIENT
MAIL_APPL_OBJECT = ' '
RAW_DATA_INTERFACE = '*'
IMPORTING
LANGUAGE =
NEW_ARCHIVE_PARAMS =
RESULT =
EXCEPTIONS
CANCELED = 1
DEVICE = 2
FORM = 3
OPTIONS = 4
UNCLOSED = 5
MAIL_OPTIONS = 6
ARCHIVE_ERROR = 7
OTHERS = 8.
IF SY-SUBRC NE 0.
CASE SY-SUBRC.
WHEN 7.
RETCODE = SY-SUBRC.
SYST-MSGID = 'VN'.
SYST-MSGNO = '096'.
SYST-MSGTY = 'E'.
SYST-MSGV1 = NAST-KSCHL.
SYST-MSGV2 = NAST-KAPPL.
PERFORM PROTOCOL_UPDATE.
WHEN OTHERS.
RETCODE = SY-SUBRC.
PERFORM PROTOCOL_UPDATE.
ENDCASE.
ENDIF.
SET COUNTRY US_COUNTRY.
Regards -
Sending sapscript form through Email
Hi,
I modifyed a std sapscript form for customer statement and that output i want to send to the customer through Email.So now i need a help for further what are the steps need to be do for sending that form by email.Pls be in details so that for me easy to solve this.
Thanks,
Rajendra.Hi ,
I am using the below code to send the form output by mail but it is not working for me.pls correct my code where i want to change so that i can solve my issues.
DATA: itcpo LIKE itcpo,
tab_lines LIKE sy-tabix.
Variables for EMAIL functionality
DATA: maildata LIKE sodocchgi1.
DATA: mailpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
DATA: mailhead LIKE solisti1 OCCURS 1 WITH HEADER LINE.
DATA: mailbin LIKE solisti1 OCCURS 10 WITH HEADER LINE.
DATA: mailtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE.
DATA: mailrec LIKE somlrec90 OCCURS 0 WITH HEADER LINE.
DATA: solisti1 LIKE solisti1 OCCURS 0 WITH HEADER LINE.
parameter: p_email1 like somlreci1-receiver .
PERFORM send_form_via_email.
FORM SEND_FORM_VIA_EMAIL *
FORM send_form_via_email.
CLEAR: maildata, mailtxt, mailbin, mailpack, mailhead, mailrec.
REFRESH: mailtxt, mailbin, mailpack, mailhead, mailrec.
Creation of the document to be sent File Name
maildata-obj_name = 'TEST'.
Mail Subject
maildata-obj_descr = 'Subject'.
Mail Contents
mailtxt-line = 'Here is your file'.
APPEND mailtxt.
Prepare Packing List
PERFORM prepare_packing_list.
Set recipient - email address here!!!
mailrec-receiver = p_email1.
mailrec-rec_type = 'U'.
APPEND mailrec.
Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = maildata
put_in_outbox = ' '
TABLES
packing_list = mailpack
object_header = mailhead
contents_bin = mailbin
contents_txt = mailtxt
receivers = mailrec
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
OTHERS = 99.
ENDFORM.
Form PREPARE_PACKING_LIST
FORM prepare_packing_list.
CLEAR: mailpack, mailbin, mailhead.
REFRESH: mailpack, mailbin, mailhead.
DESCRIBE TABLE mailtxt LINES tab_lines.
READ TABLE mailtxt INDEX tab_lines.
maildata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( mailtxt ).
Creation of the entry for the compressed document
CLEAR mailpack-transf_bin.
mailpack-head_start = 1.
mailpack-head_num = 0.
mailpack-body_start = 1.
mailpack-body_num = tab_lines.
mailpack-doc_type = 'RAW'.
APPEND mailpack.
Creation of the document attachment
This form gets the OTF code from the SAPscript form.
If you already have your OTF code, I believe that you may
be able to skip this form. just do the following code, looping thru
your SOLISTI1 and updating MAILBIN.
PERFORM get_otf_code.
LOOP AT solisti1.
MOVE-CORRESPONDING solisti1 TO mailbin.
APPEND mailbin.
ENDLOOP.
DESCRIBE TABLE mailbin LINES tab_lines.
mailhead = 'TEST.OTF'.
APPEND mailhead.
Creation of the entry for the compressed attachment
mailpack-transf_bin = 'X'.
mailpack-head_start = 1.
mailpack-head_num = 1.
mailpack-body_start = 1.
mailpack-body_num = tab_lines.
mailpack-doc_type = 'OTF'.
mailpack-obj_name = 'TEST'.
mailpack-obj_descr = 'Subject'.
mailpack-doc_size = tab_lines * 255.
APPEND mailpack.
ENDFORM.
Form GET_OTF_CODE
FORM get_otf_code.
DATA: BEGIN OF otf OCCURS 0.
INCLUDE STRUCTURE itcoo .
DATA: END OF otf.
DATA: itcpo LIKE itcpo.
DATA: itcpp LIKE itcpp.
CLEAR itcpo.
itcpo-tdgetotf = 'X'.
Start writing OTF code
CALL FUNCTION 'OPEN_FORM'
EXPORTING
form = 'Z2006FICSE'
language = sy-langu
options = itcpo
dialog = ' '
EXCEPTIONS
OTHERS = 1.
CALL FUNCTION 'START_FORM'
EXCEPTIONS
error_message = 01
OTHERS = 02.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
window = 'MAIN'
EXCEPTIONS
error_message = 01
OTHERS = 02.
Close up Form and get OTF code
CALL FUNCTION 'END_FORM'
EXCEPTIONS
error_message = 01
OTHERS = 02.
MOVE-CORRESPONDING itcpo TO itcpp.
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
result = itcpp
TABLES
otfdata = otf
EXCEPTIONS
OTHERS = 1.
Move OTF code to structure SOLI form email
CLEAR solisti1. REFRESH solisti1.
LOOP AT otf.
solisti1-line = otf.
APPEND solisti1.
ENDLOOP.
ENDFORM.
Hope i can expect the feedback soon from you guys.
Thanks,
Rajendra. -
Need to Generate PDF file and send it to customer through email-ALV report
HI All,
I am having data in Internal table.
can we create PDF file with out having spool-request number.
My requirement is whenever user clicks on execute button the output is generated in PDF format automatically and then send it to customer through email.
I found few programs in SDN for generation PDF. But problem is everyone passing the spool request to the function module.
spool request will be generated whenever we click on print button.
Am I correct?.
Is there any other way to create spool request automatically. If so we can pass the this spool number to the function module.
Regards,
vinod.hi
For sending a mail, this code will help you.
Pls reward if help.
FORM send_mail_2 USING msgid msgno msgv1.
mailuser oder Gruppe like sy-uname default 'Ruckerk'.
DATA: express_hold_time LIKE sovaltime.
DATA: text LIKE sotxtinfo.
DATA: receiver LIKE somlreci1 OCCURS 0 WITH HEADER LINE.
MESSAGE ZF100 (FTP an UDB fehlgeschlagen)
text-msgid = msgid.
text-msgno = msgno.
text-msgv1 = msgv1.
text-msgv2 = ' '.
text-msgv3 = ' '.
text-msgv4 = ' '.
express_hold_time
express_hold_time-days = 01.
express_hold_time-h_min_sec = 240000.
receiver
receiver-receiver = mreceivr.
Gruppe von Empfängern
receiver-rec_type = 'C'.
und Expressmeldung ausgeben
receiver-express = 'X'.
APPEND receiver.
CALL FUNCTION 'MESSAGE_SEND_AS_MAIL'
EXPORTING
msgid = text-msgid
msgno = text-msgno
msgv1 = text-msgv1
msgv2 = text-msgv2
msgv3 = text-msgv3
TABLES
receivers = receiver.
IF sy-subrc <> 0.
WRITE:/ 'hat nicht geklappt', 'SY-SUBRC =', sy-subrc.
ENDIF.
PERFORM print_error_report.
Fehlermeldung zum Abbrechen des Report's ausgeben.
MESSAGE e398 WITH 'Jobabbruch' msgv1.
ENDFORM. " SEND_MAIL_2
Another Program:
*& Report ZSENDEMAIL *
*& Example of sending external email via SAPCONNECT *
REPORT zsendemail .
PARAMETERS: psubject(40) type c default 'Hello',
p_email(40) type c default '[email protected]' .
data: it_packing_list like sopcklsti1 occurs 0 with header line,
it_contents like solisti1 occurs 0 with header line,
it_receivers like somlreci1 occurs 0 with header line,
it_attachment like solisti1 occurs 0 with header line,
gd_cnt type i,
gd_sent_all(1) type c,
gd_doc_data like sodocchgi1,
gd_error type sy-subrc.
data: it_message type standard table of SOLISTI1 initial size 0
with header line.
*START-OF-SELECTION.
START-OF-SELECTION.
Perform populate_message_table.
*Send email message, although is not sent from SAP until mail send
*program has been executed(rsconn01)
PERFORM send_email_message.
*Instructs mail send program for SAPCONNECT to send email(rsconn01)
perform initiate_mail_execute_program.
*& Form POPULATE_MESSAGE_TABLE
Adds text to email text table
form populate_message_table.
Append 'Email line 1' to it_message.
Append 'Email line 2' to it_message.
Append 'Email line 3' to it_message.
Append 'Email line 4' to it_message.
endform. " POPULATE_MESSAGE_TABLE
*& Form SEND_EMAIL_MESSAGE
Send email message
form send_email_message.
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'.
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.
Add the recipients email address
clear it_receivers.
refresh it_receivers.
it_receivers-receiver = p_email.
it_receivers-rec_type = 'U'.
it_receivers-com_type = 'INT'.
it_receivers-notif_del = 'X'.
it_receivers-notif_ndel = 'X'.
append it_receivers.
Call the FM to post the message to SAPMAIL
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
exporting
document_data = gd_doc_data
put_in_outbox = 'X'
importing
sent_to_all = gd_sent_all
tables
packing_list = it_packing_list
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.
Store function module return code
gd_error = sy-subrc.
Get it_receivers return code
loop at it_receivers.
endloop.
endform. " SEND_EMAIL_MESSAGE
*& Form INITIATE_MAIL_EXECUTE_PROGRAM
Instructs mail send program for SAPCONNECT to send email.
form initiate_mail_execute_program.
wait up to 2 seconds.
if gd_error eq 0.
submit rsconn01 with mode = 'INT'
with output = 'X'
and return.
endif.
endform. " INITIATE_MAIL_EXECUTE_PROGRAM -
** JDBC Sender Adapter support custom module ...?
Hi friends,
Does JDBC Sender Adapter support custom module ? If it is how it wil work ?
Kind Regards,
Jeg P.Hi Kulwinder,
We want to separte the records (1:n) returned by JDBC sender adapter XML. ie. Split/Parse the records in XML and then send to BPM (one by one) instead of whole message . For that purpose, we want to write an adapter module.
Is this possible ?
Kind Regards,
Jeg P. -
Corrupt file attachment when sending sapscript form by mail
i have requirment to send sapscript through mail but when open my attachment it is giving file is corrupted.let me know where i am wrong
i am specifying the code here
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
* MAX_LINEWIDTH = 132
* ARCHIVE_INDEX = ' '
* COPYNUMBER = 0
* ASCII_BIDI_VIS2LOG = ' '
* PDF_DELETE_OTFTAB = ' '
* PDF_USERNAME = ' '
IMPORTING
bin_filesize = binfilesize
* BIN_FILE =
TABLES
otf = datab[]
lines = pdftab[]
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
ERR_BAD_OTF = 4
OTHERS = 5
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
REFRESH it_pdf[].
CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
EXPORTING
line_width_dst = '255'
TABLES
content_in = pdftab[]
content_out = it_pdf[]
EXCEPTIONS
err_line_width_src_too_long = 1
err_line_width_dst_too_long = 2
err_conv_failed = 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.
ELSE.
"Subject of the mail.
w_document_data-obj_name = 'MAIL_TO_HEAD'.
w_document_data-obj_descr = 'Regarding Mail Program by SAP ABAP'.
"Body of the mail
w_body_msg = 'This is body of mail msg.'.
APPEND w_body_msg TO i_body_msg.
CLEAR w_body_msg.
"Write Packing List for Body
DESCRIBE TABLE i_body_msg LINES g_tab_lines.
w_packing_list-head_start = 1.
w_packing_list-head_num = 0.
w_packing_list-body_start = 1.
w_packing_list-body_num = g_tab_lines.
w_packing_list-doc_type = 'RAW'.
APPEND w_packing_list TO i_packing_list.
CLEAR w_packing_list.
"Write Packing List for Attachment
w_packing_list-transf_bin = 'X'.
w_packing_list-head_start = 1.
w_packing_list-head_num = 0.
w_packing_list-body_start = 1.
DESCRIBE TABLE it_pdf LINES w_packing_list-body_num.
w_packing_list-doc_type = 'PDF'.
w_packing_list-obj_descr = 'PDF Attachment'.
w_packing_list-obj_name = 'PDF_ATTACHMENT'.
w_packing_list-doc_size = w_packing_list-body_num * 255.
APPEND w_packing_list TO i_packing_list.
CLEAR w_packing_list.
"Fill the document data and get size of attachment
w_document_data-obj_langu = sy-langu.
READ TABLE i_body_msg INTO w_body_msg INDEX g_tab_lines.
w_document_data-doc_size = ( g_tab_lines - 1 ) * 255 + STRLEN( w_body_msg ).
"Receivers List.
w_receivers-rec_type = 'U'."Internet address
w_receivers-receiver = p_mail.
w_receivers-com_type = 'INT'.
w_receivers-notif_del = 'X'.
w_receivers-notif_ndel = 'X'.
APPEND w_receivers TO i_receivers .
CLEAR:w_receivers.
"Function module to send mail to Recipients
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = w_document_data
put_in_outbox = 'X'
commit_work = 'X'
IMPORTING
sent_to_all = g_sent_to_all
TABLES
packing_list = i_packing_list
contents_bin = it_pdf
contents_txt = i_body_msg
receivers = i_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.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
else.
MESSAGE 'Mail Successfully Sent' type 'S'.
ENDIF.
Edited by: sam_ins123524 on Oct 8, 2010 9:31 AM
Edited by: sam_ins123524 on Oct 8, 2010 9:33 AM
Moderator message: subject corrected for you, please use a more descriptive one next time, also use code tags.
Edited by: Thomas Zloch on Oct 8, 2010 10:51 AMHi,
Once you get otf data, Use FM 'SX_OBJECT_CONVERT_OTF_PDF' to convert it to PDF. Then use CONTENT_BIN to send mail.
Refer below code:
* Converting OTF data to single line
LOOP AT I_OTF INTO WA_OTF.
CONCATENATE WA_OTF-TDPRINTCOM WA_OTF-TDPRINTPAR INTO WA_PDF.
MOVE WA_PDF TO WA_CONTENT_TXT.
APPEND WA_CONTENT_TXT TO I_CONTENT_TXT.
CLEAR: WA_CONTENT_TXT.
ENDLOOP.
* Converting to PDF Format
CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'
EXPORTING
FORMAT_SRC = C_OTF
FORMAT_DST = C_PDF
DEVTYPE = C_PRINTER
CHANGING
TRANSFER_BIN = WA_TRANSFER_BIN
CONTENT_TXT = I_CONTENT_TXT
CONTENT_BIN = I_CONTENT_BIN
OBJHEAD = WA_OBJHEAD
LEN = V_LEN_IN.
*- Send mail
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_DATA = L_WA_DOCUMENT_DATA
TABLES
OBJECT_CONTENT = I_CONTENT_BIN
RECEIVERS = L_I_RECEIVERS. -
Sending sapscript form to an external mail
i need to send sapscript form to an external mail like for example a yahoo mail from SAP. i need an ABAP code that performs this function. its urgent, please
1) REPORT PROGRAM - RSTXPDFT4 ,
FIRST GENERATE SPOOL REQUEST THEN DOWNLOAD SAPSCRIPT TO PDF FILE ON LOCAL PC.
2) copy this code to send this downloaded form to external mail -
*& Report ZGILL_SENDMAIL_PDF *
REPORT ZGILL_SENDMAIL_PDF .
INCLUDE ZGILL_INCMAIL. "SEE BELOW FOR INCLUDE PROGRAM CODE.
* DATA
DATA : itab LIKE tline OCCURS 0 WITH HEADER LINE.
DATA : file_name TYPE string.
data : path like PCFILE-PATH.
data : extension(5) type c.
data : name(100) type c.
* SELECTION SCREEN
PARAMETERS : receiver TYPE somlreci1-receiver lower case DEFAULT '[email protected]'.
PARAMETERS : p_file LIKE rlgrap-filename
OBLIGATORY DEFAULT 'C:TEMPSALARY_SLIP1.PDF'.
* AT SELECTION SCREEN
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CLEAR p_file.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
file_name = p_file.
* START-OF-SELECTION
START-OF-SELECTION.
PERFORM ml_customize USING 'Tst' 'Testing'.
PERFORM ml_addrecp USING receiver 'U'.
PERFORM upl.
PERFORM doconv TABLES itab objbin.
PERFORM ml_prepare USING 'X' extension name.
PERFORM ml_dosend.
SUBMIT rsconn01
WITH mode EQ 'INT'
AND RETURN.
* FORM
FORM upl.
file_name = p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = file_name
filetype = 'BIN'
TABLES
data_tab = itab
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
path = file_name.
CALL FUNCTION 'PC_SPLIT_COMPLETE_FILENAME'
EXPORTING
complete_filename = path
* CHECK_DOS_FORMAT =
IMPORTING
* DRIVE =
EXTENSION = extension
NAME = name
* NAME_WITH_EXT =
* PATH =
EXCEPTIONS
INVALID_DRIVE = 1
INVALID_EXTENSION = 2
INVALID_NAME = 3
INVALID_PATH = 4
OTHERS = 5
ENDFORM. "upl
**********************iNCLUDE pROGRAM*********************************************
*& Include ZGILL_INCMAIL *
* Data
DATA: docdata LIKE sodocchgi1,
objpack LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE,
objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE,
objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objhex LIKE solix OCCURS 10 WITH HEADER LINE,
reclist LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
DATA: tab_lines TYPE i,
doc_size TYPE i,
att_type LIKE soodk-objtp.
DATA: listobject LIKE abaplist OCCURS 1 WITH HEADER LINE.
* FORM
FORM ml_customize USING objname objdesc.
*----------- Clear Variables
CLEAR docdata.
REFRESH objpack.
CLEAR objpack.
REFRESH objhead.
REFRESH objtxt.
CLEAR objtxt.
REFRESH objbin.
CLEAR objbin.
REFRESH objhex.
CLEAR objhex.
REFRESH reclist.
CLEAR reclist.
REFRESH listobject.
CLEAR listobject.
CLEAR tab_lines.
CLEAR doc_size.
CLEAR att_type.
*--------- Set Variables
docdata-obj_name = objname.
docdata-obj_descr = objdesc.
ENDFORM. "ml_customize
* FORM
FORM ml_addrecp USING preceiver prec_type.
CLEAR reclist.
reclist-receiver = preceiver.
reclist-rec_type = prec_type.
APPEND reclist.
ENDFORM. "ml_customize
* FORM
FORM ml_addtxt USING ptxt.
CLEAR objtxt.
objtxt = ptxt.
APPEND objtxt.
ENDFORM. "ml_customize
* FORM
FORM ml_prepare USING bypassmemory whatatt_type whatname.
IF bypassmemory = ''.
*--------- Fetch List From Memory
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = listobject
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'LIST_FROM_MEMORY'.
ENDIF.
CALL FUNCTION 'TABLE_COMPRESS'
* IMPORTING
* COMPRESSED_SIZE =
TABLES
in = listobject
out = objbin
EXCEPTIONS
OTHERS = 1
IF sy-subrc <> 0.
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'TABLE_COMPRESS'.
ENDIF.
ENDIF.
* Header Data
* Already Done Thru FM
* Main Text
* Already Done Thru FM
* Packing Info For Text Data
DESCRIBE TABLE objtxt LINES tab_lines.
READ TABLE objtxt INDEX tab_lines.
docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
CLEAR objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'TXT'.
APPEND objpack.
* Packing Info Attachment
att_type = whatatt_type..
DESCRIBE TABLE objbin LINES tab_lines.
READ TABLE objbin INDEX tab_lines.
objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = att_type.
objpack-obj_name = 'ATTACHMENT'.
objpack-obj_descr = whatname.
APPEND objpack.
* Receiver List
* Already done thru fm
ENDFORM. "ml_prepare
* FORM
FORM ml_dosend.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = docdata
put_in_outbox = 'X'
commit_work = 'X' "used from rel. 6.10
* IMPORTING
* SENT_TO_ALL =
* NEW_OBJECT_ID =
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
* CONTENTS_HEX = objhex
* OBJECT_PARA =
* object_parb =
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
IF sy-subrc <> 0.
MESSAGE ID 'SO' TYPE 'S' NUMBER '023'
WITH docdata-obj_name.
ENDIF.
ENDFORM. "ml_customize
* FORM
FORM ml_spooltopdf USING whatspoolid.
DATA : pdf LIKE tline OCCURS 0 WITH HEADER LINE.
*-------------- Call Function
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = whatspoolid
TABLES
pdf = pdf
EXCEPTIONS
err_no_otf_spooljob = 1
OTHERS = 12.
*------------- Convert
PERFORM doconv TABLES pdf objbin.
ENDFORM. "ml_spooltopdf
* FORM
FORM doconv TABLES
mypdf STRUCTURE tline
outbin STRUCTURE solisti1.
*-------- Data
DATA : pos TYPE i.
DATA : len TYPE i.
*------------ Loop And Put Data
LOOP AT mypdf.
pos = 255 - len.
IF pos > 134. "length of pdf_table
pos = 134.
ENDIF.
outbin+len = mypdf(pos).
len = len + pos.
IF len = 255. "length of out (contents_bin)
APPEND outbin.
CLEAR: outbin, len.
IF pos < 134.
outbin = mypdf+pos.
len = 134 - pos.
ENDIF.
ENDIF.
ENDLOOP.
IF len > 0.
APPEND outbin.
ENDIF.
ENDFORM. "doconv
***********************INCLUDE END********************************* -
Is there a way in PeopleSoft CRM 9.1 to send customers a customer satisfaction survey after their HR Helpdesk case has been resolved(other than Workforce Communications)?
Hello,
Could you please let me know if there is any way in PeopleSoft CRM 9.1 to send customers a customer satisfaction survey after their HR helpdesk case has been resolved(we do not have the 'Marketing' and 'Workforce Communications' menu options) ? -
Sending SAPSCRIPT through email
Hi
I want to send sapscript to the external email address.
Can anybody explain me how todo that.
ThanksHi subsar,
1. First we have to
execute the sapscript
thru our program.
2. Then we need to use
READ_OTF_FROM_MEMORY
to FETCH the sapscript
information into internal table.
3. The using FM
'SO_NEW_DOCUMENT_ATT_SEND_API1'
we can attach the intenal table (2)
above, and send mail as attachment.
4. SEE F1 help on this FM
(if uare doing for the first time)
5. Morever, SCOT settings
are required (take help of basis team)
regards,
amit m. -
We're sending an OSS customer message on WDr_TEST_EVENTS (ABAP component)
Here's the text of the message we're sending
Although the ABAP WebDynpro component WDR_TEST_EVENTS shows as Active in SE80 on our NW2004s system, we get a run time error if we try to run the associated application (see Exhibit A on page 1 of attachment.)
If we try to re-activate the component, we get the error shown in Exhibit B on page 1 of attachment.
We're sending an OSS Customer Message on WDR_TEST_EVENTS (ABAP Component)
If we choose Web Dynpro Component > Check > Complete Object from the Menu Bar, we get the compile error shown on pages 2 and 3 of the attachment.
Here is the release info for our NW2004s system.
SAP_ABA 700 0008 SAPKA70008 Cross-Application Component
SAP_BASIS 700 0008 SAPKB70008 SAP Basis Component
PI_BASIS 2005_1_700 0008 SAPKIPYJ78 PI_BASIS 2005_1_700
SAP_BW 700 0008 SAPKW70008 SAP NetWeaver BI 7.0
The "NULL object reference" error we get when running the complete object check is in the constructor method of CL_WDY_MD_VIEW_ELEMENT - line 119:
if sy-uname <> 'ROSENBERGERC'.
me->ui_element_definition->if_wdy_md_object~get_definition( importing definition = wa_wdy_ui_elem_def ).
else.
me->ui_element_definition->if_wdy_md_object~get_definition( importing definition = wa_wdy_ui_elem_def ).
endif.
According to Rich H, this component works fine on his sneak preview edition.
So if someone can send me a copy of the constructor method of CL_WDY_MD_VIEW_ELEMENT from the ABAP sneak preview edition, I'd like to compare it to see what the problem is in our copu.Sent to your email. I have included the source from Sneak Preview SP08.
Regards,
Rich Heilman -
Sending sapscript form by email
dear experts
i want to send sapscript forms by email from sap. how is it done. is there any configuration that needs to be doneHello,
I have done in case where we are sending to an external mail id.
Check the code it may help u.
REPORT Z_SCRIPT .
DATA: itcpo LIKE itcpo,
tab_lines LIKE sy-tabix.
Variables for EMAIL functionality
DATA: maildata LIKE sodocchgi1.
DATA: mailpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
DATA: mailhead LIKE solisti1 OCCURS 1 WITH HEADER LINE.
DATA: mailbin LIKE solisti1 OCCURS 10 WITH HEADER LINE.
DATA: mailtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE.
DATA: mailrec LIKE somlrec90 OCCURS 0 WITH HEADER LINE.
DATA: solisti1 LIKE solisti1 OCCURS 0 WITH HEADER LINE.
PERFORM send_form_via_email.
FORM SEND_FORM_VIA_EMAIL *
FORM send_form_via_email.
CLEAR: maildata, mailtxt, mailbin, mailpack, mailhead, mailrec.
REFRESH: mailtxt, mailbin, mailpack, mailhead, mailrec.
Creation of the document to be sent File Name
maildata-obj_name = 'TEST'.
Mail Subject
maildata-obj_descr = 'Subject'.
Mail Contents
mailtxt-line = 'Here is your file'.
APPEND mailtxt.
Prepare Packing List
PERFORM prepare_packing_list.
Set recipient - email address here!!!
mailrec-receiver = '[email protected]'.
mailrec-rec_type = 'U'.
APPEND mailrec.
Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = maildata
put_in_outbox = ' '
TABLES
packing_list = mailpack
object_header = mailhead
contents_bin = mailbin
contents_txt = mailtxt
receivers = mailrec
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
OTHERS = 99.
ENDFORM.
Form PREPARE_PACKING_LIST
FORM prepare_packing_list.
CLEAR: mailpack, mailbin, mailhead.
REFRESH: mailpack, mailbin, mailhead.
DESCRIBE TABLE mailtxt LINES tab_lines.
READ TABLE mailtxt INDEX tab_lines.
maildata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( mailtxt ).
Creation of the entry for the compressed document
CLEAR mailpack-transf_bin.
mailpack-head_start = 1.
mailpack-head_num = 0.
mailpack-body_start = 1.
mailpack-body_num = tab_lines.
mailpack-doc_type = 'RAW'.
APPEND mailpack.
Creation of the document attachment
This form gets the OTF code from the SAPscript form.
If you already have your OTF code, I believe that you may
be able to skip this form. just do the following code, looping thru
your SOLISTI1 and updating MAILBIN.
PERFORM get_otf_code.
LOOP AT solisti1.
MOVE-CORRESPONDING solisti1 TO mailbin.
APPEND mailbin.
ENDLOOP.
DESCRIBE TABLE mailbin LINES tab_lines.
mailhead = 'TEST.OTF'.
APPEND mailhead.
Creation of the entry for the compressed attachment
mailpack-transf_bin = 'X'.
mailpack-head_start = 1.
mailpack-head_num = 1.
mailpack-body_start = 1.
mailpack-body_num = tab_lines.
mailpack-doc_type = 'OTF'.
mailpack-obj_name = 'TEST'.
mailpack-obj_descr = 'Subject'.
mailpack-doc_size = tab_lines * 255.
APPEND mailpack.
ENDFORM.
Form GET_OTF_CODE
FORM get_otf_code.
DATA: BEGIN OF otf OCCURS 0.
INCLUDE STRUCTURE itcoo .
DATA: END OF otf.
DATA: itcpo LIKE itcpo.
DATA: itcpp LIKE itcpp.
CLEAR itcpo.
itcpo-tdgetotf = 'X'.
Start writing OTF code
CALL FUNCTION 'OPEN_FORM'
EXPORTING
form = 'Z08V3_COLLI'
language = sy-langu
options = itcpo
dialog = ' '
EXCEPTIONS
OTHERS = 1.
CALL FUNCTION 'START_FORM'
EXCEPTIONS
error_message = 01
OTHERS = 02.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
window = 'MAIN'
EXCEPTIONS
error_message = 01
OTHERS = 02.
Close up Form and get OTF code
CALL FUNCTION 'END_FORM'
EXCEPTIONS
error_message = 01
OTHERS = 02.
MOVE-CORRESPONDING itcpo TO itcpp.
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
result = itcpp
TABLES
otfdata = otf
EXCEPTIONS
OTHERS = 1.
Move OTF code to structure SOLI form email
CLEAR solisti1. REFRESH solisti1.
LOOP AT otf.
solisti1-line = otf.
APPEND solisti1.
ENDLOOP.
ENDFORM.
I am sending to [email protected].
So proceed in similar manner and let me know if u face any problem.
Regards -
Two problems encountered while trying to send out a customized digital signal (TTL)
I'm trying to write a labview program to send out a customized TTL signal when it's triggered.
The error message showed that "start trigger" is not supported but I followed the example "Write Dig Chan-Int Clk-Dig Start.vi" which uses start trigger. If start trigger can't be use, what should I modified my code so it can be triggered from hardware?
The other error is 200463 which I can understand the description shown in error message but have no ideal how to correct it.
Can anyone please help me with these? Attachment is the code. Thank you.
Attachments:
Customized DO.png 23 KB
Untitled 2.vi 22 KBWhat is your hardware? The "not supported" error message usually means that the device you are using is not capable of what you are asking it to do, in this case a digital start trigger. The help for the examples often lists devices with which that particular example will work. Is your device on the list? Does the device manual specify that it can use a digital start trigger?
Lynn -
Sending SAPSCRIPT in PDF through email
Hi everybody,
I'm trying to send via email a sapscript. I red more posts regarding this issue but nothing seems to run correctly.
Some posts refers to a sample program ZRICH_0003.
I've just copied the code and replaced the form's name with one of mine and run it.
The function SO_NEW_DOCUMENT_ATT_SEND_API1 return with error code 2 (document not sent). I really don't know why. I've just run it in two different SAP (4.7 and 5.0)
Both didn't work. Both systems are UNIX. Must I do something in customizing or some RFC definition?
Is there anybody that have a simple program that uses this function?
Thanks in advance
Fabrizioi have tried the same thing. first generating spool & then convering sppol to PDF.
REPORT ZPO_PDF NO STANDARD PAGE HEADING
LINE-SIZE 254.
converts list to PDF - send via mail as attachment
TABLES: adrp, "Persons (central address administration)
bhdgd, "Common data area batch heading routine
bsik, "Accounting: Secondary Index for Vendors
usr21. "Assign user name address key
General data definition
TYPE-POOLS: icon.
TYPE-POOLS: slis.
DATA: d_linsz LIKE sy-linsz.
Constants
CONSTANTS: c_yes(1) TYPE c VALUE 'X'.
Structures
DATA: e_variant TYPE disvariant.
Selection-screen
DATA: le_parameters LIKE pri_params.
DATA: l_valid(1) TYPE c.
DATA: lt_pdf TYPE TABLE OF tline WITH HEADER LINE.
DATA: l_spool_c LIKE tsp01_sp0r-rqid_char.
DATA: l_spool_i LIKE tsp01-rqident,
_RECEIVER LIKE bsik-xref3.
Get the SPOOL number
PARAMETERS:
spoolno LIKE TSP01-RQIDENT.
l_spool_i = spoolno.
DATA: NUMBYTES TYPE I,
ARC_IDX LIKE TOA_DARA,
pdfspoolid like tsp01-rqident,
jobname like tbtcjob-jobname,
jobcount like tbtcjob-jobcount,
is_otf.
DATA PDF LIKE TLINE OCCURS 100 WITH HEADER LINE.
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
SRC_SPOOLID = l_spool_i
NO_DIALOG = ' '
DST_DEVICE =
PDF_DESTINATION =
IMPORTING
PDF_BYTECOUNT = numbytes
PDF_SPOOLID = pdfspoolid
OTF_PAGECOUNT =
BTC_JOBNAME = jobname
BTC_JOBCOUNT = jobcount
TABLES
PDF = lt_pdf
EXCEPTIONS
ERR_NO_OTF_SPOOLJOB = 1
ERR_NO_SPOOLJOB = 2
ERR_NO_PERMISSION = 3
ERR_CONV_NOT_POSSIBLE = 4
ERR_BAD_DSTDEVICE = 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.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Build the mail
PERFORM build_mail
TABLES lt_pdf
USING _receiver.
FORM prepare_print_format USING parameters LIKE priparams.
DATA: BEGIN OF lt_report_source OCCURS 0,
line(72) TYPE c,
END OF lt_report_source.
DATA: l_string_linsz TYPE string.
DATA: l_tabix LIKE sy-tabix.
DATA: BEGIN OF lt_sentencia OCCURS 0,
line(72) TYPE c,
END OF lt_sentencia.
DATA: lt_tsp1d TYPE TABLE OF tsp1d WITH HEADER LINE.
READ REPORT sy-repid INTO lt_report_source.
CHECK sy-subrc = 0.
CLEAR: l_tabix.
WHILE NOT l_string_linsz CS '.'.
ADD 1 TO l_tabix.
READ TABLE lt_report_source
INDEX l_tabix.
TRANSLATE lt_report_source-line TO UPPER CASE.
IF l_string_linsz CS 'REPORT'
OR lt_report_source-line CS 'REPORT'.
CONCATENATE l_string_linsz
lt_report_source-line
INTO l_string_linsz
SEPARATED BY space.
CONDENSE l_string_linsz.
ENDIF.
ENDWHILE.
TRANSLATE l_string_linsz USING '. '.
CLEAR: lt_report_source.
REFRESH: lt_report_source.
FREE: lt_report_source.
SPLIT l_string_linsz AT space INTO TABLE lt_sentencia.
LOOP AT lt_sentencia
WHERE line CS 'LINE-SIZE'.
l_tabix = sy-tabix.
EXIT.
ENDLOOP.
ADD 1 TO l_tabix.
READ TABLE lt_sentencia
INDEX l_tabix.
SELECT *
INTO CORRESPONDING FIELDS OF TABLE lt_tsp1d
FROM tsp1d
WHERE type = 'L'
AND outcolumns >= lt_sentencia-line.
SORT lt_tsp1d
BY outcolumns.
READ TABLE lt_tsp1d
INDEX 1.
parameters-linct = lttsp1d-outrows.
parameters-linsz = ltsentencia-line.
parameters-paart = lttsp1d-papart.
ENDFORM. " prepare_print_format
FORM build_mail TABLES tpdf STRUCTURE tline
USING _receiver TYPE c.
DATA: l_length_t_pdf TYPE i.
DATA: l_string TYPE xstring.
DATA: l_string_bck TYPE string.
DATA: l_length_string TYPE i.
DATA: l_length_objbin TYPE i.
DATA: l_max_tabix TYPE i.
DATA: l_dif TYPE i.
DATA: l_hex_null TYPE x VALUE '00'.
DATA: lt_objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE.
DATA: l_tab_lines LIKE sy-tabix.
DATA: le_doc_chng LIKE sodocchgi1.
DATA: lt_objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
DATA: lt_objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE.
DATA: lt_reclist LIKE somlreci1 OCCURS 5 WITH HEADER LINE.
DATA: lt_contents_bin LIKE solisti1 OCCURS 0 WITH HEADER LINE.
Mail text
(...here you should fill table lt_objtxt-line)
lt_objtxt-line = 'First line of text'.
append lt_objtxt.
lt_objtxt-line = 'Second line'.
append lt_objtxt.
DESCRIBE TABLE lt_objtxt LINES l_tab_lines.
READ TABLE lt_objtxt INDEX l_tab_lines.
le_doc_chng-doc_size = ( l_tab_lines - 1 ) * 255
+ STRLEN( lt_objtxt ).
le_doc_chng-obj_descr = 'PO in PDF By mail'.
CLEAR lt_objpack-transf_bin.
lt_objpack-head_start = 1.
lt_objpack-head_num = 0.
lt_objpack-body_start = 1.
lt_objpack-body_num = l_tab_lines.
lt_objpack-doc_type = 'RAW'.
APPEND lt_objpack.
Attached file, in PDF-format
DESCRIBE FIELD tpdf LENGTH l_length_t_pdf.
CLEAR: l_string_bck,
l_string.
LOOP AT tpdf.
CONCATENATE l_string_bck tpdf INTO l_string_bck.
l_dif = l_length_t_pdf - STRLEN( tpdf ).
DO l_dif TIMES.
CONCATENATE l_string_bck l_hex_null INTO l_string_bck.
ENDDO.
CONCATENATE l_string tpdf INTO l_string.
ENDLOOP.
sy-subrc = 0.
WHILE sy-subrc = 0.
REPLACE l_hex_null WITH space INTO l_string_bck.
ENDWHILE.
l_length_string = strlen( l_string_bck ).
DESCRIBE FIELD lt_contents_bin LENGTH l_length_objbin.
l_max_tabix = ceil( l_length_string / l_length_objbin * '1.0' ).
DO l_max_tabix TIMES.
lt_contents_bin = l_string_bck.
APPEND lt_contents_bin.
IF sy-tabix <> l_max_tabix.
l_string_bck = l_string_bck+l_length_objbin.
ENDIF.
ENDDO.
DESCRIBE TABLE lt_contents_bin LINES l_tab_lines.
APPEND lt_objhead.
lt_objpack-transf_bin = c_yes.
lt_objpack-head_start = 1.
lt_objpack-head_num = 1.
lt_objpack-body_start = 1.
lt_objpack-body_num = l_tab_lines.
lt_objpack-doc_type = 'PDF'.
lt_objpack-doc_size = ( l_tab_lines - 1 ) * 255.
LOOP AT lt_contents_bin.
ENDLOOP.
lt_objpack-doc_size = lt_objpack-doc_size + STRLEN( lt_contents_bin ).
APPEND lt_objpack.
lt_reclist-receiver = 'testmailgmail.com'.
lt_reclist-rec_type = 'U'.
APPEND lt_reclist.
Finally! we send the mail
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = le_doc_chng
put_in_outbox = c_yes
TABLES
packing_list = lt_objpack
object_header = lt_objhead
contents_bin = lt_contents_bin
contents_hex =
contents_txt = lt_objtxt
receivers = lt_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.
ENDFORM. " build_mail -
Send email from custom workflow to group
Hi!
We have Office 365 A2 Plan subscription. We use InfoPath form to submit travel request and custom 2013 workflow made in Sharepoint Designer 2013 to route that form for approval.
If we send email using workflow to individual user it works fine.
Problem occurs when we try to send email to group. we can't send email to security group made in office 365, distribution group from exchange online or security group in exchange online.
My question is: is there any kind of group inside Office 365 (Sharepoint Online or Exchange online) that we can send mail to using workflow and if that is possible, how can we do that?
Thank you,
SDIt is simple powershell script and without such small changes it may not work
May be Office365 team might have given you there AD. If users are in your AD then you need t make sure normally users from outside org can send you email on that email address.
Try to use this email address in Office365 and check if that helps. mostly without AD sync it is difficult -
How to send Email to customer when clicked on hyperlink on SAP CRM web UI
Hi all,
I am working with SAP CRM 7.0 EHP1. I have one field named Email on Complaint description page on Web client UI. I have made the field a hyperlink by using the setter getter methods of attribute in component workbench for the component -BT120H_CPL. Now I want to send one mail to customer who have raised the complaint when clicked on the hyperlink Email through SAP CRM if possible or by using Microsoft outlook(Microsoft outlook is default mailing server on the system).
Please help !
Thanks and regards,
Kavita Chaudhary
Mobile: 8800222151Hi kavitha Chaudhary,
if you wan to send any details to outside mail id first you should get that person mail id. based on that you can send data to that mail id by using this code...
just fallow this code in your event..
DATA: send_request TYPE REF TO cl_bcs.
DATA: text TYPE bcsy_text.
DATA: document TYPE REF TO cl_document_bcs.
DATA: sender TYPE REF TO cl_sapuser_bcs.
DATA: recipient TYPE REF TO if_recipient_bcs.
DATA: bcs_exception TYPE REF TO cx_bcs.
DATA: sent_to_all TYPE os_boolean.
TRY.
* -------- create persistent send request ------------------------
send_request = cl_bcs=>create_persistent( ).
* -------- create and set document -------------------------------
* create document from internal table with text
APPEND 'Hi to all' TO text.
document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = text
i_length = '12'
i_subject = 'test created by srinivas' ).
* add document to send request
CALL METHOD send_request->set_document( document ).
sender = cl_sapuser_bcs=>create( sy-uname ).
CALL METHOD send_request->set_sender
EXPORTING
i_sender = sender.
* hardcoded value im passing here u should capture customer mail id here..
data : lv_email type string.
lv_email = '[email protected]'.
* --------- add recipient (e-mail address) -----------------------
* create recipient - please replace e-mail address !!!
recipient = cl_cam_address_bcs=>create_internet_address(
lv_email ).
* add recipient with its respective attributes to send request
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = 'X'.
* ---------- send document ---------------------------------------
CALL METHOD send_request->send(
EXPORTING
i_with_error_screen = 'X'
RECEIVING
result = sent_to_all ).
IF sent_to_all = 'X'.
WRITE text-003.
ENDIF.
COMMIT WORK.
* * exception handling
* * replace this very rudimentary exception handling
* * with your own one !!!
CATCH cx_bcs INTO bcs_exception.
WRITE: text-001.
WRITE: text-002, bcs_exception->error_type.
EXIT.
ENDTRY.
after this go to sost transaction.
first you can see first mail.. select your recent mail id execute then you will get email..
try this and let me know..
if this is not working then see this link too this might be help full to you.
Hyperlink in Email using Send Mail Activity
Thanks & Regards,
Srinivask.
Maybe you are looking for
-
To change the font of a selected row in a Jtable
Hello, Is it possible to change the font of a selected row in a jtable? i.e. if all the table is set to a bold font, how would you change the font of the row selected to a normal (not bold) font? thank you.
-
After purchasing a song in the iTunes store, the song was downloaded, but when I went to play it, it was not completely recorded. How can I get a refund or download it again without being charged again on my account?
-
Execution of several statements
I want to execute several statements in one turn. After reading the API I found out that I must use execute(String sql) to perform these multiple statements. But when I put this text below in the argument list of Statement stmt = new Statement(); stm
-
Hello, I've been trying to create a script in Visual Basic to find text in a document and replace it with a graphic. A tutorial I found mentioned that the Adobe site had a pre-made script called ReplaceTextWithGraphic for download on http://www.adobe
-
Freezing of Picture/Tech Service Failed To Show Up On 3 Separate Repair Calls
Have had U-verse TV over one year without problems. Four days ago, picture freezing started with wireless receiver only. Wired receiver in other location works fine. Did all troubleshooting procedures, ie.reboots, etc. as recommended to no avail.