Sei sulla pagina 1di 12

SAP AG

IBU Public Sector

Bernhard Knuth

Version 1.0

Cookbook for Enhancements


of CRM Case Management for Public Sector

Integrating PSCD-Objects

A Book for Technical Consultants

February 9th, 2004


Cookbook – Enhancements of CRM Case Management for Public Sector

Content:

1 Introduction.......................................................................................................................3

2 Objective............................................................................................................................3

3 Prerequisites.....................................................................................................................3

4 Example: Complaint Case with ‘PSCD Account Info’...................................................4

5 Steps for Enhancement...................................................................................................5

5.1 Overview of Steps..................................................................................................................................... 5

5.2 Step 1: Create Screen Structure.............................................................................................................. 6

5.3 Step 2: Create Blueprint View.................................................................................................................. 6

5.4 Step 3: Create Event................................................................................................................................. 6

5.5 Step 4: Create Field Group and Field Group Structure..........................................................................7

5.6 Step 5: Define Application Layout........................................................................................................... 7

5.7 Step 6: Create Function Module for BAPI-Call.......................................................................................8

5.8 Step 7: Create Model Access Class......................................................................................................... 8

5.9 Step 8: Define Application Set............................................................................................................... 10

5.10 Step 9: Assign Blueprint View to the Role of the Portal User......................................................11

5.11 Testing the demo scenario............................................................................................................. 12

6 References......................................................................................................................12

7 Glossary............................................................................................................................12

Page  2
Cookbook – Enhancements of CRM Case Management for Public Sector

1 Introduction
The business scenario CRM Case Management for Public Sector enables employees of a governmental
administration to process complex cases – such as a tax audit case. Tax information for a constituent or a
local company is kept in mySAP Public Sector Collection and Disbursement (PSCD) – based on R/3
technology using the SAPGUI for Windows for user interaction. On the other side, CRM Case Management
is based on mySAP CRM and was developed for the People-centric User Interface (PC-UI). Due to the
different methods of user interaction, it is a challenge to manage information from PSCD in CRM Case
Management.
This cookbook should help to understand, which steps to do in customizing – without modification – to get
information from a PSCD system (or any other R/3 system) displayed in CRM Case Management. It is
targeted for technical consultants.

2 Objective
This cookbook should demonstrate the flexibility of the SAP component CRM Case Management. It guides
through an example of how to enhance the SAP standard scenario by individual customer requirements. In
this example, information from a CRM-external system should be displayed in a CRM case.

Assuming, we have a Remote Function Call (RFC) – f.e. a BAPI – which retrieves data from the external
system. Every single step in customizing is described to get this data displayed in a case. The cookbook
follows this sample scenario and should enable you – as a technical CRM consultant – to set up similar
solutions – as required by your customer.

This enhancement is done without modification of the SAP standard functionality. It adds a blueprint view
using the Blueprint Application Builder (BAB). The blueprint view is set up for a user role in the SAP
Enterprise Portal.

What is not in focus is how to maintain data in the external system. Data is in display mode only. The next
step – for future cookbooks – would be how to update data in non-CRM systems.

Please note this cookbook was created on a SAP CRM system Release 4.0 with SP04 (based on a
WebAS 6.20 SP30) and a SAP EP 5.0. If you use it on a different release, some navigation, wording etc.
might have changed. Any feedback on this is highly appreciated (mailto:bernhard.knuth@sap.com).

3 Prerequisites
Following prerequisites should be fulfilled.
 CRM 4.0 - including an EP 5.0 (or EP 6.0) - and PSCD system installed
 Portal role which accesses CRM Application CRMD_CASE set up
 Demo user for the Caseworker or Case Manager which is assigned to the portal role as well
as to the SAP role ‘SAP_BC_CM_USER’ (or ‘SAP_BC_CM_ADMINISTRATOR’)
 CRM case type customized
 Case created
 Business Partner created and added to case in CRM
 Business Partner with same ID exists in PSCD
 Business Partner has Contract Account Information maintained
 RFC Destination from CRM to PSCD exists.
Furthermore, to perform the example in this cookbook, your development user in CRM must be authorized to
create development objects and maintain cross-client table entries. Have
o a package,
o a function group,
o a customizing transport request, and
o a workbench transport request
created, so you can transport all development objects afterwards.

