Control Sender Address when Sending PO

Content Author: Kevin

PO by e-mail: how to control sender address
My PO's are now being send by e-mail. Unfortuntely, it seems impossible to control the sender of the e-mail; When the timing is on '4', the sender will be the employee who did the final release, when on '1', the sender will be the user who schedules the RSNASTOO job.  I want the user who created the PO to be the sender of the PO.

The following may help you solve your problem. 

I am using the following in my PO Sapscript 

/: DEFINE &W_USER_EMAIL& = ' ' 
/: PERFORM GET_USER_EMAIL IN PROGRAM ZVENDOR_FAX_EMAIL 
/: USING &EKKO-ERNAM& 
/: CHANGING &W_USER_EMAIL& 
/: ENDPERFORM 
= ,,,,<h> &'Created by: 'W_USER_EMAIL&</> 

and the following in PROGRAM ZVENDOR_FAX_EMAIL 

FORM GET_USER_EMAIL TABLES IN_TAB STRUCTURE ITCSY 
out_tab structure itcsy. 

data: L_user like USR21-BNAME. 
data: L_persno like usr21-persnumber. 
data: L_user_email like ADR6-SMTP_ADDR. 

* gets User name 
READ TABLE IN_TAB WITH KEY 'EKKO-ERNAM'. 
IF SY-SUBRC EQ 0. 
CLEAR: L_USER, L_USER_EMAIL, L_persno. 
L_user = IN_TAB-value. 

* read user master 
Select single PERSNUMBER from usr21 into L_persno 
where bname EQ L_user. 
*e-mail found 
if sy-subrc eq 0 and L_persno ne space. 
select smtp_addr from adr6 into L_user_email 
up to 1 rows 
where persnumber eq L_persno 
and date_from le sy-datum. 
endselect. 
if sy-subrc eq 0 and L_user_email ne space. 

read table out_tab with key 'W_USER_EMAIL'. 
if sy-subrc eq 0. 
move L_user_email to out_tab-value. 
modify out_tab index sy-tabix. 
endif. 
endif. 
endif. 
endif. 
endform. "GET_USER_EMAIL 

See also
PO Terminated When Display Delivery Address

Get help for your SAP MM problems
SAP MM Forums - Do you have a SAP MM Question?

SAP MM Books
SAP Material Management Certification, Interview and Configuration Reference Books

SAP Material Management Tips
SAP MM Configuration Tips and Materials Management Discussion Forum

Main Index
SAP ERP Modules, Basis, ABAP and Other IMG Stuff

All the site contents are Copyright © www.erpgreat.com and the content authors. All rights reserved.
All product names are trademarks of their respective companies.  The site www.erpgreat.com is in no way affiliated with SAP AG. 
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk. 
 The content on this site may not be reproduced or redistributed without the express written permission of 
www.erpgreat.com or the content authors.