2007 May 09 10:48 AM
Hi Gurus,
I have created a distribution list in SO15 containing a group of email Ids.Please suggest me how to process that distribution list so as to send mails to all the
IDs.
Also the mail should go their outlook mailbox and not the sapmail.
If possible please send me an example code.
Thanks in advance.
syed.
Hi Gurus,
I have created a distribution list in SO15 containing a group of email Ids.Please suggest me how to process that distribution list so as to send mails to all the
IDs.
Also the mail should go their outlook mailbox and not the sapmail.
If possible please send me an example code.
Thanks in advance.
syed.
2007 May 09 10:53 AM
You have to make sure you can allready mail from SBWP to external mailadresses or otherwise have your SAP BASIS team fix that first.
http://www.sap-img.com/fu016.htm
Message was edited by:
Bas Jansen
2007 May 09 10:55 AM
hi
good
First create your DLI using the so15 transaction.
Then read the DLI using an object independent method. I have created one
recently, I am enclosing the code below.
That method reads 2 types of addresses within the DLI, the SAP internal
addresses (to send to workplace inbox mails) and external SMTP addresses
(Type U in SAP). It also sends the number of emails found for each list, so
that you can get that in a WF container variable and make a test on it.
BEGIN_METHOD READDISTRIBUTIONLIST CHANGING CONTAINER.
DATA:
DLINAME LIKE SOOBJINFI1-OBJ_NAME,
DLIDATA LIKE SODLIDATI1,
agent1 like wfsyst-agent,
DLIENTRIES LIKE SODLIENTI1 OCCURS 0 with header line,
AGENTS LIKE WFSYST-AGENT OCCURS 0 with header line,
AgentsNumber like syst-tabix,
AgentsEmailNumber like syst-tabix,
AgentsEmailList like BAPIADDR3-E_MAIL occurs 0.
AgentsEmailNumber = 0.
AgentsNumber = 0.
SWC_GET_ELEMENT CONTAINER 'DliName' DLINAME.
IF SY-SUBRC <> 0.
MOVE SPACE TO DLINAME.
ENDIF.
CALL FUNCTION 'SO_DLI_READ_API1'
EXPORTING
SHARED_DLI = 'X'
DLI_ID = SPACE
DLI_NAME = DLINAME
IMPORTING
DLI_DATA = DLIDATA
TABLES
DLI_ENTRIES = DLIENTRIES
EXCEPTIONS
DLI_NOT_EXIST = 9001
OPERATION_NO_AUTHORIZATION = 9002
PARAMETER_ERROR = 9003
X_ERROR = 9004
OTHERS = 01.
CASE SY-SUBRC.
WHEN 0. " OK
WHEN 9001. " DLI_NOT_EXIST
EXIT_RETURN 9001 DLINAME Space space space.
WHEN 9002. " OPERATION_NO_AUTHORIZATION
EXIT_RETURN 9002 sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WHEN 9003. " PARAMETER_ERROR
EXIT_RETURN 9003 sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WHEN 9004. " X_ERROR
EXIT_RETURN 9003 sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
WHEN OTHERS. " to be implemented
ENDCASE.
clear agents. refresh agents.
clear AgentsEmailList. refresh AgentsEmailList.
loop at DLIENTRIES.
if dlientries-MEMBER_typ = ' '.
This is the a user
agent1(2) = 'US' .
agent1+2(12) = dlientries-MEMBER_NAM.
AgentsNumber = AgentsNumber + 1.
append agent1 to agents.
endif.
This is an email address -( SMTP external )
if dlientries-MEMBER_typ = 'A' or dlientries-MEMBER_typ = 'U'.
AgentsEmailNumber = AgentsEmailNumber + 1.
append dlientries-FULL_NAME to AgentsEmailList.
endif.
endloop.
SWC_SET_TABLE CONTAINER 'Agents' AGENTS.
swc_set_table container 'AgentsSAPMailList' AgentsEmailList.
swc_set_element container 'AgentsNumber' AgentsEmailNumber.
swc_set_element container 'AgentsSAPMailListNumber' AgentsNumber.
END_METHOD.
thanks
mrutyun^
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |