Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Mail without Subject

Former Member
0 Likes
1,324

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,287

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..

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.

9 REPLIES 9
Read only

Former Member
0 Likes
1,287

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.

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,287

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

Read only

Former Member
0 Likes
1,288

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..

Read only

0 Likes
1,287

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.

Read only

0 Likes
1,287

What is the runtime error?

Regards,

Rich Heilman

Read only

0 Likes
1,287

Hi Gregory,

after IMPORT jus read it & then pass it to the function module..

ie

READ IT_SUBJ index 1.

~Suresh

Read only

0 Likes
1,287

Thx a lot Suresh!

Problem Solved.

Regards.

Gregory

Read only

0 Likes
1,287

If the paramemter was defined as a structure instead of an internal table, you would not have to read it, this is the point.

Regards

Rich Heilman

Read only

Former Member
0 Likes
1,287

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.