Sei sulla pagina 1di 10

How-to Guide

SAP NetWeaver 2004s

How To…
Trigger an
ALERT from a
Process Chain
Version 1.05 – May 2006

Applicable Releases:
SAP NetWeaver 2004s
(BI & Web Application Server Capability)
© Copyright 2006 SAP AG. All rights reserved. contained in this document serves informational
purposes only. National product specifications may vary.
No part of this publication may be reproduced or
transmitted in any form or for any purpose without the These materials are subject to change without notice.
express permission of SAP AG. The information These materials are provided by SAP AG and its affiliated
contained herein may be changed without prior notice. companies ("SAP Group") for informational purposes
only, without representation or warranty of any
Some software products marketed by SAP AG and its kind, and SAP Group shall not be liable for errors or
distributors contain proprietary software components of omissions with respect to the materials. The only
other software vendors. warranties for SAP Group products and services are those
that are set forth in the express warranty statements
Microsoft, Windows, Outlook, and PowerPoint are accompanying such products and services, if any.
registered trademarks of Microsoft Corporation. Nothing herein should be construed as constituting an
additional warranty.
IBM, DB2, DB2 Universal Database, OS/2, Parallel
Sysplex, MVS/ESA, AIX, S/390, AS/400, OS/390, OS/400, These materials are provided “as is” without a warranty
iSeries, pSeries, xSeries, zSeries, z/OS, AFP, Intelligent of any kind, either express or implied, including but not
Miner, WebSphere, Netfinity, Tivoli, and Informix are limited to, the implied warranties of merchantability,
trademarks or registered trademarks of IBM Corporation fitness for a particular purpose, or non-infringement.
in the United States and/or other countries. SAP shall not be liable for damages of any kind including
without limitation direct, special, indirect, or
Oracle is a registered trademark of Oracle Corporation. consequential damages that may result from the use of
these materials.
UNIX, X/Open, OSF/1, and Motif are registered SAP does not warrant the accuracy or completeness of
trademarks of the Open Group. the information, text, graphics, links or other items
contained within these materials. SAP has no control
Citrix, ICA, Program Neighborhood, MetaFrame, over the information that you may access through the
WinFrame, VideoFrame, and MultiWin are trademarks use of hot links contained in these materials and does not
or registered trademarks of Citrix Systems, Inc. endorse your use of third party web pages nor provide
any warranty whatsoever relating to third party web
HTML, XML, XHTML and W3C are trademarks or pages.
®
registered trademarks of W3C , World Wide Web SAP NetWeaver “How-to” Guides are intended to
Consortium, Massachusetts Institute of Technology. simplify the product implementation. While specific
product features and procedures typically are explained
Java is a registered trademark of Sun Microsystems, Inc. in a practical business context, it is not implied that those
features and procedures are the only approach in solving
JavaScript is a registered trademark of Sun Microsystems, a specific business problem using SAP NetWeaver. Should
Inc., used under license for technology invented and you wish to receive additional information, clarification
implemented by Netscape. or support, please refer to SAP Consulting.
Any software coding and/or code lines / strings (“Code”)
MaxDB is a trademark of MySQL AB, Sweden. included in this documentation are only examples and
are not intended to be used in a productive system
SAP, R/3, mySAP, mySAP.com, xApps, xApp, and other environment. The Code is only intended better explain
SAP products and services mentioned herein as well as and visualize the syntax and phrasing rules of certain
their respective logos are trademarks or registered coding. SAP does not warrant the correctness and
trademarks of SAP AG in Germany and in several other completeness of the Code given herein, and SAP shall
countries all over the world. All other product and not be liable for errors or damages caused by the usage of
service names mentioned are the trademarks of their the Code, except if such damages were caused by SAP
respective companies. Data intentionally or grossly negligent.
1 Business Scenario
Alert Management (ALM) comes into play, when business-critical problems occur. Within
ALM, conditions for critical situations are pre-defined. When an alert is triggered in ALM
that meets these conditions, responsible or interested parties are determined and
informed immediately.

Examples for business-critical problems could be the dropping of revenue for a particular
customer under a certain threshold or a critical amount of stock for a certain stock part.
On the other hand, technical problems in the BI system could also be significant enough
to alert a responsible person immediately.

NOTE Starting with the release SAP NetWeaver 2004s, a feature has been
introduced to trigger an Alert in case of an erroneous process chain.
You find this functionality in the ‘Process Chain’ menu (Æ Attributes Æ
Alerting). For further information on the topic, please refer to the Release Notes
or online documentation of SAP NetWeaver 2004s.

2 Introduction
The Alert Framework is provided as part of the SAP Web Application Server, starting
with the release 6.20. The application that wants to trigger alerts must define its own
alert categories and implement the triggering of the alert. For more information on the
basic settings for the Alert Framework, please consult the online documentation for SAP
NetWeaver.

Currently, alerts in BI can be triggered as a follow-on action for an exception in the


Reporting Agent. For further information about the creation of alerts via the Reporting
Agent, please refer to the online documentation or to the HowTo paper.

For problems arising in the administrative area of the BI system, like extraction,
staging, etc., there is currently no standard functionality to trigger an alert. Within
the process chain maintenance, you can initiate a mail as the result of a process
type. Yet a mail has only notification character, opposed to an alert, which should
only be triggered if immediate action is required.

This paper describes how you can incorporate an existing alert category in a
process chain. The alert can be triggered based on the result of a predecessor
process type (i.e. successful, not successful, in any case) and is implemented as
a customer-defined process type. The process type does not effect the further
processing of the remaining process chain.

Disclaimer: The custom-defined process type described in this paper is only one way to
implement the triggering of an alert. We do not guarantee the correctness of the ABAP coding or
stability of the solution in future releases.

-1-
3 The Step By Step Solution
First, create an appropriate Alert Category. Next implement a custom-defined process
type. For additional information about this topic, please consult the online documentation
or the HowTo paper “HowTo... Implement custom process types” in the SAP Developer
Network (SDN). The selection of the alert category for the process type and the
triggering of the alert during run time has been realized by different implementation of
some of the methods. In the following steps, only these methods and their contents is
described. The methods GET_HEADER, WILDCARD_ENABLED, EXISTS,
GIVE_CHAIN remain unchanged.

3.1 Defining an Alert Category

For detailed information on the definition of an Alert Category please refer to the online
documentation for the Alert Management. We just stress some of the settings of the Alert
Category used in the scenario.

1. In the container, you can define


elements that can be filled
dynamically on the triggering of the
Alert. We named our only container
element ZTEXT, which is a 255
character field.
Multiple container elements can be
defined.

-2-
2. The container elements can be used
in the text of the alert as variables. In
addition to the container elements,
you can also incorporate system
variables in the texts of an alert.
To pick a variable, press the
button.

3.2 Implementing the Class for the custom-defined process type

1. In order to choose an existing alert method IF_RSPC_GET_VARIANT~GET_VARIANT.


category on the insertion of the
process type, the GET_VARIANT data: l_t_alerts type standard table of
DDSHRETVAL,
method calls a F4 value help on the l_s_alerts type DDSHRETVAL.
existing alert categories. The alert
picked, is stored in the variant of the
process type. * ...Choose an existing ALERT
CALL FUNCTION 'F4TOOL_CHECKTABLE_HELP'
EXPORTING
CHECKTABLE = 'SALRTCAT'
RETFIELD = 'CATEGORY'
WINDOW_TITLE = 'Select Alert'
TABLES
RETURN_TAB = l_t_alerts.

* ... Store variant information


read table l_t_alerts into l_s_alerts
index 1.
e_variant = l_s_alerts-fieldval.
concatenate 'Trigger Alert:' l_s_alerts-fieldval
into e_variant_text.

endmethod.

-3-
2. If the user wants to define his own method IF_RSPC_MAINTAIN~MAINTAIN.
alert category, he can do so either data: l_alert_name TYPE RSPC_VARIANT.
on the insertion of the process type * ... Call ALERT Category maintenance
Call transaction 'ALRTCATDEF'.
or by maintaining the variant within If i_variant is initial.
an existing process chain. The * ... Since no return value, pick one from the list
functionality is provide on the create IF_RSPC_GET_VARIANT~GET_VARIANT( importing
e_variant = e_variant
button ( ) on the Process Variant e_variant_text = e_variant_text ).
maintenance pop-up. else.
The coding is provided in the e_variant = i_variant.
method MAINTAIN. concatenate ‘Trigger alert:‘ i_variant
into e_variant_text.
endif.
endmethod.
3. The 2 previous steps are needed to method IF_RSPC_EXECUTE~EXECUTE.
maintain the process type during the data: l_unique_id TYPE sysuuid_25,
design time of the process chain. L_S_alert type swcont,
l_t_alert type table of swcont,
During the run time of the process l_s_recipients type SALRTSRCP,
chain, the EXECUTE method is l_t_recipients type table of salrtsrcp,
performing the actual action of the l_s_processlist type RSPC_S_PROCESSLIST.
process type, i.e. the triggering of * ... Get Instance
CALL FUNCTION 'RSSM_UNIQUE_ID'
the alert. IMPORTING
The following activities are e_uni_idc25 = l_unique_id.
performed: e_instance = l_unique_id.

- The Alert Category is named * ... Declaration of the alert-container


* Fill container element ZTEXT
‘ZALERT’ READ TABLE I_T_PROCESSLIST into l_S_PROCESSLIST
index 1.
-The Alert Category has a l_s_alert-element = 'ZTEXT'. "<mycontainer-elem>
Container Element named ‘ZTEXT’, CONCATENATE 'The process chain '
l_s_processlist-CHAIN_ID
which is filled with a text that ' was errorneous. Please check'
contains the process chain ID into l_s_alert-value.
APPEND l_s_alert TO l_t_alert.
- As additional recipient (besides IF l_t_alert IS NOT INITIAL.
the fixed recipients specified in the * ... Build container via macros
CALL FUNCTION 'RSRAS_BUILD_CAM_CONTAINER'
Alert Category and the user that TABLES
have subscribed to the alert) the c_t_swcont = l_t_alert.
user ‘ALERT_REC’ will receive the ENDIF.
alert with a specific message * ... Add some additional recipients
* ... Could be any message or none
attached. l_s_recipients-UNAME = 'ALERT_REC'.
l_s_recipients-MSGID = 'RSM1'.
l_s_recipients-MSGNO = '799'.
l_s_recipients-MSGV1 = 'Process Chain Error'.
append l_s_recipients to l_t_recipients.

* ... Trigger ALERT


call function 'SALRT_CREATE_API'
EXPORTING
ip_category = i_variant
TABLES
it_container = l_t_alert
IT_RECIPIENTS = L_T_Recipients.
if sy-subrc ne 0.
e_state = 'R'. “Indicate erroneous
else.
e_state = 'G'. “Indicate succesful
endif.
endmethod.

-4-
3.3 Using the new process type in a process chain

After the newly created process type has been entered in the process chain maintenance
(Menu Settings Æ Maintain Process types), it can be used in a process chain. We have
specified the Alert Icon ( ) as icon for the process type, and have assigned to
the process types of the group ‘General Services’.

1. Create a new process chain with the


desired scheduling (start process)
and the administrative activities that
you want to perform. For the
scenario, we assume the loading of
transaction data.

2. Select the process type that you


have implemented for the triggering
of the alert.

-5-
3. Choose an Alert Category or define
a new one.

4. Connect the new process type with


other process types to trigger an
alert depending on the outcome of
the respective process type.
We have chosen to trigger an
ALERT on failure of the loading
process to indicate that further
processing of the data is not
possible, and the loading process
has to be checked.

5. Activate your process chain.

-6-
3.4 Checking the ALERT Inbox for new alerts

After the Process Chain has been executed, and an error occurred in the loading process,
an alert is triggered. The recipients of the alert (in our case the user ‘ALERT_REC’) can
check his Alert Inbox for new alerts. The Alert Inbox is only one channel to receive
alerts. The user can also define alternative channels, like SMS, Mail, etc.

1. We are describing the simplest way


to check a user’s Alert Inbox via a
report executed in the transaction
code SE38. More comfortable ways
could be the integration of the Alert
Inbox in a Web Application or Portal.
For the execution of the report call
transaction code SE38.
Enter the report RSALERTINBOX,
and execute the report.

2. The Alert Inbox is shown as a BSP


Application. The alerts received by
the user via this channel are
displayed.
The screen shot shows the Alert
Inbox with one Alert triggered by the
process chain AK_ALERT1 (the
process chain ID has been passed
via the container, and has been
included in the description of the
Alert Category).

4 Appendix
Further helpful reports for the implementation and testing of alerts are:

• RSALERTPROC - Delivering alerts


• RSALERTDISP - Displaying alerts
• RSALERTINBOX - Calling alert inbox as BSP
• RSALERTPERSONALIZE - Calling personalization settings for alert delivery as BSP
• RSALERTSUBSCRIBE - Calling subscription to alert categories as BSP

-7-
www.sdn.sap.com/irj/sdn/howtoguides

Potrebbero piacerti anche