Twitter as a potential notification tool for SAP
Twitter is the latest buzzword these days when it comes to talking about social networking and Web 2.0. While there are articles on the web which say that Twitter is just a fad, here is an interesting approach to use it as a strong notification tool by integrating it with your Portfolio Management processes using SAP RPM and Collaboration Projects.
For those who would like to know what Twitter is all about, here is a definition of Twitter from Wikipedia –
“a free social networking and micro-blogging service that enables its users to send and read messages known as tweets. Tweets are text-based posts of up to 140 characters displayed on the author’s profile page and delivered to the author’s subscribers who are known as followers. Senders can restrict delivery to those in their circle of friends or, by default, allow open access. Users can send and receive tweets via the Twitter website, Short Message Service (SMS) or external applications.”
Being among one of the most popular and promising services for information broadcasting, Twitter can be accessed via several APIs and is completely free to use. Twitter is being used by several businesses for promoting their products and services.
Integrating your RPM and cProjects application with Twitter can help the stakeholders be in touch with the latest updates on their respective portfolios and buckets over the web. The application hence developed will allow sharing tiny pieces of information in form of SMS-like tweets. Stakeholders have option to setup SMS alerts over their phone as well. This is an alternative approach to enable notifications via e-mails in SAP.
Here are some of the examples of what can be tweeted to the stakeholders within the RPM Portfolio Hierarchy:
Since tweets are ‘broadcasted’ across the followers, it is a good approach to have separate twitters for each of the objects in hierarchy. Administrators can keep a check on the followers of these tweeting accounts to ensure that only selected group of people can follow these tweets. The accounts can be kept private so that the tweets do not appear in the public timeline.
The set-up requires writing a small ‘Tweet Dispatcher’ program that fetches data from CPRXRPM and makes use of Twitter API to update information as tweets. This program can be made to run at desired intervals. The extract logic for pulling out data from CPRXRPM can be written in remote enabled function modules. These function modules can be called via the dispatcher program.
Based on the architectural requirements, the dispatcher program can either be written in ABAP or in any other platform that can communicate with SAP via RFC calls.
Following are some simple steps to get this concept working. Since I am more familiar to Java, the Tweet Dispatcher program is written in Java using Twitter4J API and the SAP JCo Adapter. Here is a short walkthrough:
1. Import the relevant packages.
2. Create a connection to the CPRXRPM System and add function parameters. Perform data retrieval.
JCO.Repository mRepository = new JCO.Repository("Twitter",mConnection);
JCO.Function function = null;
IFunctionTemplate ft =
function = ft.getFunction();
JCO.Structure struct =
/* Insert your business logic of selecting the relevant bucket/portfolio
and update the Import Parameters */
The Function Module ‘/RPM/BUCKET_DISPLAY’ is used for retrieving the detail data of a bucket within a Portfolio. Custom FMs/BAPIs can be written and deployed here based on business requirements.
3. Execute the function and extract the export parameters. Prepare the output to be tweeted in the next step.
JCO.Structure returnStructure =
String tweet = "Bucket - "
+ " - Item count: "
+ " | Initiative Count: "
4. And now it’s the time to call up the Twitter API and tweet the retrieved results.
Twitter user= new Twitter(<<username>>, <<password>>);
/* Twitter login credentials */
/* if within a network proxy */
/* if within a network proxy */
Status BucketTweet =user.updateStatus(tweet);
Here is a screenshot of a sample tweet that was updated using this program. The approach is simple, does not consume much efforts and notifications will not clutter your mailboxes! Go ahead and give it a try!