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

Regarding FM SO_NEW_DOCUMENT_ATT_SEND_API1

Former Member
0 Likes
1,090

Hi all, Currently i am using the following code. But still mails are not going to receipient. Can anybody suggest me what is going wrong with code.

DATA:

tab_lines TYPE i,

docdata LIKE sodocchgi1 ,

objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,

objhead LIKE solisti1 OCCURS 0 WITH HEADER LINE,

objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,

msgtbl TYPE ehsww_text OCCURS 0 WITH HEADER LINE,

reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE.

SORT it_message BY dlist.

DATA : l_subject(50) TYPE c,

l_dlist(50) TYPE c.

LOOP AT it_message.

l_subject = it_message-subject .

AT NEW dlist.

REFRESH:

objpack, objhead, objtxt, reclist.

CLEAR:

docdata, objpack, objhead, objtxt, reclist.

  • Title and Description

docdata-obj_name = 'Status report'(034).

docdata-obj_descr = l_subject . "'Movement Status Report'.

ENDAT.

  • FM which wraps the 512 length string contents to 255 characters

CALL FUNCTION 'EHS00_WORDWRAP02'

EXPORTING

im_string = it_message-message

im_len = 255

TABLES

ex_ftext = msgtbl.

    • Main Text

LOOP AT msgtbl.

objtxt = msgtbl.

APPEND objtxt.

ENDLOOP.

l_dlist = it_message-dlist.

AT END OF dlist.

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 = 'RAW'.

APPEND objpack.

    • Create receiver list

reclist-receiver = l_dlist.

reclist-rec_type = 'U'. "C " ADDED BY CAGK932834 SP76477

reclist-copy = true.

APPEND reclist.

    • Send Message

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

EXPORTING

document_data = docdata

put_in_outbox = 'X'

COMMIT_EORK = 'X'

TABLES

packing_list = objpack

object_header = objhead

contents_txt = objtxt

receivers = reclist.

Thanks for all your help in advance.

Sidds.

Hi all, Currently i am using the following code. But still mails are not going to receipient. Can anybody suggest me what is going wrong with code.

DATA:

tab_lines TYPE i,

docdata LIKE sodocchgi1 ,

objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,

objhead LIKE solisti1 OCCURS 0 WITH HEADER LINE,

objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,

msgtbl TYPE ehsww_text OCCURS 0 WITH HEADER LINE,

reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE.

SORT it_message BY dlist.

DATA : l_subject(50) TYPE c,

l_dlist(50) TYPE c.

LOOP AT it_message.

l_subject = it_message-subject .

AT NEW dlist.

REFRESH:

objpack, objhead, objtxt, reclist.

CLEAR:

docdata, objpack, objhead, objtxt, reclist.

  • Title and Description

docdata-obj_name = 'Status report'(034).

docdata-obj_descr = l_subject . "'Movement Status Report'.

ENDAT.

  • FM which wraps the 512 length string contents to 255 characters

CALL FUNCTION 'EHS00_WORDWRAP02'

EXPORTING

im_string = it_message-message

im_len = 255

TABLES

ex_ftext = msgtbl.

    • Main Text

LOOP AT msgtbl.

objtxt = msgtbl.

APPEND objtxt.

ENDLOOP.

l_dlist = it_message-dlist.

AT END OF dlist.

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 = 'RAW'.

APPEND objpack.

    • Create receiver list

reclist-receiver = l_dlist.

reclist-rec_type = 'U'. "C " ADDED BY CAGK932834 SP76477

reclist-copy = true.

APPEND reclist.

    • Send Message

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

EXPORTING

document_data = docdata

put_in_outbox = 'X'

COMMIT_EORK = 'X'

TABLES

packing_list = objpack

object_header = objhead

contents_txt = objtxt

receivers = reclist.

Thanks for all your help in advance.

Sidds.

8 REPLIES 8
Read only

Former Member
0 Likes
1,051

Hi

First ensure that the right data is coming into the all import and export parameters of the fun module

then check for the connectivity in the <b>SCOT and SOST</b> transactions and see

Regards

Anji

Read only

0 Likes
1,051

Hello Anji,

Thank you for your reply. I have checked with scot sost. The settings are proper but the mail information is not going to SAP outbox also. I set this to 'X'. I think it should go in outbox also.

Read only

Former Member
0 Likes
1,051

Hi,

Put a beark point in your code at

<b>l_dlist = it_message-dlist.</b>

and check what it is populating is this one contains any mail id or distribution list name

if it was dist list name then as per my knowledge no mails will be sent

l_dlist must contain the email id of the user

Regards,

siva chalsani.

Read only

0 Likes
1,051

Hi Siva,

Thanks for reply. Yeah it is coming as destribution list. But i am replacing that in debug mode with my email -id. Still they are not coming.

One what exactly is the REC_TYPE ? How many types are there??

Read only

0 Likes
1,051

Hi,

check your scot transaction.

your are sending to your own mail id I.E company mail id?

You can not send to your own mail id as per my knowledge

try to send it to gmail or yahoo or others

Regards,

siva chalasani

Read only

0 Likes
1,051

I tried with that also.

Read only

Former Member
0 Likes
1,051

Hi

these are the types you can use

P Private distribution list

C Shared distribution list

O SAPoffice user

B SAP user

<b>U Internet address</b>

X X.400 address

R SAP user in another SAP System

F Fax number

D X.500 Address

L Telex number

H Organizational unit/position

J SAP object

G Organization object/ID

K Pager/SMS

But i am not sure why your mails were not sent

Regards,

siva chalasani

Read only

0 Likes
1,051

Hello ,

How can i generate my own list..OR how can i check the group members of list.

Reclist.

Thank you.