2006 Sep 26 4:35 PM
Hi all.
I'm having problems with mails subject using the function SO_DOCUMENT_SEND_API1.
From an HR Dinamic Action I'm executing another report that calls the function named above, this is because without doing that the function doesnt send the emails.
The Dinamic Action exports to memory all the structures needed to call the function and the report imports from memory those structures and executes the function.
The code is like the following code:
FORM SEND_MAIL.
EXPORT IT_SUBJ TO MEMORY ID 'SUBJ'.
EXPORT IT_FORMAT TO MEMORY ID 'FORMAT'.
EXPORT IT_TEXT TO MEMORY ID 'TEXT'.
EXPORT IT_DEST TO MEMORY ID 'DEST'.
SUBMIT ZHR_MAIL_DINAMIC_ACTION AND RETURN.
ENDFORM.
REPORT ZHR_MAIL_DINAMIC_ACTION.
DATA:
IT_FORMAT TYPE STANDARD TABLE OF SOPCKLSTI1 WITH HEADER LINE,
IT_DEST TYPE STANDARD TABLE OF SOMLRECI1 WITH HEADER LINE,
IT_TEXT TYPE STANDARD TABLE OF SOLISTI1 WITH HEADER LINE,
IT_SUBJ TYPE STANDARD TABLE OF SODOCCHGI1 WITH HEADER LINE.
IMPORT IT_SUBJ FROM MEMORY ID 'SUBL'.
IMPORT IT_FORMAT FROM MEMORY ID 'FORMAT'.
IMPORT IT_TEXT FROM MEMORY ID 'TEXT'.
IMPORT IT_DEST FROM MEMORY ID 'DEST'.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_DATA = IT_SUBJ
COMMIT_WORK = 'X'
TABLES
PACKING_LIST = IT_FORMAT
CONTENTS_TXT = IT_TEXT
RECEIVERS = IT_DEST
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.
I run the Dinamic Action in debug mode and just before the function call the structure IT_SUBJ contains the correct subject, after the function call it still has the correct subject, and the mail sent subject says "Without Description".
I hope somebody can helps me.
Best Regards.
Gregory.
2006 Sep 26 4:52 PM
Hey Gregory,
Try with the following code if it doesn't works out.
data: l_message(150) type c, " Message line
l_gcftype like sood-objtp value 'RAW',
l_docsize type i.
Populating the subject for the email
l_message = 'List of error records in Purchase plan'(015).
x_object_hd_change-objdes = l_message.
x_object_hd_change-objla = sy-langu.
x_object_hd_change-objpri = '5'.
x_object_hd_change-objsns = 'F'.
x_object_hd_change-objlen = l_docsize.
Call function SO_OBJECT_SEND to send email
call function 'SO_OBJECT_SEND'
exporting
object_hd_change = x_object_hd_change
object_type = l_gcftype
outbox_flag = 'X'
owner = ' '
check_send_authority = ' '
tables
objcont = tb_objcont
receivers = tb_reclist
exceptions
active_user_not_exist = 1
communication_failure = 2
component_not_available = 3
folder_not_exist = 4
folder_no_authorization = 5
forwarder_not_exist = 6
note_not_exist = 7
object_not_exist = 8
object_not_sent = 9
object_no_authorization = 10
object_type_not_exist = 11
operation_no_authorization = 12
owner_not_exist = 13
parameter_error = 14
substitute_not_active = 15
substitute_not_defined = 16
system_failure = 17
too_much_receivers = 18
user_not_exist = 19
originator_not_exist = 20
x_error = 21
others = 22.
Regards
Jay..
Hey Gregory,
Try with the following code if it doesn't works out.
data: l_message(150) type c, " Message line
l_gcftype like sood-objtp value 'RAW',
l_docsize type i.
Populating the subject for the email
l_message = 'List of error records in Purchase plan'(015).
x_object_hd_change-objdes = l_message.
x_object_hd_change-objla = sy-langu.
x_object_hd_change-objpri = '5'.
x_object_hd_change-objsns = 'F'.
x_object_hd_change-objlen = l_docsize.
Call function SO_OBJECT_SEND to send email
call function 'SO_OBJECT_SEND'
exporting
object_hd_change = x_object_hd_change
object_type = l_gcftype
outbox_flag = 'X'
owner = ' '
check_send_authority = ' '
tables
objcont = tb_objcont
receivers = tb_reclist
exceptions
active_user_not_exist = 1
communication_failure = 2
component_not_available = 3
folder_not_exist = 4
folder_no_authorization = 5
forwarder_not_exist = 6
note_not_exist = 7
object_not_exist = 8
object_not_sent = 9
object_no_authorization = 10
object_type_not_exist = 11
operation_no_authorization = 12
owner_not_exist = 13
parameter_error = 14
substitute_not_active = 15
substitute_not_defined = 16
system_failure = 17
too_much_receivers = 18
user_not_exist = 19
originator_not_exist = 20
x_error = 21
others = 22.
Regards
Jay..
2006 Sep 26 4:39 PM
Can you cut-paste the data you trying to pass to IT_FORMAT internal table ?? I think the problem lies in the packaging list definition.
2006 Sep 26 4:44 PM
The first problem I see is that the IT_SUBL should not be defined as an internal table.
DATA:
IT_FORMAT TYPE STANDARD TABLE OF SOPCKLSTI1 WITH HEADER LINE,
IT_DEST TYPE STANDARD TABLE OF SOMLRECI1 WITH HEADER LINE,
IT_TEXT TYPE STANDARD TABLE OF SOLISTI1 WITH HEADER LINE,
<b>IT_SUBJ TYPE STANDARD TABLE OF SODOCCHGI1 WITH HEADER LINE.</b>
IMPORT IT_SUBJ FROM MEMORY ID 'SUBL'.
IMPORT IT_FORMAT FROM MEMORY ID 'FORMAT'.
IMPORT IT_TEXT FROM MEMORY ID 'TEXT'.
IMPORT IT_DEST FROM MEMORY ID 'DEST'.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
<b>DOCUMENT_DATA = IT_SUBJ</b>
COMMIT_WORK = 'X'
TABLES
PACKING_LIST = IT_FORMAT
CONTENTS_TXT = IT_TEXT
RECEIVERS = IT_DEST
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.It should only be a structure.
data: wa_SUBJ TYPE SODOCCHGI1 .Make sure it is this way in the importing and exporting progams.
Regards,
Rich Heilman
2006 Sep 26 4:52 PM
Hey Gregory,
Try with the following code if it doesn't works out.
data: l_message(150) type c, " Message line
l_gcftype like sood-objtp value 'RAW',
l_docsize type i.
Populating the subject for the email
l_message = 'List of error records in Purchase plan'(015).
x_object_hd_change-objdes = l_message.
x_object_hd_change-objla = sy-langu.
x_object_hd_change-objpri = '5'.
x_object_hd_change-objsns = 'F'.
x_object_hd_change-objlen = l_docsize.
Call function SO_OBJECT_SEND to send email
call function 'SO_OBJECT_SEND'
exporting
object_hd_change = x_object_hd_change
object_type = l_gcftype
outbox_flag = 'X'
owner = ' '
check_send_authority = ' '
tables
objcont = tb_objcont
receivers = tb_reclist
exceptions
active_user_not_exist = 1
communication_failure = 2
component_not_available = 3
folder_not_exist = 4
folder_no_authorization = 5
forwarder_not_exist = 6
note_not_exist = 7
object_not_exist = 8
object_not_sent = 9
object_no_authorization = 10
object_type_not_exist = 11
operation_no_authorization = 12
owner_not_exist = 13
parameter_error = 14
substitute_not_active = 15
substitute_not_defined = 16
system_failure = 17
too_much_receivers = 18
user_not_exist = 19
originator_not_exist = 20
x_error = 21
others = 22.
Regards
Jay..
2006 Sep 26 5:01 PM
Hi and thx for ur answers Anurag, Rich, Jay.
I already use this function before and it works fine. Now i'm using it just like before.
The function execution do send the mail the problem is that the subject is wrong.
I try not defining the SUBJ structure as an internal table and the program gives me a runtime exception.
Regards.
Gregory.
2006 Sep 26 5:47 PM
2006 Sep 26 5:53 PM
Hi Gregory,
after IMPORT jus read it & then pass it to the function module..
ie
READ IT_SUBJ index 1.
~Suresh
2006 Sep 26 7:29 PM
2006 Sep 26 7:44 PM
2006 Sep 26 4:53 PM
Hi,
DATA:docdata LIKE sodocchgi1,
pack LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE,
head LIKE solisti1 OCCURS 1 WITH HEADER LINE,
txt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
bin LIKE solisti1 OCCURS 10 WITH HEADER LINE,
hex LIKE solix OCCURS 10 WITH HEADER LINE,
reclist LIKE somlreci1 OCCURS 1 WITH HEADER LINE,
tab_lines TYPE i,
doc_size TYPE i.
Fill Mail Contents
bin = space.
APPEND bin.
Contains the mail Header line
docdata-obj_name = x_mail_header.
docdata-obj_descr = x_mail_header.
Main Text
txt[] = itab_content[].
Write Packing List (Main)
DESCRIBE TABLE txt LINES tab_lines.
READ TABLE txt INDEX tab_lines.
docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( txt ).
CLEAR pack-transf_bin.
pack-head_start = 1.
pack-head_num = 0.
pack-body_start = 1.
pack-body_num = tab_lines.
pack-doc_type = 'RAW'.
APPEND pack.
Add User Id
reclist-receiver = x_mailid.
reclist-rec_type = 'C'.
APPEND reclist.
Send Message
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = docdata
put_in_outbox = ''
commit_work = 'X'
TABLES
packing_list = pack
object_header = head
contents_bin = bin
contents_txt = txt
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.
Hope this helps.
Regards.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |