Application Development 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: 

Hardcode Sender Name in E-Mail

Former Member
0 Kudos

Hi Experts,

I am using FM SO_DOCUMENT_SEND_API1 for sending attachments.

I have a requirnment to hardcode a sender name (For Ex: FunTeam ) in the e-mail.

I couldnt able use in sender_address parameter of the function module.

I can also use CL_BCS to send attachment if there is a way to hardcode the sender name.

Please advice me on this issue.

Thanks in advance.

Regards,

Chandru

1 ACCEPTED SOLUTION

murat_kaya
Participant
0 Kudos

Hi Chandru,

if you use CL_BCS, you may define a variable like

DATA: l_sender TYPE ad_smtpadr.

then give a hardcoded address to l_sender and use the methods

CALL METHOD send_request->set_document( document ).

sender = cl_cam_address_bcs=>create_internet_address( l_sender ).

CALL METHOD send_request->set_sender

EXPORTING

i_sender = sender.

recipient = cl_cam_address_bcs=>create_internet_address(

p_email ).

this should work fine.

regards,

Murat Kaya

7 REPLIES 7

murat_kaya
Participant
0 Kudos

Hi Chandru,

if you use CL_BCS, you may define a variable like

DATA: l_sender TYPE ad_smtpadr.

then give a hardcoded address to l_sender and use the methods

CALL METHOD send_request->set_document( document ).

sender = cl_cam_address_bcs=>create_internet_address( l_sender ).

CALL METHOD send_request->set_sender

EXPORTING

i_sender = sender.

recipient = cl_cam_address_bcs=>create_internet_address(

p_email ).

this should work fine.

regards,

Murat Kaya

0 Kudos

Hi Murat Kaya,

Thanks for replying me.

By your logic we can get the hardcode value like this FUNTEAM@--.-- (Mail ID)not FUNTEAM.

And we can use

CALL METHOD cl_cam_address_bcs=>create_internet_address

EXPORTING

i_address_string = 'FUNTEAM@--.--' "mail ID

i_address_name = 'FUNTEAM'

  • i_incl_sapuser =

receiving

RESULT = sender

.

To get FUNTEAM in senders name but i have a problem here ie The sender name is coming as

FUNTEAM[FUNTEAM@--.--] . Here i dont want the mail id to displayed in the bracket.

Please advice on this.

Thanks and Regards,

Chandru

0 Kudos

Hi Chandru,

when you manage to populate the sender e-mail address, you can do the rest outside the code. when you use outlook express or any program like outlook and when you send any mail, it automatically shows your name from your e-mail. in your case if you manage to create an account for the mail address funteam@...., using my code you can send mail with only name in the senders field. you may try this.

regards,

Murat Kaya

0 Kudos

Hi Murat Kaya,

Creating an account means creating an user in SU01?

If you are reffering to this user creation i tried with WF-BATCH user but still i am getting the Email ID in [ ] after the name maintained for WF-BATCH user.

Can you guide me if there is any settings to be made for not displaying Email in sender address.

Thanks and Regards,

Chandru

Edited by: Chandru Elangovan on Mar 9, 2009 7:50 AM

Edited by: Chandru Elangovan on Mar 9, 2009 7:50 AM

0 Kudos

Hi Chandru,

i didn't mean any sap related account creation. as you create account in any mail service (microsoft exchange, gmail, hotmail, etc..) you send mail with your e-mail adress but receivers see your name because it gets the matching name for the e-mail address. this is just an idea that may solve your problem. if the company you are working creates a dummy exchange user with the e-mail address you want ( funteam@.... for your example) and give the name and surname parameters as you like, then when your program sends mail with funteam@... as sender address, the receivers see the name and surname for that particular address, this was my point.

regards,

Murat Kaya

0 Kudos

Thanks a lot Murat.

Thanks and Regards,

Chandru

Former Member
0 Kudos

Hi Chandu,

you can include anything when you are creating the document to be sent. like email sudject, email body etc

  • Creating the document to be sent

wa_doc_data-obj_name = text-043.

  • subject

wa_doc_data-obj_descr = p_subj.

i_contents-line = text-061.

APPEND i_contents.

i_contents-line = ' '.

APPEND i_contents.

i_contents-line = ' Email body content' . <----


APPEND i_contents.

DESCRIBE TABLE i_contents LINES v_tab_lines.

READ TABLE i_contents INDEX v_tab_lines.

IF sy-subrc EQ 0.

wa_doc_data-doc_size = ( v_tab_lines - 1 ) * 255 + STRLEN( i_contents ).

ENDIF.

  • Creating the entry for the compressed document

CLEAR i_packing_list-transf_bin.

i_packing_list-head_start = 1.

i_packing_list-head_num = 0.

i_packing_list-body_start = 1.

i_packing_list-body_num = v_tab_lines.

i_packing_list-doc_type = 'RAW'.

APPEND i_packing_list.

hope this helps