Page  3
Cookbook – Enhancements of CRM Case Management for Public Sector

Little knowledge about ABAP programming and creating elements in Data Dictionary are required.

4 Example: Complaint Case with ‘PSCD Account Info’


Let us assume we have a demo citizen named Debby, which is a registered business partner. She has in
PSCD a contract account to pay her kindergarten fees at her local administration. Debby has created a
complaint case regarding the fees. Alberto is the assigned caseworker and needs to take care of the
complaint.
Alberto logs on his personalized portal to process the case. He needs to display personal data about Debby
(f.e. address) and all contract account information set up for Debby in PSCD.

Screen shot 1: View on complaint case with details on Business Partner

Screen shot 1 displays the CRM Case with the standard view on related business partners – as it can be set
up using regular IMG customizing.

Page  4
Cookbook – Enhancements of CRM Case Management for Public Sector

Screen shot 2: View on complaint case with details on PSCD-Account Information


Screen shot 2 displays in an additional blueprint view current information from the PSCD system. The data is
retrieved using SAP standard BAPI BAPI_CTRACPSOBJECT_GETLIST. To get more information about this
BAPI, please refer to http://ifr.sap.com in component ‘SAP IS-PS-CA’.

How this tabstrip ‘PSCD-Account-Info’ was set up is described in the following steps.

5 Steps for Enhancement

5.1 Overview of Steps


Following steps will be described to set up a new tabstrip (Note that all but one the configuration is done in
the CRM system. The last step is performed in portal administration):
 Create a screen structure in ABAP Data Dictionary (DDIC). This defines all elements including
data type and length to be displayed in the new tabstrip.
 Create a blueprint view for the standard case application in CRM.
 Create an event.
 Create a field group and field group structure.
 Define the application layout.
 Create a function module, which calls the BAPI to retrieve the data from PSCD.
 Create a model access class, which inherits from the standard model access class, and redefine
the READ-method.
 Define an application set.
 Optional: Add the blueprint view to the external service of the user role via the portal administration.

Page  5
Cookbook – Enhancements of CRM Case Management for Public Sector

5.2 Step 1: Create Screen Structure


The new tabstrip should display in a list all information on the contract account with columns like ‘Contract
Object’, ‘Object Type’ – as shown above in Screen shot 2. For each column we need a data element
including domain in the data dictionary.
 Since the original BAPI is defined in PSCD system, those data elements do not exist in CRM. A data
structure has to be created which is identical to BAPI_CTRACPSOBJECT_LIST in PSCD. Using
/nSE11
o create ‘Data type’ -> ‘Data element’ ZCSC_PSOBKEY_PS with ‘Element Type’ -> ‘Domain’
CHAR20 and ‘Field Label’ Contract Object,
o repeat this for all components in BAPI_CTRACPSOBJECT_LIST as in PSCD,
o create a ‘Data type’ -> ‘Structure’ with the id ZCSC_PSCD_CTRACPSOBJECT.
 Create another data structure called ZCSC_CRMT_PSCD_CTRACPSOBJECT with
o a component OBJECT_KEY of component type CRMT_BSP_OBJECTKEY and
o include structure ZCSC_PSCD_CTRACPSOBJECT .
 For a later step, we need a table type, which represents the list of line items in our tabstrip.
o Create in /nSE11 a ‘Data type’ -> ‘Table type’ with the id
ZCSC_CRMT_PSCD_CTRACPSOBJECT_T which consists of a ‘Line Type’
ZCSC_CRMT_PSCD_CTRACPSOBJECT .
 Activate all data elements, domains, structures and table types at the end.

5.3 Step 2: Create Blueprint View


The enhancement model of the People-Centric UI enables you to set up views – so-called blueprint views –
to change the layout of any CRM standard application. These views are assigned to roles. Any end user
with this role will see the changed view instead of the standard view. This is done without modification, and
offers your end users a tailor-made interface.

