Skip to Content

h4. Introduction

With Duet Sales Management, users can replicate accounts, contacts and activities from CRM to their familiar Microsoft Outlook environment. This blog talks about how you can check this replication mechanismus upfront, even before setting up your first Duet client, as well as how you can check how many business objects have been replicated to which user(s). h4. What would be replicated ?

In order to find out how many business objects would be replicated for a given user, you can use the report CRM_OSP_OUTPUT (or, in Duet 1.5, CRM_OSP_OUTPUT_15). This report will show you exactly how many accounts, contacts and activities would be replicated for a given user. This report reads the Duet customizing for the respective replication rules and lists the number of business objects. It is important to understand that those figures are not showing you what really has been replicated for this user, it only shows what would be replicated if this user would connect from his Duet client at this moment in time. So you can use the report to test your customizing and system settings upfront; you don’t need to set up a Duet client for this user in order to find out which business objects would make it to his or her client:

<br /><br/><img  height='176' alt='image' width='472' src='https://weblogs.sdn.sap.com/weblogs/images/19305/cjs_0000.jpg' border='0'/><br/>h4. What has been replicated ?
In order to find out how many business objects have actually been replicated to your userbase, you would need to take a look at database table /osp/t_cjs_gj.<br/><br/><img  height='310' alt='image' width='595' src='https://weblogs.sdn.sap.com/weblogs/images/19305/cjs_0001.jpg' border='0'/><br/><br/>This table stores the information what has been replicated to whom and when this has happened. So this table is only filled when a real Duet client connects to CRM and requests updates or an initial load. Browsing this table via se16 is kind of cumbersome, especially if you don't know which columns and which search criteria might be of interest. However, here are the most important columns: <ul><li>SA_ID - this column holds the username of the Duet client</li><li>S_ID - this coulmn holds the type of business object (CRMACCOUNT, CRMCONTACT, ACTIVITY)</li><li>MODIFIED - this column holds the timestamp when the particular table entry has been last modified</li></ul>h4. CJS table Excel export
In order to get a quick overview about how many business objects have been replicated to whom and when, I created a BSP application which reads and aggregates the data from database table /osp/t_cjs_gj, and in the end, presents them in an Excel sheet for further analysis or reporting. The ABAP code used might not be the most optimal way to do this, and mixing code and layout is bad practice in BSPs, anyhow, here's the source code for the BSP page: <pre>    <%@page language="abap" %>

<%

    TYPES: BEGIN OF cjs_count_type,

        name TYPE /osp/t_cjs_gj-sa_id,

        accounts TYPE i,

        contacts TYPE i,

        activities TYPE i,

        lastupd type /OSP/DT_CJS_TIMESTAMP,

        firstupd type /OSP/DT_CJS_TIMESTAMP,

      END OF cjs_count_type.

  DATA: itab_users TYPE TABLE OF /osp/t_cjs_gj-sa_id,

        wa_users TYPE /osp/t_cjs_gj-sa_id,

        itab_count TYPE TABLE OF cjs_count_type,

        lc_timestamp type timestamp,

        mydate type d,

        mytime type t,

        mydatec(12) type c,

        mytimec(12) TYPE c,

        wa_count TYPE cjs_count_type.

  • get list of users from CJS table

  SELECT DISTINCT sa_id FROM /osp/t_cjs_gj INTO TABLE itab_users.

  SORT itab_users DESCENDING.

  • select and aggregate all relevant data

  LOOP AT itab_users INTO wa_users.

     SELECT COUNT(*) FROM /osp/t_cjs_gj INTO wa_count-accounts WHERE sa_id = wa_users AND s_id = ‘CRMACCOUNT’.

     SELECT COUNT(*) FROM /osp/t_cjs_gj INTO wa_count-contacts WHERE sa_id = wa_users AND s_id = ‘CRMCONTACT’.

     SELECT COUNT(*) FROM /osp/t_cjs_gj INTO wa_count-activities WHERE sa_id = wa_users AND s_id = ‘ACTIVITY’.

     SELECT MAX( MODIFIED ) FROM /osp/t_cjs_gj INTO wa_count-lastupd WHERE sa_id = wa_users.

     SELECT MIN( MODIFIED ) FROM /osp/t_cjs_gj INTO wa_count-firstupd WHERE sa_id = wa_users.

     wa_count-name = wa_users.

     APPEND wa_count TO itab_count.

  ENDLOOP.

%>

<TABLE BORDER=1 CELLSPACING=1 CELLPADDING=1>
<th colspan=”1″>Username</th>
<th colspan=”1″>Accounts</th>
<th colspan=”1″>Contacts</th>
<th colspan=”1″>Activities</th>
<th colspan=”1″>First Update</th>
<th colspan=”1″>Last Update</th>
<%
  CLEAR wa_count.
  LOOP AT itab_count INTO wa_count.
    lc_timestamp = wa_count-firstupd.
    CONVERT TIME STAMP lc_timestamp TIME ZONE sy-zonlo INTO DATE mydate TIME mytime.
    WRITE mydate TO mydatec.
    WRITE mytime TO mytimec.
%>
<tr>
  <td align=”center”><%= wa_count-name%></td>
  <td align=”center”><%= wa_count-accounts%></td>
  <td align=”center”><%= wa_count-contacts%></td>
  <td align=”center”><%= wa_count-activities%></td>
  <td align=”center”><%= mydatec%> <%= mytimec%></td>
<%
    lc_timestamp = wa_count-lastupd.
    CONVERT TIME STAMP lc_timestamp TIME ZONE sy-zonlo INTO DATE mydate TIME mytime.
    WRITE mydate TO mydatec.
    WRITE mytime TO mytimec.
%>
  <td align=”center”><%= mydatec%> <%= mytimec%></td>
</tr>
<%
    clear: wa_count, mytimec, mydatec.
  ENDLOOP.
%>
</TABLE>

</pre>After creating this page you need to change it’s Mime Type to <pre>application/vnd.ms-excel
</pre>This way, the browser will use Excel to open the response.<br/><br/>!https://weblogs.sdn.sap.com/weblogs/images/19305/cjs_0002.jpg|height=115|alt=image|width=548|src=https://weblogs.sdn.sap.com/weblogs/images/19305/cjs_0002.jpg|border=0!<br/><br/>So when you execute the BSP, your browser should ask you if you want to save or open the response; chossing “Open” gives you the aggregated tabel content as an Excel sheet:<br/><br/>!https://weblogs.sdn.sap.com/weblogs/images/19305/cjs_0003.jpg|height=293|alt=image|width=416|src=https://weblogs.sdn.sap.com/weblogs/images/19305/cjs_0003.jpg|border=0!<br/>!https://weblogs.sdn.sap.com/weblogs/images/19305/cjs_0005.jpg|height=166|alt=image|width=579|src=https://weblogs.sdn.sap.com/weblogs/images/19305/cjs_0005.jpg|border=0!</body>

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply