Send a form by mail
Hi there.
We need our user to enter some information and then click on an button to send them to the right person.
I know it's possible with an html form that pass parameters to a cgi script that mails them to someone. I could publish this html form as a portlet by putting it in a dynamic page.
However, isn't there more portal-based solutions to achieve this ?
Regards
A.
write a trigger in your database to invoke send_email procedure when update/insert on your form
Similar Messages
-
Adobe PDF-based print forms - how to send pdf-form by mail?
Hello All.
I have created a PDF-form and now I want to send the form by mail without
seeing it on my screen first. I want it to be done in the backround.
I'm not using java/abap web dynpro.
Can somebody help me with this?
Thanks, Barak.hi
good
go through this link hope this would help you solve your problem
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/8cd6adbb-0301-0010-39ba-938c601d5db9
reward point if helpful.
thanks
mrutyun^ -
How to send smart form as mail?
Hello everybody,
I have used the following code to send a smartform in PDF format through email.
I m able to view the contents of the mail in SAP Bussiness Workplace but UNABLE TO TRANSFER THE MAIL to an INTERNET ID (like gmail id or yahoo id).
Can anybody suggest me about what might have gone wrong?
Helpful answers will surely be rewarded.
code
DATA: i_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
i_tline TYPE TABLE OF tline WITH HEADER LINE,
i_receivers TYPE TABLE OF somlreci1 WITH HEADER LINE,
i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,
Objects to send mail.
i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
i_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
Work Area declarations
wa_objhead TYPE soli_tab,
w_ctrlop TYPE ssfctrlop,
w_compop TYPE ssfcompop,
w_return TYPE ssfcrescl,
wa_doc_chng TYPE sodocchgi1,
w_data TYPE sodocchgi1,
wa_buffer TYPE string,"To convert from 132 to 255
Variables declarations
*v_form_name TYPE rs38l_fnam, " L_FM_NAME
v_len_in LIKE sood-objlen,
v_len_out LIKE sood-objlen,
v_len_outn TYPE i,
v_lines_txt TYPE i,
v_lines_bin TYPE i.
DATA: l_fm_name TYPE rs38l_fnam.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = p_l_formname
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
fm_name = l_fm_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
IF g_it3 = 'M'.
g_it3 = 'Mr'.
ENDIF.
IF g_it3 = 'F'.
g_it3 = 'Ms'.
ENDIF.
CALL FUNCTION l_fm_name
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS =
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS =
USER_SETTINGS = 'X'
it = g_it
it1 = g_it1
it3 = g_it3
it4 = g_it4
it5 = g_it5
it6 = g_it6
it7 = g_it7
it8 = g_it8
it10 = g_it10
it14 = g_it14
it15 = g_it15
it36 = g_it36
it18 = g_it18
it37 = g_it37
it19 = g_it19
it9 = g_it9
it11 = g_it11
it13 = g_it13
it39 = g_it39
it40 = g_it40
it20 = g_it20
it21 = g_it21
it22 = g_it22
it23 = g_it23
it25 = g_it25
it26 = g_it26
it27 = g_it27
it28 = g_it28
it29 = g_it29
it30 = g_it30
it31 = g_it31
it32 = g_it32
it33 = g_it33
total = g_total
it34 = g_it34
it35 = g_it35
it2 = pa0006-begda
it12 = pa0001-begda
it16 = pa0015-begda
it17 = pa0001-endda
it24 = pa0002-endda
it38 = pa0002-begda
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO =
JOB_OUTPUT_OPTIONS =
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
g_semail = 'X'.
IF g_semail = 'X'.
w_ctrlop-getotf = 'X'.
w_ctrlop-no_dialog = 'X'.
w_compop-tdnoprev = 'X'.
CALL FUNCTION l_fm_name
EXPORTING
control_parameters = w_ctrlop
output_options = w_compop
user_settings = 'X'
IMPORTING
job_output_info = w_return
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
i_otf[] = w_return-otfdata[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = v_len_in
TABLES
otf = i_otf
otf = i_otf
lines = i_tline
lines = i_tline
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*convert PDF from 132 to 255
LOOP AT i_tline.
*Replacing space by '~'.
TRANSLATE i_tline USING '~'.
CONCATENATE wa_buffer i_tline INTO wa_buffer.
ENDLOOP.
*Repalacing '~' by space.
TRANSLATE wa_buffer USING '~'.
DO.
i_record = wa_buffer.
*Appending 255 characters as a record.
APPEND i_record.
SHIFT wa_buffer LEFT BY 255 PLACES.
IF wa_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
Attachment
REFRESH:
i_reclist,
i_objtxt,
i_objbin,
i_objpack.
CLEAR wa_objhead.
*Object with PDF.
i_objbin[] = i_record[].
DESCRIBE TABLE i_objbin LINES v_lines_bin.
Create Message Body
Title and Description
*Object with main text of the mail.
i_objtxt = 'Find attached the output of the smartform'.
APPEND i_objtxt.
i_objtxt = 'Regards'.
APPEND i_objtxt.
i_objtxt = 'Lokesh'.
APPEND i_objtxt.
DESCRIBE TABLE i_objtxt LINES v_lines_txt.
READ TABLE i_objtxt INDEX v_lines_txt.
*Document information.
wa_doc_chng-obj_name = 'Offer Letter'.
wa_doc_chng-expiry_dat = sy-datum + 10.
wa_doc_chng-obj_descr = 'Offer Letter'.
wa_doc_chng-sensitivty = 'F'.
wa_doc_chng-doc_size = v_lines_txt * 255.
Main Text
*Pack to main body as RAW.
*Object to be transported not in binary form.
wa_doc_chng-doc_size = ( v_lines_txt - 1 ) * 255 + STRLEN( i_objtxt ).
CLEAR i_objpack-transf_bin.
i_objpack-head_start = 1.
i_objpack-head_num = 0.
i_objpack-body_start = 1.
i_objpack-body_num = v_lines_txt.
i_objpack-doc_type = 'RAW'.
APPEND i_objpack.
Attachment
(pdf-Attachment)
*Packing as PDF
i_objpack-transf_bin = 'X'.
i_objpack-head_start = 1.
i_objpack-head_num = 1.
i_objpack-body_start = 1.
Länge des Attachment ermitteln
DESCRIBE TABLE i_objbin LINES v_lines_bin.
READ TABLE i_objbin INDEX v_lines_bin.
i_objpack-doc_size = v_lines_bin * 255 .
i_objpack-body_num = v_lines_bin.
i_objpack-doc_type = 'PDF'.
i_objpack-obj_name = 'smart'.
i_objpack-obj_descr = 'test'.
APPEND i_objpack.
CLEAR i_reclist.
i_reclist-receiver = '[email protected]'.
i_reclist-express = 'X'.
i_reclist-rec_type = 'U'.
APPEND i_reclist.
*CALL FUNCTION 'LXE_SEND_MAIL_ATTMNT'
EXPORTING
description =
SENSITIVITY = 'O'
IN_OUTBOX = ' '
tables
receivers =
document_text =
DOCUMENT_ATTMNT =
DOCUMENT_ATTMNT_ATTR =
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
NO_AUTHORIZATION = 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.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = wa_doc_chng
put_in_outbox = 'X'
TABLES
packing_list = i_objpack
object_header = wa_objhead
contents_bin = i_objbin
contents_txt = i_objtxt
receivers = i_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
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 'success' TYPE 'I'.
ENDIF.
ENDIF.
ENDFORM. " GET_OFFER_LETTERHere is the code to send the Smartform to mail as PDF attachment.
*& Report ZTEST_PDF_MAIL
REPORT ZTEST_PDF_MAIL.
Internal Table declarations
DATA: I_OTF TYPE ITCOO OCCURS 0 WITH HEADER LINE,
I_TLINE TYPE TABLE OF TLINE WITH HEADER LINE,
I_RECEIVERS TYPE TABLE OF SOMLRECI1 WITH HEADER LINE,
I_RECORD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
Objects to send mail.
I_OBJPACK LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
I_OBJTXT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
I_OBJBIN LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
I_RECLIST LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE,
Work Area declarations
WA_OBJHEAD TYPE SOLI_TAB,
W_CTRLOP TYPE SSFCTRLOP,
W_COMPOP TYPE SSFCOMPOP,
W_RETURN TYPE SSFCRESCL,
WA_DOC_CHNG TYPE SODOCCHGI1,
W_DATA TYPE SODOCCHGI1,
WA_BUFFER TYPE STRING, "To convert from 132 to 255
Variables declarations
V_FORM_NAME TYPE RS38L_FNAM,
V_LEN_IN LIKE SOOD-OBJLEN,
V_LEN_OUT LIKE SOOD-OBJLEN,
V_LEN_OUTN TYPE I,
V_LINES_TXT TYPE I,
V_LINES_BIN TYPE I.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'ZTEST'
IMPORTING
FM_NAME = V_FORM_NAME
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
W_CTRLOP-GETOTF = 'X'.
W_CTRLOP-NO_DIALOG = 'X'.
W_COMPOP-TDNOPREV = 'X'.
CALL FUNCTION V_FORM_NAME
EXPORTING
CONTROL_PARAMETERS = W_CTRLOP
OUTPUT_OPTIONS = W_COMPOP
USER_SETTINGS = 'X'
IMPORTING
JOB_OUTPUT_INFO = W_RETURN
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
I_OTF[] = W_RETURN-OTFDATA[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
MAX_LINEWIDTH = 132
IMPORTING
BIN_FILESIZE = V_LEN_IN
TABLES
OTF = I_OTF
LINES = I_TLINE
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
OTHERS = 4.
IF SY-SUBRC <> 0.
ENDIF.
LOOP AT I_TLINE.
TRANSLATE I_TLINE USING '~'.
CONCATENATE WA_BUFFER I_TLINE INTO WA_BUFFER.
ENDLOOP.
TRANSLATE WA_BUFFER USING '~'.
DO.
I_RECORD = WA_BUFFER.
APPEND I_RECORD.
SHIFT WA_BUFFER LEFT BY 255 PLACES.
IF WA_BUFFER IS INITIAL.
EXIT.
ENDIF.
ENDDO.
Attachment
REFRESH: I_RECLIST,
I_OBJTXT,
I_OBJBIN,
I_OBJPACK.
CLEAR WA_OBJHEAD.
I_OBJBIN[] = I_RECORD[].
Create Message Body Title and Description
I_OBJTXT = 'test with pdf-Attachment!'.
APPEND I_OBJTXT.
DESCRIBE TABLE I_OBJTXT LINES V_LINES_TXT.
READ TABLE I_OBJTXT INDEX V_LINES_TXT.
WA_DOC_CHNG-OBJ_NAME = 'smartform'.
WA_DOC_CHNG-EXPIRY_DAT = SY-DATUM + 10.
WA_DOC_CHNG-OBJ_DESCR = 'smartform'.
WA_DOC_CHNG-SENSITIVTY = 'F'.
WA_DOC_CHNG-DOC_SIZE = V_LINES_TXT * 255.
Main Text
CLEAR I_OBJPACK-TRANSF_BIN.
I_OBJPACK-HEAD_START = 1.
I_OBJPACK-HEAD_NUM = 0.
I_OBJPACK-BODY_START = 1.
I_OBJPACK-BODY_NUM = V_LINES_TXT.
I_OBJPACK-DOC_TYPE = 'RAW'.
APPEND I_OBJPACK.
Attachment (pdf-Attachment)
I_OBJPACK-TRANSF_BIN = 'X'.
I_OBJPACK-HEAD_START = 1.
I_OBJPACK-HEAD_NUM = 0.
I_OBJPACK-BODY_START = 1.
DESCRIBE TABLE I_OBJBIN LINES V_LINES_BIN.
READ TABLE I_OBJBIN INDEX V_LINES_BIN.
I_OBJPACK-DOC_SIZE = V_LINES_BIN * 255 .
I_OBJPACK-BODY_NUM = V_LINES_BIN.
I_OBJPACK-DOC_TYPE = 'PDF'.
I_OBJPACK-OBJ_NAME = 'smart'.
I_OBJPACK-OBJ_DESCR = 'test'.
APPEND I_OBJPACK.
CLEAR I_RECLIST.
I_RECLIST-RECEIVER = '[email protected]'.
I_RECLIST-REC_TYPE = 'U'.
APPEND I_RECLIST.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = WA_DOC_CHNG
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = 'X'
TABLES
PACKING_LIST = I_OBJPACK
OBJECT_HEADER = WA_OBJHEAD
CONTENTS_BIN = I_OBJBIN
CONTENTS_TXT = I_OBJTXT
RECEIVERS = I_RECLIST
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
DOCUMENT_TYPE_NOT_EXIST = 3
OPERATION_NO_AUTHORIZATION = 4
PARAMETER_ERROR = 5
X_ERROR = 6
ENQUEUE_ERROR = 7
OTHERS = 8.
IF SY-SUBRC <> 0.
WRITE:/ 'Error When Sending the File', SY-SUBRC.
ELSE.
WRITE:/ 'Mail sent'.
ENDIF.
If you want to send some text as Body of the Mail then follow this once
when u r callin the FM'SO_NEW_DOCUMENT_ATT_SEND_API1'.. points to remember
1.u have to pass the body of content in table CONTENTS_TXT(ia m using I_OBJBIN) (each line a record) then. suppose i have appended 11 records to the table CONTENTS_TXT .
2.PACKING_LIST(iam usign I_OBJPACK) table u ahve to append a redord as follows
I_OBJPACK-TRANSF_BIN = ' '.
I_OBJPACK-HEAD_START = 000000000000001.
I_OBJPACK-HEAD_NUM = 000000000000001.
I_OBJPACK-BODY_START = 000000000000002
I_OBJPACK-BODY_NUM = 000000000000010.
I_OBJPACK-DOC_TYPE = 'RAW'.
append I_OBJPACK-.
by the above code system treat the first line in table I_OBJBIN as header and the 2nd line to 10 lines tread as body.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = WA_DOC_CHNG
PUT_IN_OUTBOX = 'X'
TABLES
PACKING_LIST = I_OBJPACK
OBJECT_HEADER = WA_OBJHEAD
CONTENTS_BIN = I_OBJBIN
CONTENTS_TXT = I_OBJTXT
RECEIVERS = I_RECLIST
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
DOCUMENT_TYPE_NOT_EXIST = 3
OPERATION_NO_AUTHORIZATION = 4
PARAMETER_ERROR = 5
X_ERROR = 6
ENQUEUE_ERROR = 7
OTHERS = 8.
regards,
srinivas -
Hi experts,
I want to send by email, the pc00_m99_cedt form by mail.
this txn, show the payroll results, and i want to send every result to every employee, acording to IT 105 (MAIL),
any ideas?
tks in advance.Hi
You need to write a z-report which reads this cedt payslip, and use the funtion module SO_NEW_DOCUMENT_ATT_SEND_API1 .
Prasad -
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. -
Dear friends,
I have to developed one object through which i can send
my invoice print in pdf format to the respected users email id.
Can this be also done via using attachment.
We are taking Print using va02 and out put type zsin.
Please help me out.
Thanks and Regards
vivekVivek do you mean that you want to create a attachment of type PDF and this dcouemnt is a online document and
can you let me know are you using any ABAP program or a workflow to send the email.
Try like this
In the program you make use of the FM FP_FUNCTON_MODULE_NAME and you have to call the function module that is generated by the above FM.
The Properties of ADOBE forms are associated with the structure FP_FORMOUPUT fill the relevant fields in the structure.
Now after performing the above two steps you need to convert the PDF form to BINARY for this you have to make use of the FM SCMS_XSTRING_TO_BINARY this is because you have to pass the binary content to the workflow conatiner using the Fm SAP_WAPI_WORKFLOW_START by using conatiner parameter of TABLES part.
create a Z BO or if you are familiar with OO ABAP then create a class and inside that class or BO create a method in side this method all you to do is the converted PDF to BINARY for this use
SCMS_BINARY_TO_XSTRING and after converting call the FM SAP_WAPI_ATTACHMENT_ADD.
In SAP_WAPI_ATTACHMENT_ADD you have to pass the document attributes for like name , type title, so for this you have to fill a structure of type SWR_ATT_ID and you have to pass this to SAP_WAPI_ATTACHMENT_ADD and this FM will retrun a DOC ID and you ahve to pass this ID to the TASK and the from TASK to workflow &_ATTACH_OBJECTS& in the workflow is responsible to handle the attachments...
Any more help needed revert back -
Default settings for sending smart forms via mail saving it in pdf
do we have to do any default settings in any trasaction code like scot for solving the above problem
hi thanku very much durga prasad
my mail id is [email protected] -
Dear friends,
I have to developed one object through which i can send
my invoice print in pdf format to the respected users email id.
Can this be also done via using attachment.
We are taking Print using va02 and out put type zsin.
Please help me out.
Thanks and Regards
vivekconvert the otf data to pdf data using
CONVERT_OTF_2_PDF
Collect the pdf data in tb_lines.
then use ...Here tb_attach should contain the data from tb_lines formatted properly.
wa_doc_data-obj_langu = 'EN'.
wa_doc_data-obj_name = 'SAPRPT'.
wa_doc_data-sensitivty = 'F'.
tb_packing_list-transf_bin = space.
tb_packing_list-head_start = 1.
tb_packing_list-head_num = 0.
tb_packing_list-body_start = 1.
DESCRIBE TABLE tb_message LINES tb_packing_list-body_num.
tb_packing_list-doc_type = 'RAW'.
APPEND tb_packing_list.
tb_packing_list-transf_bin = 'X'.
tb_packing_list-head_start = 1.
tb_packing_list-head_num = 1.
tb_packing_list-body_start = 1.
DESCRIBE TABLE tb_attach LINES tb_packing_list-body_num.
tb_packing_list-doc_type = '.PDF'.
tb_packing_list-obj_descr = wf_msg_file.
tb_packing_list-obj_name = wa_doc_data-obj_descr.
tb_packing_list-doc_size = tb_packing_list-body_num * 255.
tb_packing_list-obj_langu = 'EN'.
APPEND tb_packing_list.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = wa_doc_data
put_in_outbox = co_x
IMPORTING
sent_to_all = wf_sent_all
TABLES
packing_list = tb_packing_list
contents_bin = tb_attach
contents_txt = tb_message
receivers = tb_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.
hope the above helps u out -
Why is my php form not sending to my e-mail?
Here i have the code for my .php document and the code for my html. Why is the form not sending to my e-mail ([email protected])? At one point I had the form sending to my e-mail, but the information that was filled out was not appearing. Now no email is being sent at all. I tried a contact-us.php page with the php email code in the same document and now have the information in seperate documents, but I am getting the same results every which way. I need help I have been checking this over for hours and looking up solutions online but it all is very confusing. PLEASE HELP!
send.php
<?php
if ($_POST['parse_var'] == "contactForm") {
$emailTitle = 'Scheduele In Home Consultation or General Question';
$yourEmail = '[email protected]';
$firstName = $_POST['FirstName'];
$lastName = $_POST['LastName'];
$phoneNumber = $_POST['PhoneNumber'];
$emailAddress = $_POST['EmailAddress'];
$Message = $_POST['Message'];
$body = <<<EOD
<br><hr><br>
First Name: $firstName <br />
Last Name: $lastName <br />
Phone Number: $phoneNumber <br />
Email Address: $emailAddress <br />
Message: $Message <br />
EOD;
$headers = "From: $emailAddress\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail("$yourEmail", "$emailTitle", "$body", "$headers");
$sent = "Thank you! Your message has been sent.";
?>
contact-us.html
<form action="send.php" method="post" name="contactForm" id="contactForm">
<table width="75%" align="left" cellpadding="5" id="contactustable">
<tr>
<td><label for="FirstName"></label>
<span id="sprytextfield1">
First Name<br>
<br>
<input type="text" name="FirstName" id="FirstName" value="<?php print "$firstName"; ?>">
<span class="textfieldRequiredMsg">Please enter your first name.</span></span></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><label for="LastName"></label>
<span id="sprytextfield2">
Last Name<br>
<br>
<input type="text" name="LastName" id="LastName" value="<?php print "$lastName"; ?>">
<span class="textfieldRequiredMsg">Please enter your last name.</span></span></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><label for="PhoneNumber"></label>
<span id="sprytextfield3">
Phone Number<br>
<br>
<input type="text" name="PhoneNumber" id="PhoneNumber" value="<?php print "$phoneNumber"; ?>">
<span class="textfieldInvalidFormatMsg">Please enter your phone number.</span></span></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><label for="EmailAddress"></label>
<span id="sprytextfield4">E-mail Address<br>
<br>
<input type="text" name="EmailAddress" id="EmailAddress" value="<?php print "$emailAddress"; ?>">
<span class="textfieldRequiredMsg">Please enter your e-mail address.</span><span class="textfieldInvalidFormatMsg">Example: [email protected].</span></span></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td height="255"><label for="Message"></label>
<span id="sprytextarea1">
Message:<br>
<br>
<textarea name="Message" cols="85%" rows="12" id="Message"><?php print "$Message"; ?></textarea>
<span class="textareaRequiredMsg">A value is required.</span></span></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><input type="submit" name="Reset" id="Reset" value="Reset">
<input type="hidden" name="parse_var" id="parse_var">
<input type="submit" name="Submit" id="Submit" value="Send Message"></td>
</tr>
<tr>
<td><?php print "$sent"; ?></td>
</tr>
</table>
</form>tonyb1117 wrote:
It works! Thank you very much for pointing that out "bregent" and "osgood_". I have one more small problem though, when signing out my contact form the phone number field does not accept any phone number?
<input type="text" name="PhoneNumber" id="PhoneNumber" value="<?php print "$phoneNumber"; ?>">
<span class="textfieldInvalidFormatMsg">Please enter your phone number.</span></span></td>
Any solutions?
I don't know anything about Spry validation of form fields but I think it requires you to set the type of validation, i.e., text, email, number.
Have you looked in that direction.
I presume what youre saying is when you hit send you get a red message saying phone number is not valid or something along those lines? -
When I send or receive e-mail (Thunderbird).....the mail gets changed significantly from its original form.....typestyle, font size, symbols, page layout, color.....everything changes.....is there a way to fix that so my the original form of the mail is not changed?.....
Just to recap, this is a collection of ports I have collected over time for people who needed this information when setting up the HP ePrint app so that they could view their email from within the app. I am certain other applications also need this information. Although lengthy, I could not find a more comprehensive place to retrieve this information. Feel free to post additional information, faulty information, or other related topics below as this is simply a collection of data and it would be practically impossible to test all of them. Thank you!
Don't forgot to say thanks by giving "Kudos" if I helped solve your problem.
When a solution is found please mark the post that solves your issue.
Every problem has a solution! -
How to send the form data through mail with pdf format?
forms 6i
Hi to all,
i am developed one master detail form.example is based on the dept number emp details will be displayed.here my requirment is whatever displayed on the form
the data ,these data send to mail with any format.is it possible? if is possible any one give a proper solution.
Regards,
Stevie
Edited by: 994418 on 6 May, 2013 11:15 PMHello,
you can create a Report that accepts the search parameters from the Forms mask and generates a PDF. You also have the option to send the report via mail.
Personally I would generate the report with a tool like as_pdf
http://technology.amis.nl/2012/04/11/generating-a-pdf-document-with-some-plsql-as_pdf_mini-as_pdf3/
Then you can send the mail using utl_mail or utl_smtp.
www.google.com/search?q=site:forums.oracle.com+utl_mail+utl_smtp
Regards
Marcus -
Filling up a pdf form which I received as email. I opened it on my adobe reader 11 and filled up the highlighted fields. Yet when I click on the send via mail it says changes will not be included. How do I send the form with changes?
The add annotations field shows as not allowed in the security options. So how do I send this form back with the changes??I think you you need to click 'save' first, then it is saved to acrobat, where it will prompt to send.
-
For this program i could send the smart form thru mail but in the inbox ..
*& Report ZSFOO
REPORT ZSFOO.
*& Report ZSFINV
TABLES : KNA1, " General Data In Customer Master
KNB1, " Customer Master(Company Code)
BSID, " Accounting: Secondary Index for Customers
ZSMARTFORM, " Custom table for Storing Bank Details
zsf_exp_inv, " Structure that stores required fields from all tables used
KNVK. " Customer Master Contact Partner
data : Begin of it_struct occurs 0.
include structure zsf_exp_inv01.
data : End of it_struct.
types : begin of ty_bsid,
kunnr like bsid-kunnr,
WAERS like bsid-WAERS,
XBLNR LIKE BSID-XBLNR,
BUDAT LIKE BSID-BUDAT,
WRBTR LIKE BSID-WRBTR,
BUKRS LIKE BSID-BUKRS,
end of ty_bsid.
types : begin of ty_kna1,
kunnr like kna1-kunnr,
NAME1 LIKE KNA1-NAME1,
STRAS LIKE KNA1-STRAS,
MCOD3 LIKE KNA1-MCOD3,
LAND1 LIKE KNA1-LAND1,
SORTL LIKE KNA1-SORTL,
end of ty_kna1.
types : begin of ty_knb1,
kunnr like knb1-kunnr,
ZTERM LIKE KNB1-ZTERM,
end of ty_knb1.
types : begin of ty_knVK,
kunnr like kNVK-kunnr,
NAME1 LIKE KNVK-NAME1,
end of ty_knVK.
types : begin of ty_ZSMARTFORM,
SNO LIKE ZSMARTFORM-SNO,
CURRENCY LIKE zsmartform-currency,
BANKNAME LIKE zsmartform-bankname,
ADDRESS1 LIKE ZSMARTFORM-ADDRESS1,
ADDRESS2 LIKE ZSMARTFORM-ADDRESS2,
ADDRESS3 LIKE ZSMARTFORM-ADDRESS3,
ADDRESS4 LIKE ZSMARTFORM-ADDRESS4,
ADDRESS5 LIKE ZSMARTFORM-ADDRESS5,
ADDRESS6 LIKE ZSMARTFORM-ADDRESS6,
VALIDFROM LIKE ZSMARTFORM-VALIDFROM,
VALIDTO LIKE ZSMARTFORM-VALIDTO,
end of ty_ZSMARTFORM.
data : it_bsid type table of ty_bsid,
it_kna1 type table of ty_kna1,
it_knb1 type table of ty_knb1,
it_zsmartform type table of ty_zsmartform,
it_knVK type table of ty_kNVK.
data : wa_bsid like line of it_bsid,
wa_kna1 like line of it_kna1,
wa_knb1 like line of it_knb1,
wa_zsmartform like line of it_zsmartform,
wa_knVK like line of it_knVK.
*****************Selection Screen**********************************
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-000.
SELECT-OPTIONS : S_KUNNR FOR KNA1-KUNNR,
S_belnr FOR BSID-belnr,
S_BUKRS FOR BSID-BUKRS,
S_CURR FOR ZSMARTFORM-CURRENCY.
SELECTION-SCREEN END OF BLOCK B1.
DATA : BEGIN OF IT_PARAM OCCURS 0.
INCLUDE STRUCTURE ZPARAMETERS.
DATA : END OF IT_PARAM.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-001.
SKIP 1.
Parameters : OPTION1 AS CHECKBOX,
P_POINF(300) type c,
OPTION2 AS CHECKBOX,
P_DESC(300) TYPE C,
OPTION3 AS CHECKBOX,
P_MONTH(200) TYPE C,
OPTION4 AS CHECKBOX,
P_RATE(100) TYPE C.
SELECTION-SCREEN END OF BLOCK B2.
**********************PARAMETERS***********************************
data : l type i,
Y(300) type c,
j type i,
k type i value 1,
s type i,
m(300) type c,
p type i,
z type i.
data : l1 type i,
Y1(300) type c,
j1 type i,
k1 type i value 1,
s1 type i,
m1(300) type c,
p1 type i,
z1 type i.
data : l2 type i,
Y2(300) type c,
j2 type i,
k2 type i value 1,
s2 type i,
m2(300) type c,
p2 type i,
z2 type i.
data : l3 type i,
Y3(300) type c,
j3 type i,
k3 type i value 1,
s3 type i,
m3(300) type c,
p3 type i,
z3 type i.
IF OPTION1 = 'X'.
concatenate P_POINF ',' into P_POINF.
l = strlen( P_POINF ).
do l times.
Y = P_POINF+j(k).
case Y.
when ','.
m = P_POINF+s(z).
s = j + 1.
z = -1.
p = p + 1.
if p = 1.
IT_PARAM-LINE1 = m.
endif.
if p = 2.
IT_PARAM-LINE2 = m.
endif.
if p = 3.
IT_PARAM-LINE3 = m.
endif.
when '.'.
if p = 4.
IT_PARAM-LINE4 = m.
endif.
endcase.
j = j + 1.
z = z + 1.
enddo.
ENDIF.
IF OPTION2 = 'X'.
concatenate P_DESC ',' into P_DESC.
l1 = strlen( P_DESC ).
do l1 times.
Y1 = P_DESC+j1(k1).
case Y1.
when ','.
m1 = P_DESC+s1(z1).
s1 = j1 + 1.
z1 = -1.
p1 = p1 + 1.
if p1 = 1.
IT_PARAM-LINE5 = m1.
endif.
if p1 = 2.
IT_PARAM-LINE6 = m1.
endif.
if p1 = 3.
IT_PARAM-LINE7 = m1.
endif.
when '.'.
if p1 = 4.
IT_PARAM-LINE8 = m1.
endif.
endcase.
j1 = j1 + 1.
z1 = z1 + 1.
enddo.
ENDIF.
IF OPTION3 = 'X'.
concatenate P_MONTH ',' into P_MONTH.
l2 = strlen( P_MONTH ).
do l2 times.
Y2 = P_MONTH+j2(k2).
case Y2.
when ','.
m2 = P_MONTH+s2(z2).
s2 = j2 + 1.
z2 = -1.
p2 = p2 + 1.
if p2 = 1.
IT_PARAM-LINE9 = m2.
endif.
if p2 = 2.
IT_PARAM-LINE10 = m2.
endif.
if p2 = 3.
IT_PARAM-LINE11 = m2.
endif.
when '.'.
if p2 = 4.
IT_PARAM-LINe12 = m2.
endif.
endcase.
j2 = j2 + 1.
z2 = z2 + 1.
enddo.
ENDIF.
IF OPTION4 = 'X'.
concatenate P_RATE ',' into P_RATE.
l3 = strlen( P_RATE ).
do l3 times.
Y3 = P_RATE+j3(k3).
case Y3.
when ','.
m3 = P_RATE+s3(z3).
s3 = j3 + 1.
z3 = -1.
p3 = p3 + 1.
if p3 = 1.
IT_PARAM-LINE13 = m3.
endif.
if p3 = 2.
IT_PARAM-LINE14 = m3.
endif.
if p3 = 3.
IT_PARAM-LINE15 = m3.
endif.
if p3 = 4.
IT_PARAM-LINe16 = m3.
endif.
endcase.
j3 = j3 + 1.
z3 = z3 + 1.
enddo.
ENDIF.
APPEND IT_PARAM.
select * from kna1 into corresponding fields of table it_kna1 where kunnr in s_kunnr.
select * from knb1 into corresponding fields of table it_knb1 for all entries in it_kna1 where kunnr = it_kna1-kunnr.
select * from bsid into corresponding fields of table it_bsid for all entries in it_kna1 where kunnr = it_kna1-kunnr and belnr in s_belnr and bukrs in s_bukrs..
SELECT * FROM KNVK INTO CORRESPONDING FIELDS OF TABLE IT_KNVK FOR ALL ENTRIES IN IT_KNA1 WHERE KUNNR = IT_KNA1-KUNNR.
select * from zsmartform into corresponding fields of table it_zsmartform .
DATA : AMT LIKE SPELL.
loop at it_bsid into wa_bsid.
read table it_kna1 into wa_kna1 with key kunnr = wa_bsid-kunnr.
read table it_knb1 into wa_knb1 with key kunnr = wa_bsid-kunnr.
read table it_zsmartform into wa_zsmartform with key CURRENCY = wa_bsid-WAERS.
READ TABLE IT_KNVK INTO WA_KNVK WITH KEY KUNNR = WA_BSID-KUNNR.
it_struct-name1 = wa_kna1-name1.
it_struct-stras = wa_kna1-stras.
it_struct-mcod3 = wa_kna1-mcod3.
it_struct-land1 = wa_kna1-land1.
it_struct-sortl = wa_kna1-sortl.
it_struct-zterm = wa_knb1-zterm.
it_struct-xblnr = wa_bsid-xblnr.
it_struct-currency = wa_zsmartform-currency.
it_struct-currency = wa_bsid-waers.
it_struct-budat = wa_bsid-budat.
it_struct-BANKNAME = wa_zsmartform-BANKNAME.
it_struct-ADDRESS1 = wa_zsmartform-ADDRESS1.
it_struct-ADDRESS2 = wa_zsmartform-ADDRESS2.
it_struct-ADDRESS3 = wa_zsmartform-ADDRESS3.
it_struct-ADDRESS4 = wa_zsmartform-ADDRESS4.
it_struct-ADDRESS5 = wa_zsmartform-ADDRESS5.
it_struct-ADDRESS6 = wa_zsmartform-ADDRESS6.
it_struct-CURR = WA_BSID-WRBTR.
IT_STRUCT-NAME = WA_KNVK-NAME1.
IT_STRUCT-AMOUNT = IT_SPELL-AMT.
append it_struct.
endloop.
data : x type i,
x1 type i,
a type string.
loop at it_struct.
x = strlen( it_struct-curr ).
x1 = x - 3.
a = it_struct-curr+0(x1).
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
AMOUNT = a
CURRENCY = ' '
FILLER = ' '
LANGUAGE = SY-LANGU
IMPORTING
IN_WORDS = AMT.
EXCEPTIONS
NOT_FOUND = 1
TOO_LARGE = 2
OTHERS = 3
*IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*ENDIF.
endloop.
DATA: ws_ucomm LIKE sy-ucomm.
DATA: form_name TYPE rs38l_fnam.
DATA: wa_ctrlop TYPE ssfctrlop,
wa_outopt TYPE ssfcompop.
data : i_receivers TYPE TABLE OF somlreci1 WITH HEADER LINE,
i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE.
DATA: t_otfdata TYPE ssfcrescl,
t_pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE,
i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
i_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE.
data : wa_objhead TYPE soli_tab,
wa_doc_chng typE sodocchgi1,
w_data TYPE sodocchgi1,
wa_buffer TYPE string,
v_len_in LIKE sood-objlen,
v_len_out LIKE sood-objlen,
v_len_outn TYPE i,
v_lines_txt TYPE i,
v_lines_bin TYPE i.
DATA: t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE.
DATA: w_filesize TYPE string.
DATA: w_bin_filesize TYPE i.
wa_ctrlop-getotf = 'X'.
CALL FUNCTION '/1BCDWB/SF00000001'
EXPORTING
control_parameters = wa_ctrlop
output_options = wa_outopt
user_settings = 'X'
IN_WORDS = amt
importing
job_output_info = t_otfdata
TABLES
I_ZSF_EXP_INV = it_struct
I_ZPARAMETERS = it_param.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
t_otf[] = t_otfdata-otfdata[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = w_bin_filesize
TABLES
otf = t_otf
lines = t_pdf_tab
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
OTHERS = 4
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
bin_filesize = w_bin_filesize
CODEPAGE = ' '
filename = 'c: est59.PDF'
filetype = 'BIN'
IMPORTING
filelength = w_filesize
TABLES
data_tab = t_pdf_tab
EXCEPTIONS
file_open_error = 1
file_write_error = 2
invalid_filesize = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
OTHERS = 10
IF sy-subrc <> 0.
*You should include message-id in the report heading
WRITE : sy-subrc.
ELSE.
WRITE : 'File Test.pdf downloaded succesfully'.
ENDIF.
loop at t_pdf_tab.
translate t_pdf_tab using '~'.
concatenate wa_buffer t_pdf_tab into wa_buffer.
endloop.
translate wa_buffer using '~'.
do.
i_record = wa_buffer.
append i_record.
shift wa_buffer left by 255 places.
if wa_buffer is initial.
exit.
endif.
enddo.
Attachment
refresh:
i_reclist,
i_objtxt,
i_objbin,
i_objpack.
clear wa_objhead.
i_objbin[] = i_record[].
Create Message Body
Title and Description
i_objtxt = 'test with pdf-Attachment!'.
append i_objtxt.
describe table i_objtxt lines v_lines_txt.
read table i_objtxt index v_lines_txt.
wa_doc_chng-obj_name = 'smartform'.
wa_doc_chng-expiry_dat = sy-datum + 10.
wa_doc_chng-obj_descr = 'smartform'.
wa_doc_chng-sensitivty = 'O'.
wa_doc_chng-doc_size = v_lines_txt * 255.
Main Text
wa_doc_chng-doc_size = ( v_lines_txt - 1 ) * 255 + strlen( i_objtxt )
clear i_objpack-transf_bin.
i_objpack-head_start = 1.
i_objpack-head_num = 0.
i_objpack-body_start = 1.
i_objpack-body_num = v_lines_txt.
i_objpack-doc_type = 'RAW'.
append i_objpack.
i_objpack-transf_bin = 'X'.
i_objpack-head_start = 1.
i_objpack-head_num = 1.
i_objpack-body_start = 1.
i_objpack-body_num = v_lines_bin.
i_objpack-doc_type = 'PDF'.
i_objpack-obj_name = 'Smartform'.
CONCATENATE 'Hazard report-' p_load '.pdf' INTO i_objpack-obj_descr.
describe table i_objbin lines v_lines_bin.
read table i_objbin index v_lines_bin.
i_objpack-doc_size = v_lines_bin * 255 .
i_objpack-obj_descr = 'test'.
i_objpack-doc_size = v_lines_bin * 255.
APPEND i_objpack.
Attachment
(pdf-Attachment)
i_objpack-transf_bin = 'X'.
i_objpack-head_start = 1.
i_objpack-head_num = 0.
i_objpack-body_start = 1.
Länge des Attachment ermitteln
describe table i_objbin lines v_lines_bin.
read table i_objbin index v_lines_bin.
i_objpack-doc_size = v_lines_bin * 255 .
i_objpack-body_num = v_lines_bin.
i_objpack-doc_type = 'PDF'.
i_objpack-obj_name = 'smart'.
i_objpack-obj_descr = 'test'.
append i_objpack.
clear i_reclist.
i_reclist-receiver = '[email protected]'.
i_reclist-express = 'X'.
i_reclist-rec_type = 'U'.
append i_reclist.
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = wa_doc_chng
COMMIT_WORK = 'X'
put_in_outbox = 'X'
TABLES
packing_list = i_objpack
object_header = wa_objhead
CONTENTS_BIN = i_objbin
contents_txt = i_objtxt
receivers = i_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
others = 8.
for this program i could send the smart form thru mail but in the inbox i could not
download it it says needed to be decoded properly.file not starting with pdf....
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = 'Mail sent'(003)
txt1 = 'The report is sent via e-mail.'(004)
txt2 = ' '.
LEAVE PROGRAM.
ENDIF.hi krishna,
u r right. there is no error in sending the mail and the file but the problem is that file created and converted to pdf is not done properly.jst verify whether the file is created properly or not .thats the only problem that can occurs else ur program is absolutely right. -
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********************************* -
H can we send script form to client through mail.
h can we send script form to client through mail.
<<removed by moderator>>
Search SDN for more details on these...
Thanks,
Anmol.
Edited by: kishan P on Apr 6, 2011 11:49 AM
Maybe you are looking for
-
Report O/P in graph.(all in one vetical line).
I want outpout in graph ..my requirement is i have to create a report equipment wise calculating oee in graphical format. suppose i had a equipment ..in my report i have to calculate its idle time ,maintaince time and number of batches processed thr
-
Webdynpro interview questions and answers
hi friends i need webdynpro interview questions and answers urgently thanks
-
ITunes Setup Assistant runs every time I start iTunes 7.3.1.3
The past 2 iterations of iTunes have had the same problem for me - even though the program is installed already, it doesn't save my settings and runs the setup assistant every time I start the application. I've gone through the assistant twice and pu
-
How can i convert a char[] to String?
Hi all!, What would be the easiest way to convert a char[] to a String? Im trying to set the text of a JTextArea which takes a String as an arguement but i have a character arry that if filled from a FileReader. Any suggestions? Thanks.
-
Solaris 11.1 AI client: solaris.zlib download times out
Hi all, I am trying to install a client off the current AI image. I have not modified any manifests and just run the default config after "installadm create-service" which should give me an interactive text install mode. The client has the Intel I350