2007 Feb 02 6:26 PM
Hi,
When iam sending E-Mail as a text attachment iam not able to send email.
<i><b>exception occured ( document_not_sent )</b></i> This is the error what iam getting. Below is my code.Please help me.
DATA : DOC_CHNG LIKE SODOCCHGI1,
OBJPACK LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
OBJHEAD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
OBJBIN LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
OBJTXT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
RECLIST LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE.
DATA: TAB_LINES LIKE SY-TABIX,
L_MSG(50).
* Creating the document to be sent
DOC_CHNG-OBJ_NAME = 'Z2318S1B01'.
DOC_CHNG-OBJ_DESCR = EMSUBJ. "Given in Selection screen
* Creating the body of email
REFRESH OBJTXT.
OBJTXT = 'your report'.
APPEND OBJTXT.
*-- Document size
DESCRIBE TABLE OBJTXT LINES TAB_LINES.
READ TABLE OBJTXT INDEX TAB_LINES.
DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
*-- Populate packing list for body text
CLEAR OBJPACK-TRANSF_BIN.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 0.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = TAB_LINES.
OBJPACK-DOC_TYPE = 'RAW'.
APPEND OBJPACK.
CLEAR OBJPACK.
*-----Attachment details
*-- Final Data to send to EMail
LOOP AT IT_ATTACHMENT.
OBJBIN-LINE = IT_ATTACHMENT-EMAIL.
APPEND OBJBIN.
CLEAR OBJBIN.
ENDLOOP.
*-- Get total no.of lines of Object table(attachment)
CLEAR : TAB_LINES.
DESCRIBE TABLE OBJBIN LINES TAB_LINES.
*-- Populate object header(attachment name)
OBJHEAD = EMATTACH.
APPEND OBJHEAD.
CLEAR OBJHEAD.
*-- Packing list for attachment
OBJPACK-TRANSF_BIN = 'X'.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 1.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = TAB_LINES .
OBJPACK-DOC_TYPE = 'TXT'.
OBJPACK-OBJ_NAME = 'Z2318S1B01'.
OBJPACK-OBJ_DESCR = EMSUBJ.
OBJPACK-DOC_SIZE = TAB_LINES * 255.
APPEND OBJPACK.
CLEAR OBJPACK.
*-- Populate Mail Id's
LOOP AT EMAILID.
RECLIST-RECEIVER = EMAILID-LOW.
APPEND RECLIST.
ENDLOOP.
RECLIST-REC_TYPE = 'U'.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = DOC_CHNG
PUT_IN_OUTBOX = 'X'
* IMPORTING
* SENT_TO_ALL =
* NEW_OBJECT_ID =
TABLES
PACKING_LIST = OBJPACK
OBJECT_HEADER = OBJHEAD
CONTENTS_BIN = OBJBIN
CONTENTS_TXT = OBJTXT
* CONTENTS_HEX =
* 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.
Thanks
Vikranth Khimavath
Message was edited by:
Khimavath Vikranth
Message was edited by:
Khimavath Vikranth
Hi,
When iam sending E-Mail as a text attachment iam not able to send email.
<i><b>exception occured ( document_not_sent )</b></i> This is the error what iam getting. Below is my code.Please help me.
DATA : DOC_CHNG LIKE SODOCCHGI1,
OBJPACK LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
OBJHEAD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
OBJBIN LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
OBJTXT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
RECLIST LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE.
DATA: TAB_LINES LIKE SY-TABIX,
L_MSG(50).
* Creating the document to be sent
DOC_CHNG-OBJ_NAME = 'Z2318S1B01'.
DOC_CHNG-OBJ_DESCR = EMSUBJ. "Given in Selection screen
* Creating the body of email
REFRESH OBJTXT.
OBJTXT = 'your report'.
APPEND OBJTXT.
*-- Document size
DESCRIBE TABLE OBJTXT LINES TAB_LINES.
READ TABLE OBJTXT INDEX TAB_LINES.
DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
*-- Populate packing list for body text
CLEAR OBJPACK-TRANSF_BIN.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 0.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = TAB_LINES.
OBJPACK-DOC_TYPE = 'RAW'.
APPEND OBJPACK.
CLEAR OBJPACK.
*-----Attachment details
*-- Final Data to send to EMail
LOOP AT IT_ATTACHMENT.
OBJBIN-LINE = IT_ATTACHMENT-EMAIL.
APPEND OBJBIN.
CLEAR OBJBIN.
ENDLOOP.
*-- Get total no.of lines of Object table(attachment)
CLEAR : TAB_LINES.
DESCRIBE TABLE OBJBIN LINES TAB_LINES.
*-- Populate object header(attachment name)
OBJHEAD = EMATTACH.
APPEND OBJHEAD.
CLEAR OBJHEAD.
*-- Packing list for attachment
OBJPACK-TRANSF_BIN = 'X'.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 1.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = TAB_LINES .
OBJPACK-DOC_TYPE = 'TXT'.
OBJPACK-OBJ_NAME = 'Z2318S1B01'.
OBJPACK-OBJ_DESCR = EMSUBJ.
OBJPACK-DOC_SIZE = TAB_LINES * 255.
APPEND OBJPACK.
CLEAR OBJPACK.
*-- Populate Mail Id's
LOOP AT EMAILID.
RECLIST-RECEIVER = EMAILID-LOW.
APPEND RECLIST.
ENDLOOP.
RECLIST-REC_TYPE = 'U'.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = DOC_CHNG
PUT_IN_OUTBOX = 'X'
* IMPORTING
* SENT_TO_ALL =
* NEW_OBJECT_ID =
TABLES
PACKING_LIST = OBJPACK
OBJECT_HEADER = OBJHEAD
CONTENTS_BIN = OBJBIN
CONTENTS_TXT = OBJTXT
* CONTENTS_HEX =
* 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.
Thanks
Vikranth Khimavath
Message was edited by:
Khimavath Vikranth
Message was edited by:
Khimavath Vikranth
2007 Feb 02 7:25 PM
Hi Vikrant,
Populate the Email id table like this & try:
LOOP AT EMAILID.
RECLIST-RECEIVER = '[email protected]'.
RECLIST-REC_TYPE = 'U'.
APPEND RECLIST.
ENDLOOP.
Add reciever type inside the loop & endloop.
This will solve your problem.
Reward points for helpful answers.
Ashvender
2007 Feb 02 7:32 PM
2007 Feb 02 8:54 PM
Hi
Just put a break-point before the function module to send email & check all the tables & structure are they getting populated properly or not? & check the contents of Recievers internal table what data is there.
Ashvender
2007 Feb 02 9:09 PM
Hi Vikranth,
Check the below mentioned code. In this code replace the code of converting attachment(PDF) with Text. & pass the table contents_hex in function module fro sending email.
REPORT z_test.
DATA: x_ctrl_p TYPE ssfctrlop,
x_output_data TYPE ssfcrescl.
DATA: it_docs LIKE docs OCCURS 0 WITH HEADER LINE,
it_lines LIKE tline OCCURS 0 WITH HEADER LINE,
it_packing LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE.
*-----Initialisation
x_ctrl_p-no_dialog = 'X'.
x_ctrl_p-getotf = 'X'.
x_ctrl_p-langu = sy-langu.
----
Internal Tables Declaration *
----
DATA: it_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,
it_pcklist LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
it_mess LIKE solisti1 OCCURS 0 WITH HEADER LINE,
it_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
it_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
it_table LIKE solix OCCURS 0 WITH HEADER LINE.
DATA: it_soli LIKE soli OCCURS 0 WITH HEADER LINE.
*-----Work area declaration
DATA: wa_doc_data TYPE sodocchgi1.
----
Variable Declaration *
----
DATA: v_lines_txt TYPE i,
v_lines_bin TYPE i,
v_lines TYPE i,
v_fname TYPE rs38l_fnam,
v_size TYPE i,
v_filename TYPE rlgrap-filename.
----
Start of selection event *
----
START-OF-SELECTION.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'Z_SMTF_TEST'
IMPORTING
fm_name = v_fname.
CALL FUNCTION v_fname
EXPORTING
control_parameters = x_ctrl_p
IMPORTING
job_output_info = x_output_data.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 134
IMPORTING
bin_filesize = v_size
TABLES
otf = x_output_data-otfdata
lines = it_lines
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
OTHERS = 4.
CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
EXPORTING
line_width_dst = 255
TABLES
content_in = it_lines
content_out = it_soli
EXCEPTIONS
err_line_width_src_too_long = 1
err_line_width_dst_too_long = 2
err_conv_failed = 3
OTHERS = 4.
CALL FUNCTION 'ZFUNC_CONVERT_DATA_ODC01'
EXPORTING
iv_byte_mode = 'X'
TABLES
it_data = it_lines
et_data = it_table.
*-----To caluculate total number of lines of internal table
DESCRIBE TABLE it_table LINES v_lines.
*-----Function module to download the output file.
CALL FUNCTION 'DOWNLOAD'
EXPORTING
bin_filesize = v_size
filename = ' '
filetype = 'BIN'
IMPORTING
act_filename = v_filename
TABLES
data_tab = it_lines.
*-----Create Message Body and Title and Description
it_mess =
'i have successfully converted smartform from otf format to pdf' .
" and i have attached that in mail'.
APPEND it_mess.
wa_doc_data-obj_name = 'smartform'.
wa_doc_data-expiry_dat = sy-datum + 10.
wa_doc_data-obj_descr = 'smartform'.
wa_doc_data-sensitivty = 'F'.
wa_doc_data-doc_size = v_lines * 255.
APPEND it_pcklist.
*-----PDF Attachment
it_pcklist-transf_bin = 'X'.
it_pcklist-head_start = 1.
it_pcklist-head_num = 0.
it_pcklist-body_start = 1.
it_pcklist-doc_size = v_lines_bin * 255 .
it_pcklist-body_num = v_lines.
it_pcklist-doc_type = 'PDF'.
it_pcklist-obj_name = 'smartform'.
it_pcklist-obj_descr = 'smart_desc'.
it_pcklist-obj_langu = 'E'.
it_pcklist-doc_size = v_lines * 255.
APPEND it_pcklist.
*-----Giving the receiver email-id
CLEAR it_receivers.
it_receivers-receiver = '[email protected]'.
it_receivers-rec_type = 'U'.
APPEND it_receivers.
CLEAR it_receivers.
it_receivers-receiver = '[email protected]'.
it_receivers-rec_type = 'U'.
APPEND it_receivers.
*-----Calling the function module to sending email
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = wa_doc_data
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = it_pcklist
contents_txt = it_mess
contents_hex = it_table
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.
IF sy-subrc = 0.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
WITH rfcgroup = 'iwdf7ytc_YD3_94'
AND RETURN.
REFRESH: it_receivers,
it_mess,
it_pcklist.
ENDIF.
Ashven
2007 Mar 19 8:34 AM
Hi
My name is Faina
I'm also trying to email my smartform.
The question is: where did you take the function ''ZFUNC_CONVERT_DATA_ODC01'?
Can somebody please send me this function?
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |