2009 Aug 18 8:37 AM
Hi,
I have a requirement in which,while creating quality notification I have to send a mail to finance department with some customized text.so we have created a follow up action for this and a function module which triggered by this follow up action.
in the function module i have written the following code
DATA: objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
DATA: objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE.
DATA: objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE.
DATA: objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE.
DATA: reclist LIKE somlreci1 OCCURS 5 WITH HEADER LINE.
DATA: doc_chng LIKE sodocchgi1.
DATA: tab_lines LIKE sy-tabix.
doc_chng-obj_name = 'SENDFILE'.
Mail Subject
doc_chng-obj_descr = 'Send External Mail'.
Mail Contents
objtxt = 'Minimum bid : $250000'.
APPEND objtxt.
objtxt = 'A representation of the pictures up for auction'.
APPEND objtxt.
objtxt = 'was included as attachment.'.
APPEND objtxt.
DESCRIBE TABLE objtxt LINES tab_lines.
READ TABLE objtxt INDEX tab_lines.
doc_chng-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
Creation of the entry for the compressed document
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.
Completing the recipient list
reclist-receiver = 'xyz.gmail.com'.
reclist-rec_type = 'U'.
APPEND reclist.*
*
Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = doc_chng
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 DOC_CHNG-OBJ_NAME.
ENDIF.
IF sy-subrc <> 0.
MESSAGE e208(00) WITH 'Error in sending email :-(('.
ELSE.
MESSAGE s208(00) WITH 'Email sent )'.
ENDIF.
CLEAR:p_email.
when I execute this,then the system is throwing an error "OBJECT DOES NOT EXIST (STATUS MANGEMENT)".
If i comment the above highleted one..it's not showing any error.but that is where i pass the receiver's email id..
murali.c
Edited by: murali ch on Aug 18, 2009 9:38 AM
Edited by: murali ch on Aug 18, 2009 9:40 AM
Hi,
I have a requirement in which,while creating quality notification I have to send a mail to finance department with some customized text.so we have created a follow up action for this and a function module which triggered by this follow up action.
in the function module i have written the following code
DATA: objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
DATA: objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE.
DATA: objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE.
DATA: objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE.
DATA: reclist LIKE somlreci1 OCCURS 5 WITH HEADER LINE.
DATA: doc_chng LIKE sodocchgi1.
DATA: tab_lines LIKE sy-tabix.
doc_chng-obj_name = 'SENDFILE'.
Mail Subject
doc_chng-obj_descr = 'Send External Mail'.
Mail Contents
objtxt = 'Minimum bid : $250000'.
APPEND objtxt.
objtxt = 'A representation of the pictures up for auction'.
APPEND objtxt.
objtxt = 'was included as attachment.'.
APPEND objtxt.
DESCRIBE TABLE objtxt LINES tab_lines.
READ TABLE objtxt INDEX tab_lines.
doc_chng-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
Creation of the entry for the compressed document
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.
Completing the recipient list
reclist-receiver = 'xyz.gmail.com'.
reclist-rec_type = 'U'.
APPEND reclist.*
*
Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = doc_chng
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 DOC_CHNG-OBJ_NAME.
ENDIF.
IF sy-subrc <> 0.
MESSAGE e208(00) WITH 'Error in sending email :-(('.
ELSE.
MESSAGE s208(00) WITH 'Email sent )'.
ENDIF.
CLEAR:p_email.
when I execute this,then the system is throwing an error "OBJECT DOES NOT EXIST (STATUS MANGEMENT)".
If i comment the above highleted one..it's not showing any error.but that is where i pass the receiver's email id..
murali.c
Edited by: murali ch on Aug 18, 2009 9:38 AM
Edited by: murali ch on Aug 18, 2009 9:40 AM
2009 Sep 04 7:15 PM
Hi,
You can comment/remove "commit_work = 'X'" which has been used with e-mail send function module.
As you are calling your functionality inbetween SAP std. transaction processing, it's not recommended to use commit work in logic, which is creating problem.
Even do not try external COMMIT statement in your logic, as again it will endup in issue.
Regards,
Avinash.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |