Show TOC Start of Content Area

Procedure documentation Updating Notification Processing Time and Status  Locate the document in its SAP Library structure

Use

You can update existing process notification instances at runtime by changing their processing time and status.

The processing time is represented by a deadline, which can be an exact date set in time, or duration related to some starting point (action or process start). For more information, see Creating Deadlines and Durations.

Prerequisites

      You have set up your project in SAP NetWeaver Developer Studio.

For more information, see Setting Up Your Project.

      You know how to create deadlines and durations.

For more information, see Creating Deadlines and Durations.

Procedure

...

       1.      Retrieve a notification instance defined for a process:

Example

import com.sap.caf.eu.gp.process.rt.notification.api.IGPNotificationInstance;

import java.util.Enumeration;

 

// get all notification instances of a process

Enumeration notifications = process.getNotificationInstanceEnumeration();

 

// retrieve a single notification instance

IGPNotificationInstance notification = null;

while (notifications.hasMoreElements()) {

   notification = (IGPNotificationInstance) notifications.nextElement();

}

For more information, see Retrieving Process Notification Instances.

       2.      Retrieve relevant information about the instance.

Depending on the update operation you want to perform, you may need to know certain notification instance attributes in advance, for example, notification ID, process ID, whether it is a due date notification, and so on.

Example

import com.sap.caf.eu.gp.process.api.IGPDeadline;

 

//get relevant attribute information, for example:

String processInstanceID = notification.getProcessInstanceID();

String notifID = notification.getNotificationID();

boolean dueDate = notification.isDueDateNotification();

long createDate = notification.getCreationDate();

IGPDeadline deadline = notification.getDeadline();

...

 

       3.      Change the status of the notification instance.

Caution

You are able to change the status of a notification instance only if it is not processed yet, that is, its status is set to NOTIFICATION_STATUS_WAITING. If the notification has been already executed or cancelled, this change is impossible.

You can choose from the following notification statuses:

       NOTIFICATION_STATUS_DEPRECATED notification is deprecated, a more up-to-date version exists

       NOTIFICATION_STATUS_EXECUTED – notification is executed

       NOTIFICATION_STATUS_CANCELLEDthe activity was completed before the time of notification processing

       NOTIFICATION_STATUS_ERRORan  error occurred during the processing of the notification

Example

// update the status – cancel the notification

notifManager.updateNotificationStatus(

                        processInstanceID,

                        activityID,

                        notifID,

                        IGPNotificationInstance.NOTIFICATION_STATUS_CANCELLED

                       );

       4.      Update the processing time of the notification instance.

This operation automatically creates a new version of the notification. The status of the old version is set to deprecated (NOTIFICATION_STATUS_DEPRECATED). Both versions are stored in the notification history.

Example

import com.sap.caf.eu.gp.process.rt.api.IGPNotificationManager;

 

// update the notification instance with a new deadline

notifManager.updateNotification(

                                processInstanceID,

                                activityID,

                                notifID,

                                deadline

                               );

 

End of Content Area