We will use an IMG customizing activity to change the standard case application ‘CRMD_CASE’. For this
(and the following steps), use transaction /nCRMC_BLUEPRINT_C, or navigate via the customizing IMG
(/nSPRO and F5) to ‘Customer Relationship Management’ -> ‘Layout of User Interface (People-centric UI)’.
 Navigate to ‘Application/Layout’ -> ‘View’.
 Switch to change mode (Ctrl + F1).
 Create ‘New Entries’ with
o View ’ZCSC_PSCD’ and
o Description ‘View for PSCD objects’.

5.4 Step 3: Create Event


The display of the People-Centric UI depends on triggered events. You trigger an event by selecting an
interface element (by pressing a button), or by pressing return.

In this IMG customizing activity, you create all events for tab pages, fields and buttons that are for interface
elements of the People-Centric UI that trigger an event. For our example, we will use the event for tab pages
only. Use transaction /nCRMC_BLUEPRINT_C.
 Navigate to ‘Application Element’ -> ‘Event’.
 Switch to change mode (Ctrl + F1).
 Create ‘New Entries’ with
o Event ’ZCSC_CMG_TAB_PSCD’ – unique identifier,
o Description ‘Layout-relevant’, meaning the triggered event only influences the layout,
o no Object Link,
o no Navigation Event and
o Unlock Object ‘No Data Loss Popup’, since we will not set up any navigation in our tabstrip,
and
o Text ‘PSCD-Account-Info’, as we will name our new tabstrip (compare with screen shot
above).

Page  6
Cookbook – Enhancements of CRM Case Management for Public Sector

5.5 Step 4: Create Field Group and Field Group Structure


A Field Group is a set of elements to be displayed based on a screen structure. In the Field Group Structure,
you can specify which fields should belong to a field group. You can define which fields should be displayed
in the dropdown box, and which should be displayed in the details screen.

We will use our in step 1 created screen structure to build up a field group structure.
Using transaction /nCRMC_BLUEPRINT_C
 navigate to ‘Application Element’ -> ‘Field Group’ -> ‘Field Group’.
 Switch to change mode (Ctrl + F1).
 Create ‘New Entries’ with
o Field Group ’ ZCSC_CMG_PSCD’ – unique identifier,
o Description f.e. ‘Case Man.: PSCD Objects’,
o now, use the horizontal scroll bar to get to the column Structure Name and enter
ZCSC_CRMT_PSCD_CTRACPSOBJECT .
o Leave the further columns Compress and Variants with their default value.
 Navigate to ‘Application Element’ -> ‘Field Group’ -> ‘Field Group Structure’ and select Work Area
ZCSC_CMG_PSCD and switch to change mode (Ctrl + F4).
 For each component of the structure ZCSC_PSCD_CTRACPSOBJECT (which is returned by the BAPI)
we need to create one entry with numbering the
o Screenposition f.e. ‘10’, ‘20’, …, ‘100’.
o Fld Grp Variant and View can be left blank.
o Field Name has to be the same as the component in ZCSC_CRMT_PSCD_CTRACPSOBJECT,
o Fieldtype is an ‘Inputfield’,
o URL Type and Unlock Object should be left as defaulted to ‘Portal Link’ and ‘No Data Loss
Popup’ (we are not using ‘Object Link’ at all since no navigation will be set up), and
o Height detail and Length detail stay initial.
o The following check boxes should be left initial – except ‘Not Changeable’ and ‘Not in List’.
Every component is for display only and should not be changeable. Which ever component
(i.e. Field Name) should not be displayed in overview mode must be ticked with ‘Not in List’.
Then, the component will only be shown when switching via the ‘Detail Toggle’ into detail
mode.
 The layout of the field group has to be generated afterwards. Navigate to ‘Application Element’ ->
‘Field Group’ -> ‘Layout Generation’ and select Field Group ZCSC_CMG_PSCD and set all other
fields and check boxes to blank.

5.6 Step 5: Define Application Layout


In this IMG customizing activity, you are able to define the precise structure of the screen for an application.
When you call an application using the browser, the main controller first looks at the data that has been
entered in this table. You make settings for the basic parameters, and define which screen elements (field
groups, toolbar groups, search groups and so on) should be used in the screen structure.

In our example, we add an entry only valid for our view. The standard case application will not be changed.
Only users, which will have this view (depending on their role), will see this tabstrip.
Using transaction /nCRMC_BLUEPRINT_C
 navigate to ‘Application/Layout’ -> ‘Define Application Layout’ and select ‘CRMD_CASE’.
 Switch to change mode (Ctrl + F4).
