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 done
Hello,
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
Similar Messages
-
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. -
Hi - I created a form in Adobe Livecycle and have a button on it to send the form via email. It worked, but only for those with PC. However, I could not get it to work with Apple loaded with Yosemite even with reader installed . Is there a way i can make it work for apple / Mac? It worked fine on a mac using Mountain Lion and reader
ThanksLiveCycle = XFA forms.
afaik - These cannot be used in Apple OSs.
Be well... -
Hi - I created a form in Adobe Livecycle and have a button on it to send the form via email. the button did not work and i looked online and saw where you could change it to a regular button and enter the email for it to go. it worked, but only for those with adobe pro. i could not get it to work with reader. is there a way i can make it work for reader?
Noted.
The LiveCycle user to user forum is across town at:
Adobe LiveCycle
Be well... -
Need to send Smart form via email through Driver program
Hi All,
We need to send smart form via email through a new driver program (z program). Can you please guide me on this.
I have used the following code to achieve this. We are getting message saying 'Mail request has created' when executed, but the mail is not sent.
lvs_comm_type = 'INT'.
lvs_comm_values-adsmtp-SMTP_ADDR = e_mail.
lvs_comm_values-adsmtp-R3_USER = 'X'.
lvs_comm_values-adsmtp-ENCODE = '0'.
call function 'CONVERT_COMM_TYPE_DATA'
exporting
pi_comm_type = lvs_comm_type
pi_comm_values = lvs_comm_values
pi_screen = ' '
pi_newid = 'X'
importing
pe_itcpo = lvs_itcpo
pe_device = lvf_device
pe_mail_recipient = p_mail_recipient
pe_mail_sender = p_mail_sender
exceptions
comm_type_not_supported = 1
recipient_creation_failed = 2
sender_creation_failed = 3
others = 4.
if sy-subrc ne 0.
raise COMMUNICATION_ERROR.
endif.
control_parameters-device = 'MAIL'.
output_options-TDIMMED = 'X'.
output_options-TDDELETE = 'X'.
CALL FUNCTION fm_name
exporting
CONTROL_PARAMETERS = control_parameters
MAIL_RECIPIENT = mail_recipient
MAIL_SENDER = mail_sender
OUTPUT_OPTIONS = output_options
USER_SETTINGS = space
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5.
Thank youHi,
For sending smartform output into mail you first have to generate spool request and convert it into PDF and then
only it can be sended into mail, please find the sample code in the mail below:
http://wiki.sdn.sap.com/wiki/display/sandbox/ConversionofSpoolRequestDataintoPDFandExcelFormatandSenditintoMail
Mansi
Edited by: Matt on Jan 29, 2010 8:25 AM - removed code, instead point to wiki that Mansi authored. -
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********************************* -
SapScript Form by email: Using output medium 5 - several email address
Hello, ppl
I've been doing some developing concerning the send of correspondence by email.
I've used output medium 5, and have have build email recipient parameters as follow:
Getting email address:
CLEAR address.
SELECT SINGLE smtp_addr FROM adr6
INTO address
WHERE addrnumber = p_adrnr
AND persnumber = space
AND flgdefault = 'X'.
IF address IS INITIAL.
p_device = 'PRINTER'.
EXIT.
ENDIF.
create recipient
swc_create_object lo_recipient 'RECIPIENT' space.
swc_set_element lt_container 'SendAsACopy'
'X'.
swc_set_element lt_container 'AddressString'
address.
swc_set_element lt_container 'TypeID'
'U'.
swc_call_method lo_recipient 'CreateAddress' lt_container.
swc_object_to_persistent lo_recipient p_persistent_recipient.
create sender (current user)
swc_create_object lo_sender 'RECIPIENT' space.
swc_set_element lt_container 'AddressString'
sy-uname.
swc_set_element lt_container 'TypeID' 'B'.
swc_call_method lo_sender 'CreateAddress' lt_container.
swc_object_to_persistent lo_sender p_persistent_sender.
And have called open_form as follows:
CALL FUNCTION 'OPEN_FORM'
EXPORTING form = xformular
language = ekko-spras
OPTIONS = itcpo
archive_index = toa_dara
archive_params = arc_params
device = xdevice
dialog = xdialog
mail_sender = p_persistent_sender
mail_recipient = p_persistent_recipient
EXCEPTIONS canceled = 01.
IF sy-subrc NE 0.
PERFORM protocol_update USING '142' ekko-ebeln space space space.
retco = sy-subrc.
EXIT.
ENDIF.
Everything works fine ... problem is i need to send the email to several adresses and also add some as CC: instead of TO: in the email parameters.
Is this possible?
As far as i know mail_ricipient only allows one email reference ...
Please, provide some help.
Thanks,
MárioLOOP AT <receiver_table>.
w_email = <receiver_table-mailid.
*-- Create persistent send request
send_request = cl_bcs=>create_persistent( ).
*--Add document to send request
CALL METHOD send_request->set_document( document ).
*-- Get sender object
sender = cl_sapuser_bcs=>create(<Sender mailid / userid ).
*--Add sender
CALL METHOD send_request->set_sender
EXPORTING
i_sender = sender.
recipient = cl_cam_address_bcs=>create_internet_address( w_email ).
RECIPIENT = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS( P_RECVR ).
*--Add recipient with its respective attributes to send request
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient.
*--set send immediately flag
send_request->set_send_immediately( 'X' ).
*--Send document
CALL METHOD send_request->send( ).
COMMIT WORK.
endloop. -
Send PDF form to email address user enters in textfield on form.
I would like to be able to allow the person using the form to choose what email address the PDF form is emailed to. I read this post which sounds like what I want but I keep getting a Submit Cancelled error. The email does get generated and the form is attached as a PDF so that part works okay.
http://forums.adobe.com/message/4167414#4167414
This is the code I am using as I only need the To: address populated.
form1.Page1.Button1::preSubmit:form - (JavaScript, client)
var strToAddress
//Capture the values from the form fields.
strToAddress = txtToAddress.rawValue;
event.target.submitForm({cURL:"mailto:"+ strToAddress,cSubmitAs:"PDF",cCharset:"utf-8"});Hi,
There is an example here: http://assure.ly/eUR4wJ.
// Declare the variable
var vEmail;
// Check that the email field is not null
if (txtToAddress.rawValue !== null) {
vEmail = txtToAddress.rawValue;
// Send email
event.target.submitForm({cURL:"mailto: " + vEmail + "?subject=&body=",cSubmitAs:"PDF",cCharset:"utf-8"});
Niall -
How to send offline forms as email in Portal level.
hello friends,
i am struck with a task.I need to send adobe forms as attachment to email to non sap users(i,e offline mode).this task has to be configured for managers using mss service(i.e through portal)...
how this can be done?
any material will be highly appreciated.Hi,
Try to use this one
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
Hope it can solve your problem!
Good luck!
Tao -
Send Smart Forms within emails (html) Problems with format
Dear all,
the ABAP report SF_XSF_DEMO1 is a demo report which converts a certain smart form into HTML and then sends it as an email in html format.
Sending the email is possible without any problems but I am wondering about the email format.
<a href="http://www.imgbox.de/show/img/e4QvgzsS4L.jpg" title="Bilder hochladen">This screenshot shows how the email looks like.</a>
I am not happy with the email layout as the Smart Form "SF_XSF_DEMO1" is designed in a different way.
What do I have to adapt within the report in order to send an email that really looks like the Smart Form? Or is it a customizing issue?
(I would like to avoid having to send the Smart Form as PDF attachment...)
Thanks for you help!
Kristian KindlerHi Kristian,
When ever you send a smartform output as an HTML email, the system generates automatic style sheets which are not supported in many email clients such as Outlook 2007, hence you will face a formatting issue. We faced the same issue and had do it it like this:
Build a BSP page similar to the output which you want to send as an email. Now you can use the BSP URL to send the html email using cl_bcs class.
I have documented this in my article below-
http://divulgesap.com/blog.php?p=NDA=
Hope it helps.
Regards,
Ravikiran -
hi all,
Does anybody knows what all parameters to be passed to FM 'FP_JOB_OPEN' to send the adobe form as an email .Jay,
Have a look at this [thread|Re: Sending PDF forms (created using SFP) as Email Attachment;
Chintan -
Sending Adobe forms through Email and Fax
Hi ,
I have created an Adobe Form i.e. PO Form,
whose print/driver program is customised / based on SAPFM06P and routine used is ADOBE_ENTRY_NEU.
So , now I use the transaction ME22N and use the External Send option i.e sending Email , but the Email is getting sent to Spool instead of SOST.
So what changes do I need to make .
Can anyone tell me how do we send an Adobe Form through email * in which routine is based on Adobe_entry_neu .
Thanks in advance,
RohitHi,
Thanks for reply
The link u mentioned utilises Objects.. but can we send internet mail using this?
As we cannot change RECIPIENT TYPE in this case in the object.
I used this format in the program but the attachment is going to EXpress inbox. and goes to my SAP Inbox instead of Email .
So what changes we need to do for this.
Alternatively, can we use FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' for this purpose?
Edited by: Rohit Pareek on Feb 3, 2009 3:36 PM -
Unable send ADOBE form through email as attachment
Hello experts,
I was trying the [tutorial |https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/ee8a84ea-0c01-0010-5691-accfb0a172ed] on ADOBE interactive form through GP.
I am not able to send a form as an attachment as specifies in the document.
I have checked for all the required settings mentioned in the document and all seems to be ok.
Can anyone please provide a ray of help on how do I enable a ADOBE form to be passed as an attachment through email.
Thank you.
AshutoshHi,
just use a "Standard button", select it and go to the "Object" -> "Field" tab. Set the control type to "Submit". Go to the "Submit" tab. Set the submit format (e.g. PDF) and set the URL to "mailto:<receiver's email address>".
This will work fine without any JavaScript.
Take care,
Thomas -
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. -
Send Adobe form as email attachment
Hello Experts,
Recently iu2019m facing a problem regarding Adobe form PDF attachment and sending an e-mail along with the PDF attachment to customer mail id.But when i execute the RFC Function module, in customer side no mail is comming. And when i check the transaction SBWP then i found that the PDF attachment hold only 1KB of data which is not right.For that iu2019m sending my code which i was declared in my program.Can anybody Please help me to overcome this problem?
FORM print_form USING p_disp TYPE char1
drb_mail TYPE char1
p_email LIKE itcpo-tdcovtitle
p_email1 LIKE itcpo-tdcovtitle.
DATA ds_recipient TYPE swotobjid.
CLEAR: dg_funcnam, dg_outputparams.
*--Call generated function module
CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
EXPORTING
i_name = c_form
IMPORTING
e_funcname = dg_funcnam.
dg_outputparams-nodialog = 'X'.
dg_outputparams-getpdf = 'X'.
Job Open for PDF
CALL FUNCTION 'FPCOMP_JOB_OPEN'
CHANGING
ie_outpar = dg_outputparams
EXCEPTIONS
cancel = 1
usage_error = 2
system_error = 3
internal_error = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
EXIT.
ENDIF.
dg_docparams-langu = 'X'.
dg_docparams-country = 'US'.
dg_docparams-fillable = 'X'.
form CONVERT_PDF_BINARY .
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
BUFFER = FP_FORMOUTPUT-PDF
APPEND_TO_TABLE = ' '
IMPORTING
OUTPUT_LENGTH =
TABLES
BINARY_TAB = t_att_content_hex .
endform. " CONVERT_PDF_BINARY
*& Form MAIL_ATTACHMENT
text
--> p1 text
<-- p2 text
form MAIL_ATTACHMENT USING p_email LIKE itcpo-tdcovtitle
p_email1 LIKE itcpo-tdcovtitle.
CLASS cl_bcs DEFINITION LOAD.
DATA:
lo_send_request TYPE REF TO cl_bcs VALUE IS INITIAL.
lo_send_request = cl_bcs=>create_persistent( ).
Message body and subject
DATA:
lt_message_body TYPE bcsy_text VALUE IS INITIAL,
lo_document TYPE REF TO cl_document_bcs VALUE IS INITIAL.
APPEND 'Dear,' TO lt_message_body.
append ' ' to lt_message_body.
APPEND 'Please fill the attached form and send it back to us.'
TO lt_message_body.
append ' ' to lt_message_body.
APPEND 'Thank You,' TO lt_message_body. lo_document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = lt_message_body
i_subject = 'Personnel Information Form' ).
DATA: lx_document_bcs TYPE REF TO cx_document_bcs VALUE IS INITIAL. TRY.
lo_document->add_attachment(
EXPORTING
i_attachment_type = 'PDF'
i_attachment_subject = 'Personnel Information Form'
I_ATTACHMENT_SIZE =
I_ATTACHMENT_LANGUAGE = SPACE
I_ATT_CONTENT_TEXT =
I_ATTACHMENT_HEADER =
i_att_content_hex = t_att_content_hex ).
CATCH cx_document_bcs INTO lx_document_bcs.
ENDTRY.
Add attachment
Pass the document to send request
lo_send_request->set_document( lo_document )."* Create sender
DATA:
lo_sender TYPE REF TO if_sender_bcs VALUE IS INITIAL,
l_send type ADR6-SMTP_ADDR value ' here mail id '.
l_send = P_email.
l_send = P_email1.
lo_sender = cl_cam_address_bcs=>create_internet_address( l_send ).
lo_sender = cl_sapuser_bcs=>create( sy-uname ).
Set sender
lo_send_request->set_sender(
EXPORTING
i_sender = lo_sender )." Create recipient
DATA:
lo_recipient TYPE REF TO if_recipient_bcs VALUE IS INITIAL.
lo_recipient = cl_sapuser_bcs=>create( sy-uname ).
lo_recipient = cl_cam_address_bcs=>create_internet_address( l_send ).
lo_recipient = cl_cam_address_bcs=>create_internet_address( l_send ).
Set recipient
lo_send_request->add_recipient(
EXPORTING
i_recipient = lo_recipient
i_express = 'X' ).
lo_send_request->add_recipient(
EXPORTING
i_recipient = lo_recipient
i_express = 'X' ).* Send email
DATA: lv_sent_to_all(1) TYPE c VALUE IS INITIAL.
lo_send_request->send(
EXPORTING
i_with_error_screen = 'X'
RECEIVING
result = lv_sent_to_all ).
COMMIT WORK.
message 'The Personnel Information form has been emailed to the Employee' type 'I'.
endform. " MAIL_ATTACHMENT
*--Call Function module
CALL FUNCTION dg_funcnam
EXPORTING
/1bcdwb/docparams = dg_docparams
im_logo = dg_logo
im_user_address = dt_user_address
im_ship_to_addr = dt_imp_data
im_text = ds_text
im_sales_text = dt_sales_text
im_item_data = dt_item_data
IMPORTING
/1BCDWB/FORMOUTPUT = FP_FORMOUTPUT
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
ENDIF.
CALL FUNCTION 'FPCOMP_JOB_CLOSE'
IMPORTING
e_jobresult = l_result
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
DATA : dl_msg TYPE string.
CONCATENATE 'Successfully mailed to' p_email p_email1 INTO dl_msg SEPARATED BY space.
IF drb_mail = 'X'.
COMMIT WORK.
MESSAGE dl_msg TYPE 'I' .
MESSAGE i000 WITH 'Successfully mailed to' p_email1.
ENDIF.
ENDFORM. "print_form
Could you please any body help me, it's very uregent issue.
Regards
Sandeep*& Report ZGB_ATTACHMENT
REPORT zgb_attachment.
DATA:
l_formname TYPE fpname VALUE 'ZGB_ATTACHMENT',
l_fm_name TYPE rs38l_fnam,
fp_outputparams TYPE sfpoutputparams,
fp_docparams TYPE sfpdocparams,
fp_formoutput TYPE fpformoutput.
DATA:
t_att_content_hex TYPE solix_tab.
PARAMETERS: p_pernr TYPE persno.
START-OF-SELECTION.
PERFORM get_function_module.
PERFORM create_document.
PERFORM convert_pdf_to_binary.
PERFORM mail_attachment.
*& Form GET_FUNCTION_MODULE
* text
* --> p1 text
* <-- p2 text
FORM get_function_module .
CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
EXPORTING
i_name = l_formname
IMPORTING
e_funcname = l_fm_name
* E_INTERFACE_TYPE =
* EV_FUNCNAME_INBOUND =
ENDFORM. " GET_FUNCTION_MODULE
*& Form CREATE_DOCUMENT
* text
* --> p1 text
* <-- p2 text
FORM create_document .
*JOB OPEN
CALL FUNCTION 'FP_JOB_OPEN'
CHANGING
ie_outputparams = fp_outputparams
EXCEPTIONS
cancel = 1
usage_error = 2
system_error = 3
internal_error = 4
OTHERS = 5.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
fp_docparams-langu = 'X'.
fp_docparams-country = 'US'.
fp_docparams-fillable = 'X'.
CALL FUNCTION l_fm_name
EXPORTING
/1bcdwb/docparams = fp_docparams
pernr = p_pernr
IMPORTING
/1bcdwb/formoutput = fp_formoutput
* EXCEPTIONS
* USAGE_ERROR = 1
* SYSTEM_ERROR = 2
* INTERNAL_ERROR = 3
* OTHERS = 4
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
*JOB CLOSE
CALL FUNCTION 'FP_JOB_CLOSE'
* IMPORTING
* e_result =
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
ENDFORM. " CREATE_DOCUMENT
*& Form CONVERT_PDF_TO_BINARY
* text
* --> p1 text
* <-- p2 text
FORM convert_pdf_to_binary .
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = fp_formoutput-pdf
* APPEND_TO_TABLE = ' '
* IMPORTING
* OUTPUT_LENGTH =
TABLES
binary_tab = t_att_content_hex
ENDFORM. " CONVERT_PDF_TO_BINARY
*& Form MAIL_ATTACHMENT
FORM mail_attachment .
CLASS cl_bcs DEFINITION LOAD.
DATA:
lo_send_request TYPE REF TO cl_bcs VALUE IS INITIAL.
lo_send_request = cl_bcs=>create_persistent( ).
* Message body and subject
DATA:
lt_message_body TYPE bcsy_text VALUE IS INITIAL,
lo_document TYPE REF TO cl_document_bcs VALUE IS INITIAL.
APPEND 'Dear,' TO lt_message_body.
APPEND ' ' TO lt_message_body.
APPEND 'Please fill the attached form and send it back to us.'
TO lt_message_body.
APPEND ' ' TO lt_message_body.
APPEND 'Thank You,' TO lt_message_body.
lo_document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = lt_message_body
i_subject = 'Personnel Information Form' ).
DATA: lx_document_bcs TYPE REF TO cx_document_bcs VALUE IS INITIAL.
TRY.
lo_document->add_attachment(
EXPORTING
i_attachment_type = 'PDF'
i_attachment_subject = 'Personnel Information Form'
* I_ATTACHMENT_SIZE =
* I_ATTACHMENT_LANGUAGE = SPACE
* I_ATT_CONTENT_TEXT =
* I_ATTACHMENT_HEADER =
i_att_content_hex = t_att_content_hex ).
CATCH cx_document_bcs INTO lx_document_bcs.
ENDTRY.
* Add attachment
* Pass the document to send request
lo_send_request->set_document( lo_document ).
* Create sender
DATA:
lo_sender TYPE REF TO if_sender_bcs VALUE IS INITIAL,
l_send TYPE adr6-smtp_addr VALUE '[email protected]'.
* lo_sender = cl_cam_address_bcs=>create_internet_address( l_send ).
lo_sender = cl_sapuser_bcs=>create( sy-uname ).
* Set sender
lo_send_request->set_sender(
EXPORTING
i_sender = lo_sender ).
* Create recipient
DATA:
lo_recipient TYPE REF TO if_recipient_bcs VALUE IS INITIAL.
* lo_recipient = cl_sapuser_bcs=>create( sy-uname ).
lo_recipient = cl_cam_address_bcs=>create_internet_address( l_send ).
** Set recipient
lo_send_request->add_recipient(
EXPORTING
i_recipient = lo_recipient
i_express = 'X' ).
* lo_send_request->add_recipient(
* EXPORTING
* i_recipient = lo_recipient
* i_express = 'X' ).
* Send email
DATA: lv_sent_to_all(1) TYPE c VALUE IS INITIAL.
lo_send_request->send(
EXPORTING
i_with_error_screen = 'X'
RECEIVING
result = lv_sent_to_all ).
COMMIT WORK.
MESSAGE 'The Personnel Information form has been emailed to the Employee' TYPE 'I'.
ENDFORM. " MAIL_ATTACHMENT
Maybe you are looking for
-
How do I find out if the email I received is a scam?
I didn't click on the link I'm afraid it might be a scam
-
Problem in Sales order Creation
Dear Group, While creating sales order with MTO senario by using material master strategy group as 20 i am getting the following error. ERROR Receiver categ. is not allowed by settlement prof. SD1 for this sender Message no. KD031 Please guide me ho
-
Variable values in composite.xml property
Hi, i've got the similar proble to: variable values in composite.xml property Static value for property <property name="oracle.webservices.auth.password" type="xs:string" many="false" override="may">admin</property> <property name="oracle.webservices
-
Can't see how to access my iTunes wish list on my iPhone?
Hi, Is there any way to access my iTunes wish list on my iPhone? The advice I've found so far is to look for a 'quick link' which is accessible from a home icon but I can't see any home icon in iTunes on my iPhone?
-
Error: 0x80040707 - Access Denied while installing itunes +ipod messed up
Yesterday morning my ipod (nano) was working fine, and i plugged it in to upload music and it said something about installing a new version of itunes on my ipod. i clicked yes, and somewhere during installation i assume, it got unplugged by one of my