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

Replace an adress mail by a variable

MusAbaper
Active Participant
0 Likes
770

Hi everybody,

Can someone tel me a module function who can help me to find an address mail from user-name. because i want to pass them to the parameters ORIGINATOR.

this is the MF who i'm using it.

P.S : I want to replace 'Prenom.Nom@Entreprise.Com' with a variable who contient the adress mail of the user.

CALL FUNCTION 'SO_OBJECT_SEND'

EXPORTING

OBJECT_HD_CHANGE = object_hd_change

OBJECT_TYPE = 'RAW'

OUTBOX_FLAG = 'X'

OWNER = w_exped

ORIGINATOR = 'Prenom.Nom@Entreprise.Com'

ORIGINATOR_TYPE = 'U'

TABLES

objcont = objcont

objhead = objhead

receivers = receivers

EXCEPTIONS

ACTIVE_USER_NOT_EXIST = 1

COMMUNICATION_FAILURE = 2

COMPONENT_NOT_AVAILABLE = 3

FOLDER_NOT_EXIST = 4

FOLDER_NO_AUTHORIZATION = 5

FORWARDER_NOT_EXIST = 6

NOTE_NOT_EXIST = 7

OBJECT_NOT_EXIST = 8

OBJECT_NOT_SENT = 9

OBJECT_NO_AUTHORIZATION = 10

OBJECT_TYPE_NOT_EXIST = 11

OPERATION_NO_AUTHORIZATION = 12

OWNER_NOT_EXIST = 13

PARAMETER_ERROR = 14

SUBSTITUTE_NOT_ACTIVE = 15

SUBSTITUTE_NOT_DEFINED = 16

SYSTEM_FAILURE = 17

TOO_MUCH_RECEIVERS = 18

USER_NOT_EXIST = 19

ORIGINATOR_NOT_EXIST = 20

X_ERROR = 21

OTHERS = 22

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

thanks a lot

Best regards

5 REPLIES 5
Read only

Former Member
0 Likes
710

Read the table : ADR6

awrd points if useful

Bhupal

Read only

0 Likes
710

Try this:

FORM GET_EMAIL_FROM_USER USING LASTUSER LIKE USR01-BNAME

EMAIL_ADDRESS.

DATA : L_ADD LIKE ADDR3_VAL.

CLEAR EMAIL_ADDRESS.

call function 'SUSR_USER_ADDRESS_READ'

exporting

USER_NAME = LASTUSER

  • READ_DB_DIRECTLY = ' '

IMPORTING

USER_ADDRESS = l_add

  • USER_USR03 =

EXCEPTIONS

USER_ADDRESS_NOT_FOUND = 1

OTHERS = 2.

SELECT SMTP_ADDR INTO EMAIL_ADDRESS UP TO 1 ROWS

FROM ADR6

WHERE ADDRNUMBER = L_ADD-ADDRNUMBER AND

PERSNUMBER = L_ADD-PERSNUMBER.

endselect.

ENDFORM.

Read only

0 Likes
710

Hi,

Since I am a beginner, please can you tel me how can i call this form ?

this is my simple report

PARAMETERS : p_user LIKE usr01-bname DEFAULT 'MOUHAMOU'.

START-OF-SELECTION.

PERFORM get_email_from_user USING p_user

XXXXXX .

************************************************************************

  • FORM get_email_from_user *

************************************************************************

FORM get_email_from_user USING lastuser LIKE usr01-bname

email_address.

DATA : l_add LIKE addr3_val.

CLEAR email_address.

CALL FUNCTION 'SUSR_USER_ADDRESS_READ'

EXPORTING

user_name = lastuser

  • read_db_directly = ' '

IMPORTING

user_address = l_add

  • USER_USR03 =

EXCEPTIONS

user_address_not_found = 1

OTHERS = 2.

SELECT smtp_addr

INTO email_address UP TO 1 ROWS

FROM adr6

WHERE addrnumber = l_add-addrnumber

AND persnumber = l_add-persnumber.

ENDSELECT.

ENDFORM.

Regards

Read only

Former Member
0 Likes
710

Read the table : ADR6

awrd points if useful

Bhupal

Read only

0 Likes
710

Thank you verry much.

ur answer is verry halpful.

Mustapha