(if no standard entry is shown, import ‘S Table Entries’ by Ctrl + F12.)
 Create a new entry for
o View ’ZCSC_PSCD’,
o Event ’ZCSC_CMG_TAB_PSCD’,
o Position ’Detail Area 1’ (which is the position shown in screen shot above),
o Screen Variant – no entry in our example (they are used in very special requirements only),
o Scrn Elmnt Type ‘List’,
o Field Group ‘ZCSC_CMG_PSCD’,
o Toolbar Group – no entry, since no push buttons (except the ‘Detail Toggle’) will be offered,
o Tab Page Group ‘CMG_MAIN’,
o Search Grp, DocuClass, and Object ID – no entry,

Page  7
Cookbook – Enhancements of CRM Case Management for Public Sector

o Structure Name – as defined for the selected Field Group – cannot be changed anyhow.

5.7 Step 6: Create Function Module for BAPI-Call


Until now, all the steps could be performed by creating data structures in Data Dictionary and setting IMG
customizing. This and the following step require ABAP knowledge. Firstly, we will create a function module
for accessing data in PSCD. Secondly, we will build a so-called Model Access Class for converting the data
into a format, which can be displayed in the People-Centric UI.
The source code, import&export parameter etc. will look completely different, if you choose to take a different
BAPI, or any other own-developed RFC. This should demonstrate an example, how to use the standard
BAPI BAPI_CTRACPSOBJECT_GETLIST.
The function module will take a Business Partner ID as import and return a list of lines responding to data
structure ZCSC_PSCD_CTRACPSOBJECT.
Create the function module with transaction /nSE37
 enter ‘Z_IBS_PS_READ_PSCD’, assigning your function group (see chapter on ‘Prerequisites’) and
naming it f.e. ‘Read Contract Account Info from PSCD (BOR Object 'CtrAcPSObject')’.
 Import Parameter Name ‘IV_BUPA’ of Type ‘TYPE’ and Associated Type ‘BU_PARTNER’.
 Tables Parameter Name ‘PSOBJECTLIST’ of Type ‘LIKE’ and Associated Type
‘ZCSC_PSCD_CTRACPSOBJECT’.
 Enter source code which could look like this:

FUNCTION Z_IBS_PS_READ_PSCD.
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" REFERENCE(IV_BUPA) TYPE BU_PARTNER
*" TABLES
*" PSOBJECTLIST STRUCTURE ZCSC_PSCD_CTRACPSOBJECT
*"----------------------------------------------------------------------
types: begin of bapi_struc,
SIGN type BAPISIGN,
OPTION type BAPIOPTION,
LOW type BU_PARTNER,
HIGH type BU_PARTNER,
end of bapi_struc.
data: ls_partner_list type bapi_struc,
lt_partner_list type table of bapi_struc,
ls_bapiret2 type BAPIRET2 occurs 0.

ls_partner_list-sign = 'I'.
ls_partner_list-option = 'EQ'.
ls_partner_list-low = IV_BUPA.
append ls_partner_list to lt_partner_list.

CALL FUNCTION 'BAPI_CTRACPSOBJECT_GETLIST' DESTINATION 'PSCD_CL100'


EXPORTING
MAXROWS = 100
TABLES
PARTNERSELECTION = lt_partner_list
PSOBJECTLIST = PSOBJECTLIST
RETURN = ls_bapiret2.

ENDFUNCTION.

The code sets the imported id of a single business partner into appropriate format. Then, the BAPI is
called via Remote Function Call (RFC). The destination 'PSCD_CL100' has to be set up via
transaction /nSM59 before (see chapter on ‘Prerequisites’).

5.8 Step 7: Create Model Access Class


Any application of the People-Centric UI relies on Model Access Classes. It is an ABAP class, which –
among other things – takes care for reading data to be presented using the browser. For the SAP standard
application ‘CRM Case Management’ the model access class CL_CRM_BSP_CMG_ACCESS was created.

Page  8
Cookbook – Enhancements of CRM Case Management for Public Sector

