05-10-2006 10:06 AM
Hi All,
I am using the function module <b>'SO_NEW_DOCUMENT_ATT_SEND_API1'</b> to send mail with attachment.
the program executes properly and shows a message <b>'Document Sent'</b>. But neither the sent mail appears in <b>'SOST'</b> nor I get it on the specified email id.
Below is my code:
<b>***</b> As attachment I am sending resume whose contents are stored in table 'ZResume' corresponding to personnel no.(pernr) and serial No.(srno).
-
<b>START OF PROGRAM</b>----
REPORT ZPTEST_SEND_MAIL_ATTATCHMENT.
DATA : w_name TYPE sos04-l_adr_name.
DATA: RESUME TYPE table of XSTRING with header line.
*----
START-OF-SELECTION.
<b>* Data Declaration</b>
DATA:
l_datum(10),
ls_docdata TYPE sodocchgi1,
lt_objpack TYPE TABLE OF sopcklsti1 WITH HEADER LINE,
lt_objhead TYPE TABLE OF solisti1 WITH HEADER LINE,
lt_objtxt TYPE TABLE OF solisti1 WITH HEADER LINE,
lt_objbin TYPE TABLE OF solisti1 WITH HEADER LINE,
lt_reclist TYPE TABLE OF somlreci1 WITH HEADER LINE,
lt_listobject TYPE TABLE OF abaplist WITH HEADER LINE,
l_tab_lines TYPE i,
l_att_type LIKE soodk-objtp.
WRITE sy-datum TO l_datum.
SELECT SINGLE RESUME FROM ZRESUME INTO RESUME
WHERE PERNR EQ '00001182'
AND SRNO EQ '1'.
APPEND RESUME.
<b>* Because RESUME may be of size RAW(1000)
and objbin is of size CHAR(255) we make this table copy</b>
CALL FUNCTION 'TABLE_COMPRESS'
TABLES
in = resume
out = lt_objbin
EXCEPTIONS
compress_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
Error in function module &1
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'TABLE_COMPRESS'.
ENDIF.
<b>* Create the message and send the document.
Create Message Body</b>
<b>* Title and Description</b>
ls_docdata-obj_name = 'Resume'.
ls_docdata-obj_descr = 'Resume'.
<b>* Main Text</b>
lt_objtxt = 'Resume of the candidate' .
APPEND lt_objtxt.
<b>* Write Packing List (Main)</b>
DESCRIBE TABLE lt_objtxt LINES l_tab_lines.
READ TABLE lt_objtxt INDEX l_tab_lines.
ls_docdata-doc_size = ( l_tab_lines - 1 ) * 255 + STRLEN( lt_objtxt ).
CLEAR lt_objpack-transf_bin.
lt_objpack-head_start = 1.
lt_objpack-head_num = 0.
lt_objpack-body_start = 1.
lt_objpack-body_num = l_tab_lines.
lt_objpack-doc_type = 'RAW'.
APPEND lt_objpack.
<b>* Create Message Attachment
Write Packing List (Attachment)</b>
l_att_type = 'ALI'.
DESCRIBE TABLE lt_objbin LINES l_tab_lines.
READ TABLE lt_objbin INDEX l_tab_lines.
lt_objpack-doc_size = ( l_tab_lines - 1 ) * 255 + STRLEN( lt_objbin ).
lt_objpack-transf_bin = 'X'.
lt_objpack-head_start = 1.
lt_objpack-head_num = 0.
lt_objpack-body_start = 1.
lt_objpack-body_num = l_tab_lines.
lt_objpack-doc_type = l_att_type.
lt_objpack-obj_name = 'ATTACHMENT'.
lt_objpack-obj_descr = 'Resume'.
APPEND lt_objpack.
<b>* Create receiver list</b>
lt_reclist-receiver = 'pragyavatsa@ko-india.com'.
lt_reclist-rec_type = 'U'.
APPEND lt_reclist.
<b>* Send Message</b>
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = ls_docdata
put_in_outbox = ''
TABLES
packing_list = lt_objpack
object_header = lt_objhead
contents_bin = lt_objbin
contents_txt = lt_objtxt
receivers = lt_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
IF sy-subrc = 0.
Document sent
MESSAGE ID 'SO' TYPE 'S' NUMBER '022'.
ELSE.
Document <&> could not be sent
MESSAGE ID 'SO' TYPE 'S' NUMBER '023'
WITH ls_docdata-obj_name.
ENDIF.
-
<b>END OF PROGRAM</b>----
Can anybody tell me where I am making mistake?
Thanks in advance,
Pragya
05-10-2006 10:42 AM
Hi pragya,
1. <b>Very MINOR MISTAKE</b>.
2. <b>commit_work = 'X'</b>
3. pass this parameter also
while calling
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
4. <b>Now it will work.</b>
regards,
amit m.
05-10-2006 10:13 AM
Hai
check the following
Take a look at the following links which will explain how to do the above steps.
http://www.geocities.com/mpioud/Z_EMAIL_ABAP_REPORT.html
http://www.thespot4sap.com/Articles/SAP_Mail_SO_Object_Send.asp
http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm
remember to change the doc type as 'HTM' in the FM to send email
what you could do is , replace all @xx@ with the url for the same from the BSP mime repository
(url pattern will be
http://applicationserver.domain.com:port/sap/public/bsp/sap/public/bc/icons/<icon name>)
but this would pose another issue, when the user opens the mail this would require authentication info for logging on to sap and get the MIME
Thanks & regards
Sreenivasulu P
05-10-2006 10:14 AM
Hi Pragya,
Refer the code below. It's working fine and try to match up the things from your program.
REPORT ZSAMPL_001 .
INCLUDE ZINCLUDE_01.
*----
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.
PARAMETERS : p_file LIKE rlgrap-filename
OBLIGATORY.
*----
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 ZINCLUDE_01 .
*----
10.08.2005 Amit M - Created
Include For Mail (First Req F16)
Modification Log
*
*
*
*
*
*
*
*----
*----
Data
*----
tables crmrfcpar.
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.
data v_rfcdest LIKE crmrfcpar-rfcdest.
*----
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
*----
FORM
*----
FORM ml_saveforbp USING jobname jobcount.
*----
Data
*data : yhead like yhrt_bp_head.
*DATA : ydocdata LIKE yhrt_bp_docdata,
*yobjtxt LIKE yhrt_bp_objtxt OCCURS 0 WITH HEADER LINE,
*yreclist LIKE yhrt_bp_reclist OCCURS 0 WITH HEADER LINE.
*
*
*DATA : seqnr TYPE i.
*
*
**----
Head
*yhead-jobname = jobname.
*yhead-jobcount = jobcount..
*MODIFY yhrt_bp_head FROM yhead.
*
*
*
**----
Doc Data
*ydocdata-jobname = jobname.
*ydocdata-jobcount = jobcount.
*MOVE-CORRESPONDING docdata TO ydocdata.
*MODIFY yhrt_bp_docdata FROM ydocdata.
*
**----
Objtxt
*seqnr = 0.
*LOOP AT objtxt.
*seqnr = seqnr + 1.
*yobjtxt-jobname = jobname.
*yobjtxt-jobcount = jobcount.
*yobjtxt-seqnr = seqnr.
*MOVE-CORRESPONDING objtxt TO yobjtxt.
*MODIFY yhrt_bp_objtxt FROM yobjtxt.
*ENDLOOP.
*
*
**----
RecList
*seqnr = 0.
*LOOP AT reclist.
*seqnr = seqnr + 1.
*yreclist-jobname = jobname.
*yreclist-jobcount = jobcount.
*yreclist-seqnr = seqnr.
*MOVE-CORRESPONDING reclist TO yreclist.
*MODIFY yhrt_bp_reclist FROM yreclist.
*ENDLOOP.
ENDFORM. "ml_saveforbp
*----
FORM
*----
FORM ml_fetchfrombp USING jobname jobcount.
*CLEAR docdata.
*REFRESH objtxt.
*REFRESH reclist.
*
*SELECT SINGLE * FROM yhrt_bp_docdata
*INTO corresponding fields of docdata
*WHERE jobname = jobname
*AND jobcount = jobcount.
*
*
*SELECT * FROM yhrt_bp_objtxt
*INTO corresponding fields of TABLE objtxt
*WHERE jobname = jobname
*AND jobcount = jobcount
*ORDER BY seqnr.
*
*SELECT * FROM yhrt_bp_reclist
*INTO corresponding fields of TABLE reclist
*WHERE jobname = jobname
*AND jobcount = jobcount
*ORDER BY seqnr.
*
ENDFORM. "ml_fetchfrombp
<b>Please reward points if it helps.</b>
Regards,
Amit Mishra
05-10-2006 10:22 AM
hi pragnya,
set put_in_outbox = 'X'.
atleast the mail will be in the outbox.
thanks,
priya.
05-10-2006 10:25 AM
05-10-2006 10:32 AM
Hi Pragya,
Check it in SCOT transaction, may be it is in queue. try to send manually from SCOT transaction.
Regards
vijay
05-10-2006 10:36 AM
Hi Pragya,
<b> 1</b>.You are not converting ur table into PDF format
before sending using FM SO_NEW_DOCUMENT_ATT_SEND_API1.
<b> 2</b>.Am sending my program for mail with PDF attachment.But
PDF is generated based on spool request. I think that
it is not possible direct converting without spool.
<b> 3</b>.
CLEAR :w_subject,
sent_to_all,
i_pack_list[],
i_objhead[],
i_cont_bin[],
i_contents_text[],
i_receiver[].
DATA :l_begda(10),
l_endda(10).
i_cont_bin = ' | '.
APPEND i_cont_bin.
*----
Subject of the mail.
WRITE pn_begda TO l_begda.
WRITE sy-datum TO l_endda.
CONCATENATE 'Bank details updated from' l_begda 'to' l_endda
INTO obj_desc
SEPARATED BY space.
w_subject-obj_name = 'MAIL_ALI'.
w_subject-obj_descr = obj_desc.
*----
Body of the mail
DATA :head_desc LIKE i_contents_text,
body_desc LIKE i_contents_text.
i_contents_text = space.
APPEND i_contents_text.
CLEAR i_contents_text.
CONCATENATE 'System checks have shown that the employees'
'in the attached file'
'have updated their Bank details.'
INTO body_desc
SEPARATED BY space.
i_contents_text = body_desc.
APPEND i_contents_text.
CLEAR i_contents_text.
CLEAR body_desc.
i_contents_text = space.
APPEND i_contents_text.
CLEAR i_contents_text.
i_contents_text = 'Thank You.'.
APPEND i_contents_text.
CLEAR i_contents_text.
i_contents_text = space.
APPEND i_contents_text.
CLEAR i_contents_text.
CONCATENATE '(Note: This is system generated message, please'
'do not reply'
'to this Email.)'
INTO i_contents_text
SEPARATED BY space.
APPEND i_contents_text.
CLEAR i_contents_text.
*----
Write Packing List (Body)
DESCRIBE TABLE i_contents_text LINES tab_lines.
READ TABLE i_contents_text INDEX tab_lines.
w_subject-doc_size = ( tab_lines - 1 ) * 255 + STRLEN(
i_contents_text ).
CLEAR i_pack_list-transf_bin.
i_pack_list-head_start = 1.
i_pack_list-head_num = 0.
i_pack_list-body_start = 1.
i_pack_list-body_num = tab_lines.
i_pack_list-doc_type = 'RAW'.
APPEND i_pack_list.
CLEAR i_pack_list.
*----
Create receiver list
i_receiver-receiver = p_mailb1.
i_receiver-rec_type = 'U'.
APPEND i_receiver.
CLEAR i_receiver.
i_receiver-receiver = p_mailb2.
i_receiver-rec_type = 'U'.
APPEND i_receiver.
CLEAR i_receiver.
*----
Select query for Spool requests
REFRESH content_out.
CONCATENATE sy-repid0(9) sy-uname0(3) INTO tsp01-rq2name.
SELECT MAX( rqcretime )
FROM tsp01
INTO tsp01-rqcretime
WHERE rq2name = tsp01-rq2name.
IF sy-subrc = 0.
SELECT SINGLE *
FROM tsp01
WHERE rqcretime = tsp01-rqcretime.
IF sy-subrc <> 0.
MESSAGE s000(0k) WITH 'Spool Number does not exist'.
EXIT.
ELSE.
client = tsp01-rqclient.
name = tsp01-rqo1name.
ENDIF.
ENDIF.
CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
EXPORTING
authority = 'SP01'
client = client
name = name
part = 1
IMPORTING
type = type
objtype = objtype
EXCEPTIONS
fb_error = 1
fb_rsts_other = 2
no_object = 3
no_permission = 4
OTHERS = 5.
IF objtype(3) = 'OTF'.
is_otf = 'X'.
ELSE.
is_otf = space.
ENDIF.
*----
Convert Spool job to PDF
IF is_otf = 'X'.
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = tsp01-rqident "Spool req number
no_dialog = ' '
IMPORTING
pdf_bytecount = no_of_bytes
pdf_spoolid = pdf_spoolid
btc_jobname = jobname
btc_jobcount = jobcount
TABLES
pdf = pdf
EXCEPTIONS
err_no_otf_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_dstdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
OTHERS = 12.
CASE sy-subrc.
WHEN 0.
WHEN 1.
MESSAGE s000(0k) WITH 'No OTF Spool Job'.
EXIT.
WHEN 2.
MESSAGE s000(0k) WITH 'Spool Number does not exist'.
EXIT.
WHEN 3.
MESSAGE s000(0k) WITH 'No permission for spool'.
EXIT.
WHEN OTHERS.
MESSAGE s000(0k) WITH 'Error in Function CONVERT_OTFSPOOLJOB_2_PDF'.
EXIT.
ENDCASE.
ELSE.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = tsp01-rqident
no_dialog = ' '
IMPORTING
pdf_bytecount = no_of_bytes
pdf_spoolid = pdf_spoolid
btc_jobname = jobname
btc_jobcount = jobcount
TABLES
pdf = pdf
EXCEPTIONS
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
OTHERS = 12.
CASE sy-subrc.
WHEN 0.
WHEN 1.
MESSAGE s000(0k) WITH 'No ABAP Spool Job'.
EXIT.
WHEN 2.
MESSAGE s000(0k) WITH 'Spool Number does not exist'.
EXIT.
WHEN 3.
MESSAGE s000(0k) WITH 'No permission for spool'.
EXIT.
WHEN OTHERS.
MESSAGE s000(0k)
WITH 'Error in Function CONVERT_ABAPSPOOLJOB_2_PDF'.
EXIT.
ENDCASE.
ENDIF.
CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
EXPORTING
line_width_src = 134
line_width_dst = 255
TABLES
content_in = pdf
content_out = content_out
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 s000(0k) WITH 'Conversion Failed'.
EXIT.
ENDIF.
---------------------Create Message Attachment
DESCRIBE TABLE i_cont_bin LINES tab_lines.
i_pack_list-transf_bin = 'X'.
i_pack_list-head_start = tab_lines + 1.
i_pack_list-head_num = 0.
i_pack_list-body_start = tab_lines + 1.
APPEND LINES OF content_out[] TO i_cont_bin[].
DESCRIBE TABLE content_out LINES tab_lines.
i_pack_list-doc_size = tab_lines * 255.
i_pack_list-body_num = tab_lines.
i_pack_list-doc_type = 'PDF'.
i_pack_list-obj_name = 'ATTACHMENT'.
i_pack_list-obj_descr = 'Changes in Employees bank details'.
APPEND i_pack_list.
CLEAR i_pack_list.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = w_subject
put_in_outbox = 'X'
commit_work = 'X'
IMPORTING
sent_to_all = sent_to_all
TABLES
packing_list = i_pack_list
object_header = i_objhead
contents_bin = i_cont_bin
contents_txt = i_contents_text
receivers = i_receiver
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 NE 0.
endif.
Please let me know ,if u have any problem.
<b>Thanks,
Venkat.O</b>
05-10-2006 10:42 AM
Hi pragya,
1. <b>Very MINOR MISTAKE</b>.
2. <b>commit_work = 'X'</b>
3. pass this parameter also
while calling
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
4. <b>Now it will work.</b>
regards,
amit m.
05-10-2006 10:55 AM
hi,
in the function module call
COMMIT_WORK = 'X'. "instead of space.
change this & i believe your program works fine.
Regards
srikanth
05-10-2006 11:02 AM
Hi Amit,
Thanks for help.
Now I can see the mail in 'SOST'.
But when I start send process, it gives dump.
shows:
Error when starting a remote function call: 'RFC_GET6'.
Can u help me?
Regards,
Pragya
05-10-2006 11:13 AM
Hi again,
1. I think for this u will have
to contact basis team.
They might be able to help u.
regards,
amit m.
05-15-2006 5:01 PM
Hi Pragya,
This is Yuvaraj.I am getting the same problem as u have mentioned in herer.
Please tell me as how did u solve ur problem.
You can mai me at yuvraj_n_bhosale@yahoo.com or reply here itself.
Please do the needful.I need this very badly.
Thanks and regards,
Yuvaraj.
05-16-2006 7:01 AM
Hi Yuvaraj,
wat problem you are talking about? Do you mean by
<b>'</b>the program executes properly and shows a message 'Document Sent'. But neither the sent mail appears in 'SOST' nor I get it on the specified email id<b>'</b>??
If this is the problem then just change your code <b>in function call</b> and change it to:
<b>Commit = 'X'
put_in_outbox = 'X'</b>
If you are talking about the problem of getting dump saying <b>'RFC_GET6'</b> then do one thing
see my code above . While preaparing <b>attachment</b> in I have mentioned <b>lt_objpack-doc_type</b> to 'ALI'.
you just use <b>'HTM'</b> instead of 'ALI'.
I did that and got my problem solved.
Hope you will also get it done.
If still you have problem, let me know.
Regards,
pragya
05-16-2006 10:25 AM
Hi Pragya,
Thanx for ur quick response.I am able to see the mail in SOST, but it is telling as "WAIT FOR COMMUNICATION SERVICES" I did the change as ALI to HTM but still I am getting the same error.When I try to send mail once again it is telling the message us already in queue.
Please help me.
Thanks and regareds,
Yuvaraj.
05-16-2006 10:46 AM
Hi Yuvaraj,
This is not an error. You just go to <b>'SOST'</b> transaction. See the menu <b>'utilities'</b>. There is <b>'Send start Process'</b>.
Click that and the mail will be sent.
You can scherdule mail processing instead of doing it manually. To <b>schedule</b> it, go to <b>Scot</b> . In <b>'settings'</b> there is <b>'Send jobs'</b>. click that and a screen will appear where yopu can b<b>create a job</b>.
Try that . That will definitely help you understand.
Regards,
pragya
05-16-2006 11:10 AM
Hi Pragya,
When I am trying to send mail through SOST I am giving Transfer method as INT-internet.Then it is giving error as "ERROR WHEN STARTING REMOTE FUNCTION CALL".
Intrnal error code "RFC_GET3"
And when I am trying to schedule it through SCOT there is no link as sendjobs under settings.
Please help me.
Thanks and regards,
Yuvaraj
05-16-2006 11:25 AM
Hi Pragya,
I ma not able to solve the problem.
When I am trying to send through SOST it is telling RFC_GET3 error...
and in SCOT there is no link calle as send jobs under SETTINGS.
Please help me.
Thanks and regards,
Yuvaraj.