on 05-12-2011 2:06 PM
Hi,
We need to get the portal users "Last Successful Logon" information in Portal 7.0 SP 19.
Please help me with your ideas in implementation.
Regards,
Raju
You can retrieve this information from WCR_USERSTAT Table.
To understand the Table structure refer to
http://help.sap.com/saphelp_nw04/helpdata/en/48/6aa9429b930b31e10000000a1550b0/content.htm
To know how to access the table refer to
http://wiki.sdn.sap.com/wiki/display/Snippets/DirectAccesstoDatabaseTables
Thanks
Prashant
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Create a abstract portal component and copy and paste the below code for the doContent () Method.
public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)
{
DataSource dataSource= null;
ResultSet resultSet= null;
String sqlStatement =null;
ResultSetMetaData rsmd =null;
String nativesqlStatement=null;
try
{
sqlStatement = "select MAX(TIMESTAMPHOUR),LOGONID from WCR_USERSTAT GROUP BY LOGONID";
InitialContext initialContext= new InitialContext();
dataSource= (DataSource) initialContext.lookup("jdbc/SAP/EP_PCD");
java.sql.Connection connection= dataSource.getConnection();
java.sql.Statement statement= connection.createStatement();
Statement stmt=NativeSQLAccess.createNativeStatement(connection);
resultSet= statement.executeQuery(sqlStatement);
rsmd=resultSet.getMetaData();
if(resultSet!=null)
{
int m = 0;
response.write("<html>");
response.write("<body>");
response.write("<br>");
response.write("<TABLE width='100%' border='2' cellspacing='2'>");
response.write("<tr>");
response.write("<td>"+"LAST SUCCESSFULL LOGON" +"</td>" );
response.write("<td>"+"LOGONID"+"</td>" );
response.write("</tr>");
while (resultSet.next()) {
m++;
Timestamp ts = new Timestamp(resultSet.getLong(1));
response.write("<tr>");
response.write("<td>"+ts.toGMTString()+"</td>" );
response.write("<td>"+resultSet.getString(2)+ "</td>");
response.write("</tr>");
}
response.write("</table>");
response.write("<br>");
response.write("Record count is " + m);
}
}
catch (Exception e)
{
response.write("<br>Exception : " + e);
}
response.write("</body>");
response.write("</html>");
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.