Object-oriented ABAP (ABAP-OO) allows reusing major functionality by creating a sub-class, which inherits
most of the needed functionality. This ensures that standard functionality will be maintained through Support
Packages, and can be extended without modification.
Create the new model access class with transaction /nSE24
 enter ZCL_CRM_BSP_CMG_ACCESS_PSCD as unique identifier,
 click on icon to ‘Create Inheritance’ – located on the top right of the creation popup – and enter
CL_CRM_BSP_CMG_ACCESS as Superclass, a Description f.e.’ Model Class for PSCD Extension’,
Instantiation ‘Public’, check Class Type ‘Usual ABAP Class’, tick Final, and leave Only Modeled
blank.
 Add an attribute to the class, like ‘GT_CRMT_PSOBJECT’ as ‘Instance Attribute’ and ‘Protected’
‘Type’ ‘ZCSC_CRMT_PSCD_CTRACPSOBJECT_T’. With this attribute, we can ensure that once
the data is read via RFC from the PSCD system it is buffered in CRM until the user selects a
different case to work with.
 Switch to tab ‘Methods’ and re-define method IF_CRM_BSP_MODEL_ACCESS_IL~READ. Set cursor
on this method (not double-clicking) and select icon ‘Redefine’ which brings you to the source code.
The coding could look like this:

method IF_CRM_BSP_MODEL_ACCESS_IL~READ .

* data definition for reading case reference and model hierarchy


data: lv_case_in_focus type crmt_bsp_objectkey,
lv_case_guid type scmg_case_guid,
ls_rec_hier type crmt_bsp_cmg_rec_hierarchy.

* data definition for reading PSCD data


data: lv_bu_partner type BU_PARTNER,
ls_psobject type ZCSC_PSCD_CTRACPSOBJECT,
lt_psobject type table of ZCSC_PSCD_CTRACPSOBJECT,
ls_crmt_psobject type ZCSC_CRMT_PSCD_CTRACPSOBJECT,
lt_crmt_psobject type table of ZCSC_CRMT_PSCD_CTRACPSOBJECT.

* Part One: get case reference -> as in superclass method


read table it_object_key into lv_case_in_focus index 1.
if gr_case is initial or
gr_case->g_case_guid ne lv_case_in_focus.
lv_case_guid = lv_case_in_focus.
check lv_case_guid is not initial.
gr_case = me->get_case_ref( lv_case_guid ).
clear gt_messages.

* Part Two: read all business partners from case model


call function 'CRM_CMG_GET_RECORD_HIERARCHY'
exporting
im_case = gr_case
importing
ex_rec_hierarchy = gt_rec_hier.

loop at gt_rec_hier into ls_rec_hier where


node_type = GC_NODE_TYPE_INSTANCE and
anchor = 'C1'. "Anchor for BP
lv_bu_partner = ls_rec_hier-bor_key.
exit. "Take first BP -> NOT valid for real solution
endloop.

* Part Three: read from PSCD


call function 'Z_IBS_PS_READ_PSCD'
EXPORTING
IV_BUPA = lv_bu_partner
tables
psobjectlist = lt_PSOBJEC.

Page  9
Cookbook – Enhancements of CRM Case Management for Public Sector

* Part Four: merge PSCD data into screen structure (i.e. into attribute of class)
loop at lt_psobject into ls_psobject.
move-corresponding ls_psobject to ls_crmt_psobject.
move ls_psobject-PSOBJECTKEY to ls_crmt_psobject-object_key.
append ls_crmt_psobject to lt_crmt_psobject.
endloop.

gt_crmt_psobject = lt_crmt_psobject.

endif.

* Part Five: Set screen structure for display in PC-UI


et_screen_structure = gt_crmt_psobject.
endmethod.

This sample coding consist of data definition and five parts (as highlighted):
1. Checks if PSCD data was read before.
2. After a function call gt_rec_hier has all objects linked to the case record. With node type
‘INSTANCE’ and anchor ‘C1’ all attached business partners are filtered. The id of the first
business partner found will be moved to lv_bu_partner. This is just for the demo example. It
is not likely that this can be taken for a real scenario.
3. The function module of the previous step is called. That step, i.e. the creation of a function
module including function group, can be avoided by inserting the source code directly into
this part.
4. The data is converted into to the structure for the PC-UI and moved into the global attribute
of our model access class.
5. The final part has to be done regardless of the check in part 1. It moves the list of PSCD
objects into the screen structure of the PC-UI.

