Posted: Sun Dec 16, 2007 1:05 am Post subject: Sending SMS notification via business workflow
Author: Ronen Fox
Requirement: send an sms message for PM notification of a certain priority to a group of recipients.
Background: A technical team maintains equipment in fueling stations. Each malfunction is reported via the PM notification in R3. Certain malfunctions are of very high priority and must reach the attention of a group of employees apart from the actual technicians that handle the problem.
Solution: Use Sap business workflow to send SMS messages to recipients.
The first question that comes to mind is why use WF and not the alert framework in order to send out the messages. That was the initial thought in the project but we encountered many problems in the alert framework especially when handling long text with many variables - a strong demand from the customer.
WF is perhaps a bit more demanding to set up, but is far more flexible and easier to change.
The WF built is as follows:
1. Triggering event is BUS2080.Created a WF start condition takes care of the task to start the WF only for the relevant notifications, according to their priority.
2. A background step reads the long text of the notification using a custom method based on the 'read_text' function module
3. A responsibility rule based on the notification priority is created. Different responsibilities are created for each priority, linked to employee records.
A background step based on 'RH_GET_ACTORS' function module reads the rule and stores the result in a multiline container element based on WFSYST-AGENT
4. A background step reads the employee cell number from infotype 105 in the employee master data. (This can also be utilized via attributes in the business object of the employee) We did this in a method that uses multiline parameters in order to be able and retrieve many cell numbers at once.
5. The SMS message is composed and sent in another background step based on a custom function module that is wrapped around the 'SO_DOCUMENT_SEND_API1' function module.
6. Messages are delivered to the outgoing message queue (Transaction SOST) and delivered via a periodical job.
This WF is completely handled in background, e.g. there is no user intervention and no one gets a work item in their inbox. However, the WF mechanism enabled us to deliver a flexible solution with a minimum effort and very little code writing. The only maintenance to be done is to maintain the assignment of persons to the responsibilities and the different notification priorities in the WF start conditions.
Using the WF capabilities we managed to compose complex texts for the messages and include many variables in them.
Samples of code for the function modules mentioned above
Read notification long text
BEGIN_METHOD READ_TEXT CHANGING CONTAINER.
data lines type tline occurs 0 with header line.
*data header type thead occurs 0 with header lines.
data name like THEAD-TDNAME.
move OBJECT-KEY to name.
CALL FUNCTION 'READ_TEXT'
CLIENT = SY-MANDT
ID = 'LTXT'
LANGUAGE = SY-LANGU
NAME = name
OBJECT = 'QMEL'
ARCHIVE_HANDLE = 0
LOCAL_CAT = SPACE
* HEADER = HEADER
LINES = LINES
ID = 01
LANGUAGE = 02
NAME = 03
NOT_FOUND = 04
OBJECT = 05
REFERENCE_CHECK = 06
WRONG_ACCESS_TO_ARCHIVE = 07
OTHERS = 08.
WHEN 0. " OK
WHEN 01. " to be implemented
WHEN 02. " to be implemented
WHEN 03. " to be implemented
WHEN 04. " to be implemented
WHEN 05. " to be implemented
WHEN OTHERS. " to be implemented
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.