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

Setting Mail sender name manually

0 Likes
5,070

hi

I am using 'SO_NEW_DOCUMENT_SEND_API1' function module to send mails. This function module takes the current user name as the mail sender name and sender mail ID.

Is there any way to set the mail sender name or sender mail id manually.

Thanks in advance,

Padmini

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,961

Hi,

use FM

SO_DOCUMENT_SEND_API1

For code refer to Function Module documentation.

Hope it helps...

Lokesh

hi

I am using 'SO_NEW_DOCUMENT_SEND_API1' function module to send mails. This function module takes the current user name as the mail sender name and sender mail ID.

Is there any way to set the mail sender name or sender mail id manually.

Thanks in advance,

Padmini

5 REPLIES 5
Read only

Former Member
0 Likes
1,961

In the program, U can pass the values and resend the values to the function module...Automatically, the new values are set.

Else, on selection-screen use parameters and internally pass these parameters to the FM.

Read only

Former Member
0 Likes
1,961

try SO_DOCUMENT_SEND_API1 . use the sender_address and sender_address_type.

CALL FUNCTION 'SO_DOCUMENT_SEND_API1'

EXPORTING

document_data = doc_chng

put_in_outbox = 'X'

sender_address = 'SAPSCHED'

sender_address_type = 'B'

  • IMPORTING

  • SENT_TO_ALL =

  • NEW_OBJECT_ID =

TABLES

packing_list = objpack

object_header = objhead

contents_bin = html_tab

contents_txt = objtxt

  • CONTENTS_HEX =

  • 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

Reward points if ur problem is solved and close the thread

Message was edited by: chandrasekhar jagarlamudi

Read only

suresh_datti
Active Contributor
0 Likes
1,961

Hi Padmini,

Unfortunately, the parameters are not provided in the function module 'SO_NEW_DOCUMENT_SEND_API1' . You will have to change your program and replace the function call with 'SO_DOCUMENT_SEND_API1' and use the SENDER_ADDRESS & SENDER_ADDRESS_TYPE parameters as suggested above. Both the function modules were released by SAP at the same time and don't know the reason for dropping those parameters in one of them.

Regards,

Suresh Datti

Read only

0 Likes
1,961

Hi.

First populate the Receiver ID's.

  • eMail Id of the Selected Employee

IF not P_RECV is initial.

reclist-receiver = p_recv.

reclist-rec_type = 'U'.

APPEND reclist.

CLEAR reclist.

endif.

  • Individual Email ID's

LOOP AT s_mail.

reclist-receiver = s_mail-low .

reclist-rec_type = 'U'.

APPEND reclist.

CLEAR reclist.

ENDLOOP.

sort reclist by receiver.

delete adjacent duplicates from reclist comparing receiver.

Then use the FM you have used.

data: lv_pernr type pa0105-pernr.

DATA: v_send_address LIKE soextreci1-receiver. "Sender add

DATA: lv_reclist like reclist occurs 0 with header line.

lv_reclist[] = reclist[].

  • Get Email of Current User {

select pernr from pa0105

into lv_pernr

where subty = '0001'

and usrid = sy-uname

and endda ge sy-datum

and begda le sy-datum.

endselect.

if sy-subrc = 0.

select usrid_long from pa0105

into v_send_address

where pernr = lv_pernr

and subty = '0010'

and endda ge sy-datum

and begda le sy-datum.

endselect.

endif.

  • } Get Email of Current User

CALL FUNCTION 'SO_DOCUMENT_SEND_API1'

EXPORTING

document_data = doc_chng

put_in_outbox = 'X'

sender_address = v_send_address

sender_address_type = 'SMTP'

TABLES

packing_list = objpack

object_header = objhead

contents_bin = objbin

contents_txt = obj_head

  • CONTENTS_HEX =

  • 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 i000(zz) WITH 'Error while sending the e-Mail'(023).

Leave to screen 1000.

ELSE.

MESSAGE s000(zz) WITH 'e-Mail sent successfully'(024).

ENDIF.

reclist[] = lv_reclist[].

refresh: lv_Reclist.

Guess this should work.

Thanks and regards,

Maheshwari.V

Read only

Former Member
0 Likes
1,962

Hi,

use FM

SO_DOCUMENT_SEND_API1

For code refer to Function Module documentation.

Hope it helps...

Lokesh