5.9 Step 8: Define Application Set


Now everything is defined to assemble the final application set. In this IMG activity, you can group screen
elements to application sets, such as: Toolbar Groups, Tab Page Groups, and Search Groups. This
procedure permits the re-use of screen elements in several applications.
An application set usually displays a business object, for example a business partner. You can assign as
many applications as you wish to an application set. If you create a new application, the elements of an
application set can be combined with each other, and used again.

In our example, ‘CRMD_CASE’ is the standard application set for Case Management. Since we added our
new tabstrip in a new blueprint view, we do not have to add our Tab Page Group to the application set.
Neither have we set up a Toolbar Group nor a Search Group, which we would need to assign in the IMG
customizing step. But we need to assign our model access class to the application set.

Use transaction /nCRMC_BLUEPRINT_C to


 navigate to ‘Application Element’ -> ‘Application Set’.
 Switch to change mode (Ctrl + F1).
 Select Application Set ‘CRMD_CASE’ and double-click on ‘Model Access’.
 For all the areas (i.e. search area, result area, detail area 1, and detail area 2) a screen structure is
required for displaying in the PC-UI. All the standard screen structures are listed. Create a new
entry for
o Structure Name ’ZCSC_CRMT_PSCD_CTRACPSOBJECT’ with
o Access Class ’ZCL_CRM_BSP_CMG_ACCESS_PSCD’,
o Structure Type ‘Main Structure’,
o Reference Name ‘CMG_ORDER’,
o Parent Name ‘CMG_MAIN’, and
o Ref. Applicatn initial.

Page  10
Cookbook – Enhancements of CRM Case Management for Public Sector

5.10 Step 9: Assign Blueprint View to the Role of the Portal User
The final step is done in portal administration. If the portal is not installed yet, the scenario can be tested
without the portal.
By setting up the access for any user via the SAP Enterprise Portal, an External Service for the CRM
application CRMD_CASE must have been established (see chapter on ‘Prerequisites’). It should look as
screen shot 3 shows.

Screen shot 3: Administration of External Services in mySAP Enterprise Portal


The URL of the external service has to be extended by one parameter, indicating the blueprint view. The
original ‘Additional Query String’ should look as follows:

appl=CRMD_CASE&sap-syscmd=nocookie

That should be extended to:

appl=CRMD_CASE&sap-syscmd=nocookie&BLVIEW=ZCSC_PSCD

Page  11
Cookbook – Enhancements of CRM Case Management for Public Sector

5.11 Testing the demo scenario


When the end user logs on to his portal and accesses (through his role) the extended external service, he
should see the new tabstip as soon as a single case is selected.

If the SAP Enterprise Portal is not installed yet, it is possible to test the view by calling transaction /nSE80
 select ‘BSP Application’ ‘CRM_BSP_FRAME’,
 click on ‘Pages with Flow Logic’ -> ‘select.htm’
 right-mouse-click -> ‘Test’,
 log on with end-user id and password,
 select ‘Case Management’ (or ‘CRMD_CASE’), and
 add ‘&BLVIEW=ZCSC_PSCD’ at the end of the URL. This URL could look similar to this:
‘http://iwdf9391.wdf.sap.corp:1080/sap/bc/bsp/sap/crm_bsp_frame/entrypoint.do?
sap-client=750&appl=CRMD_CASE&BLVIEW=ZCSC_PSCD’.
As soon as a single case is selected, the new tabstrip should appear.

6 References
 Online documentation Basis Case Management: http://help.sap.com
 Documentation on BAPIs http://ifr.sap.com à Component SAP IS-PS-CA

7 Glossary
Term Definition
BAB Blueprint Application Builder
PC-UI People Centric CRM User Interface
BAPI Business Application Program Interface
RFC Remote Function Call
EEWB Easy Enhancement Workbench
DDIC ABAP Data Dictionary
WebAS Web Application Server
PSCD Public Sector Collection and Disbursement

Page  12

Potrebbero piacerti anche