‎2009 Jun 19 7:24 AM
hello experts ,
i have a program which can send mails to other user but it by default takes my used id as sender's mail id . This program is working fine , but is there any way possible to hide my sender's mail id and show some other mail id in sender to the recipients?
thanks in advance
‎2009 Jun 19 7:27 AM
Hi,
Please try this code:
gs_reclist-rec_date = sy-datum.
gs_reclist-rec_type = 'U' . " For Internet Address
gs_reclist-com_type = 'INT'.
gs_reclist-notif_ndel = c_x.
gs_reclist-receiver = p_email. "Email addr of Recip <------ Parameter on your screen/ Create a range and pass it...
APPEND gs_reclist TO gt_reclist.
CLEAR gs_reclist.
Are you sending some attachemnet also.. I mean are you using the FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' to send email
‎2009 Jun 19 7:27 AM
Hi,
Please try this code:
gs_reclist-rec_date = sy-datum.
gs_reclist-rec_type = 'U' . " For Internet Address
gs_reclist-com_type = 'INT'.
gs_reclist-notif_ndel = c_x.
gs_reclist-receiver = p_email. "Email addr of Recip <------ Parameter on your screen/ Create a range and pass it...
APPEND gs_reclist TO gt_reclist.
CLEAR gs_reclist.
Are you sending some attachemnet also.. I mean are you using the FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' to send email
‎2009 Jun 19 7:27 AM
Hi,
Incase you want email id of other users then you will get it from table ADR6.
Join ADR6 and USR21 on BNAME and you can get the email address from the field SMTP ADDR.
Regards,
Ankur Parab
‎2009 Jun 19 7:29 AM
‎2009 Jun 19 7:45 AM
Hi vivek,
I guess this default is based on how it is maintained in TCODE SU01. In SU01 give your user id and if you change your First name and Last name, this will be used as the senders' id
Regards
‎2009 Jun 19 8:29 AM
Hello,
Either change it in SU01 or use this code to temporarily change it
These are the parameters
P_FNAME TYPE AD_NAMEFIR " first name
P_LNAME TYPE AD_NAMEFIR " surname
PX_NAME TYPE XFLAG " name will only be changed if this flag is set
P_FROM TYPE AD_SMTPADR " sender email id
PX_FROM TYPE XFLAG " sender email id will only be changed if this flag is set
* populate sender name if specified
data: lv_persnumber type AD_PERSNUM.
data: lv_ADDRNUMBER type AD_ADDRNUM.
data: lv_oldemail type AD_SMTPADR.
data: lv_oldfname type AD_NAMEFIR.
data: lv_oldlname type AD_NAMELAS.
data: lv_oldfullname type AD_NAMTEXT.
data: lv_newfullname type AD_NAMTEXT.
if px_from = 'X' or px_name = 'X'.
select single PERSNUMBER ADDRNUMBER from usr21
into (lv_persnumber, lv_addrnumber)
where bname = sy-uname.
if px_from = 'X'.
select single SMTP_ADDR from adr6
into lv_oldemail
where ADDRNUMBER = lv_ADDRNUMBER
and PERSNUMBER = lv_PERSNUMBER.
update adr6
set SMTP_ADDR = p_from
where ADDRNUMBER = lv_ADDRNUMBER
and PERSNUMBER = lv_PERSNUMBER.
endif.
if PX_NAME = 'X'.
concatenate p_fname p_lname into lv_newfullname
separated by space.
select single NAME_FIRST NAME_LAST NAME_TEXT from adrp
into (lv_oldfname, lv_oldlname, lv_oldfullname)
where PERSNUMBER = lv_PERSNUMBER.
update adrp
set name_first = p_fname
name_last = p_lname
NAME_TEXT = lv_newfullname
where PERSNUMBER = lv_PERSNUMBER.
endif.
commit work.
endif.
after calling your FM, don't forget to change it back
* reset email id and name back to old value if set earlier
if px_from = 'X'.
update adr6
set SMTP_ADDR = lv_oldemail
where ADDRNUMBER = lv_ADDRNUMBER
and PERSNUMBER = lv_PERSNUMBER.
endif.
if PX_NAME = 'X'.
update adrp
set name_first = lv_oldfname
name_last = lv_oldlname
NAME_TEXT = lv_oldfullname
where PERSNUMBER = lv_PERSNUMBER.
endif.
if sy-subrc = 0 and ( px_from = 'X' or px_name = 'X' ).
commit work.
endif.
Edited by: Kris Donald on Jun 19, 2009 1:02 PM
‎2016 Jun 08 6:53 AM
‎2009 Jun 19 8:39 AM
Create an SAP user (let's say "ZMAILUSER") in SU01 and assign any internet mail address.
Now set sender_address as the sap user name and sender address_type = "B". It will send the mail from the internet mail address defined for the user.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_DATA = LW_DOC
SENDER_ADDRESS = 'ZMAILUSER'
SENDER_ADDRESS_TYPE = 'B'
COMMIT_WORK = 'X'
Hope this will work.
‎2009 Jun 19 9:46 AM
Hi vivek
Try this code:-
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_DATA = DOC_CHNG
PUT_IN_OUTBOX = 'X'
SENDER_ADDRESS = 'zmail' "SU01 User id- e-mail id not userid.
SENDER_ADDRESS_TYPE = 'INT' " Pass address type INT
COMMIT_WORK = 'X'
TABLES
PACKING_LIST = T_PACKING_LIST[]
CONTENTS_TXT = OBJCONT[]
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.Thanks & regards
Rahul