This is an example of using Visual Composer and a standard portal web service to report on portal activity. We will attempt to handle reporting in timezones other than GMT/UTC, which is all the standard portal activity report can display.
First we're going to make a web service client to invoke the web service.
Visual Administrator -> Server -> Services -> Web Services Security -> Security Configuration -> Web Service Clients -> sap.com -> DynamicWSProxies
Create a new service using Create...
Enter any name you want
Set Logon Data Authentication to BASIC and enter a Username and Password in the UME.
With newer versions of VC, you may need to use Tools -> Define Web Service System as an alternative. This can only be done after opening a model.
You can now start the VC storyboard.
Open a new model and add an iView. Use Find Data to select your System from the drop down list. In the Group, enter * as a wild card and start the Search.
We're going to use getDbTimestamp and getContentStat. getDbTimestamp returns the current date/time as a Java longword. We will use this to be end date for our selection. getContentStat reports on iView and page access within a date/time range.
The completed model looks like:
Looking at the main pieces...
The input is a form with a single button to start the process and the output is a form with the latest timestamp, a numeric field with the number of days to report on and two radio groups, one for the period to report (Hour, Day, Month or Quarter) and another for whether to report iView or Page hits.
We also prompt for the offset hours from GMT. The standard portal activity report displays GMT/UTC, but we might want to have dates and times more meaningful for the user.
By including the User data object in the model we can display the user's current timezone setting as a hint.
Now we can do the main work.
The input to getContentStat is
rad1 is the radio group which has the selection period, rad2 is the aggregation type From is calculated as @response_getDbTimestamp_1 - (@NumberOfDays * 3600 * 24 * 1000) and To is the high value from the selection screen.
The output form has:
With the fields set as:
Days (the number of days since 01-01-1970) computed as ((@TimeStampHour + (3600 * 1000 * #IDACAIU@GMTOffset)) / (24*3600*1000))
Hours (the number of hours in the day) computed as FLOOR(@TimeStampHour+ (3600 * 1000 * #IDACAIU@GMTOffset)-((FLOOR(@Days)*24*3600*1000)))/ (3600*1000)
Date1 (the date portion of the long date) computed as DADD("01-01-1970",@Days,"D")
t1 (the date/time displayed) computed as (LTRIM(DSTR(@Date1,'LOCALE_DATE')))&(' ') & (NSTR(@Hours,'Z'))&(':00'). The label is defined as IF(#IDACAIU@GMTOffset >= 0,"Date/time GMT/UTC +" & NSTR(#IDACAIU@GMTOffset,"Z") & " hours","Date/time GMT/UTC " & NSTR(#IDACAIU@GMTOffset,"Z") & " hours").
Note that #ID ACAIU@GMTOffset refers to the GMTOffset value entered in the main selection screen.
The result should look like:
showing the last 30 days of data with an hourly aggregation of pages and an entered GMT offset of 10 hours. In this case, the dates are reported in Australian format (dd-mm-yyyy).