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

Pls help me

Former Member
0 Likes
724

I am using FM 'SO_NEW_DOCUMENT_SEND_API1' to send mail to outlook from sap. It is working fine.

my issue is Extra text '&SO_FORMAT=ASC' is added in the main body. I don no where it is coming from! Any one pls help me to remove this extra text

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
480

Hi

I can not find any solution in Above thread.

Following is my code

data: maildata type sodocchgi1.
data: mailtxt type table of solisti1 with header line.

DATA : BEGIN OF MAILREC1 OCCURS 0,
EMAIL1(30),
EMAIL2(30),
EMAIL3(30),
EMAIL4(30),
EMAIL5(30),
EMAIL6(30),
EMAIL7(30),
EMAIL8(30),
EMAIL9(30),
EMAIL10(30),
end OF MAILREC1.

data: mailrec type table of somlrec90 with header line.
clear: maildata, mailtxt, mailrec.
refresh: mailtxt, mailrec.
*maildata-obj_name = 'TEST'.
maildata-obj_descr = 'DDL Reloaded for Approvel Number'.
CONCATENATE maildata-obj_descr p_appno INTO maildata-obj_descr.
maildata-obj_langu = sy-langu.

mailtxt-line = 'Please Note above request has been Completed'.
append mailtxt.

select email1 email2 email3 email4 email5
       email6 email7 email8 email9  email10
 from z1ychclientid into table mailrec1
      where werks = p_werks.
if mailrec1[] is not initial.
loop at mailrec1.
mailrec-rec_type = 'U'.
mailrec-receiver =  mailrec1-email1.
append mailrec.
mailrec-receiver =  mailrec1-email2.
append mailrec.
mailrec-receiver =  mailrec1-email3.
append mailrec.
mailrec-receiver =  mailrec1-email4.
append mailrec.
mailrec-receiver =  mailrec1-email5.
append mailrec.
mailrec-receiver =  mailrec1-email6.
append mailrec.
mailrec-receiver =  mailrec1-email7.
append mailrec.
mailrec-receiver =  mailrec1-email8.
append mailrec.
mailrec-receiver =  mailrec1-email9.
append mailrec.
mailrec-receiver =  mailrec1-email10.
append mailrec.
endloop.
endif.

call function 'SO_NEW_DOCUMENT_SEND_API1'
exporting
document_data = maildata
*document_type = 'RAW'
put_in_outbox = 'X'
tables
object_header = mailtxt
object_content = mailtxt
receivers = mailrec
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.
COMMIT WORK.
if sy-subrc = 0.
*write : 'mail sent'.
endif.

3 REPLIES 3
Read only

Former Member
0 Likes
480

HI Kumar,

welcome to sdn,

see this threads your prob may solve...................

- 29k

thanks

karthik

Read only

Former Member
0 Likes
481

Hi

I can not find any solution in Above thread.

Following is my code

data: maildata type sodocchgi1.
data: mailtxt type table of solisti1 with header line.

DATA : BEGIN OF MAILREC1 OCCURS 0,
EMAIL1(30),
EMAIL2(30),
EMAIL3(30),
EMAIL4(30),
EMAIL5(30),
EMAIL6(30),
EMAIL7(30),
EMAIL8(30),
EMAIL9(30),
EMAIL10(30),
end OF MAILREC1.

data: mailrec type table of somlrec90 with header line.
clear: maildata, mailtxt, mailrec.
refresh: mailtxt, mailrec.
*maildata-obj_name = 'TEST'.
maildata-obj_descr = 'DDL Reloaded for Approvel Number'.
CONCATENATE maildata-obj_descr p_appno INTO maildata-obj_descr.
maildata-obj_langu = sy-langu.

mailtxt-line = 'Please Note above request has been Completed'.
append mailtxt.

select email1 email2 email3 email4 email5
       email6 email7 email8 email9  email10
 from z1ychclientid into table mailrec1
      where werks = p_werks.
if mailrec1[] is not initial.
loop at mailrec1.
mailrec-rec_type = 'U'.
mailrec-receiver =  mailrec1-email1.
append mailrec.
mailrec-receiver =  mailrec1-email2.
append mailrec.
mailrec-receiver =  mailrec1-email3.
append mailrec.
mailrec-receiver =  mailrec1-email4.
append mailrec.
mailrec-receiver =  mailrec1-email5.
append mailrec.
mailrec-receiver =  mailrec1-email6.
append mailrec.
mailrec-receiver =  mailrec1-email7.
append mailrec.
mailrec-receiver =  mailrec1-email8.
append mailrec.
mailrec-receiver =  mailrec1-email9.
append mailrec.
mailrec-receiver =  mailrec1-email10.
append mailrec.
endloop.
endif.

call function 'SO_NEW_DOCUMENT_SEND_API1'
exporting
document_data = maildata
*document_type = 'RAW'
put_in_outbox = 'X'
tables
object_header = mailtxt
object_content = mailtxt
receivers = mailrec
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.
COMMIT WORK.
if sy-subrc = 0.
*write : 'mail sent'.
endif.

Read only

0 Likes
480

HI kumar,'

have you seen clearly this....

I found the solution to the problem with the added text "&SO_FORMAT=ASC" etc. In the examples found elsewhere in this forum, the same table structure was passed to both object header and contents, like this:

CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'

EXPORTING

document_data = maildata

document_type = 'HTM'

put_in_outbox = 'X'

TABLES

object_header = mailtxt

object_content = mailtxt

receivers = mailrec

To remove tha trailing text, assign a different table to "object_header" instead, in my case I just left it empty (unassigned):

CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'

EXPORTING

document_data = maildata

document_type = 'HTM'

put_in_outbox = 'X'

TABLES

object_header = mailhdr

object_content = mailtxt

receivers = mailrec

happy solving.

thanks

karthik.