Sei sulla pagina 1di 39

Case Management with

ArchiveLink Integration in CRM


Web UI

Applies to:
SAP CRM 7.0. For more information, visit the Customer Relationship Management homepage.

Summary
This document is about how documents stored using ArchiveLink interface can be integrated into CRM Web
Client UI by making use of Case Management. The scenario explained here highlights the use of Records
Management feature of Case to view and access the documents from CRM Web UI.

Author: Shyamnath Janardhanan


Company: SAP Global Delivery
Created on: 14 July 2011

Author Bio
Shyamnath Janardhanan is a Senior Consultant at SAP Global Delivery, India. He has got 12 plus years of
experience handling multiple SAP implementations and upgrade projects across different industries and SAP
solutions, focusing primarily on ABAP.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 1
Case Management with ArchiveLink Integration in CRM Web UI

Table of Contents
Introduction ......................................................................................................................................................... 3
Audience ............................................................................................................................................................. 3
Purpose............................................................................................................................................................... 3
Document Structure ............................................................................................................................................ 3
Issue in CRM Web UI ......................................................................................................................................... 4
CRM Case Creation ........................................................................................................................................ 4
Attaching Documents to Case ........................................................................................................................ 5
View Document Link and Display from Case Management ............................................................................ 7
View Document Link and Display from Case Management ............................................................................ 8
How to Fix the Issue ........................................................................................................................................... 9
Implicit Enhancement – One ........................................................................................................................... 9
Implicit Enhancement – Two ......................................................................................................................... 10
Implicit Enhancement – Three ...................................................................................................................... 11
Modification in BSP Component Workbench ................................................................................................ 13
Result – Case from CRM Web UI ..................................................................................................................... 16
Appendix ........................................................................................................................................................... 17
Configuration of ArchiveLink ......................................................................................................................... 17
Configuration of ArchiveLink Element Type .................................................................................................. 18
Configuration of Record Model for Case ....................................................................................................... 20
Configuration for Record Model Element Type ............................................................................................. 27
Link Record Model to Case Type .................................................................................................................. 30
Activating the Trigger for the ASSIGNED Event ........................................................................................... 31
Setting Up the Event-Receiver Linkage ........................................................................................................ 32
Related Content ................................................................................................................................................ 38
Copyright........................................................................................................................................................... 39

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 2
Case Management with ArchiveLink Integration in CRM Web UI

Introduction
NetWeaver AS supports integration of documents generated in SAP to external archives using ArchiveLink
interface and also to store the link as an electronic record in Case Management for later retrieval and review.
In CRM scenarios end users would only have access to Web UI for viewing the archived documents. So the
bad news is that Case Management with ArchiveLink integration is not supported in CRM Web UI, even
though the same is supported in SAP Basis Case Management (backend). This document explains on what
development enhancements you need to take care of for bridging this gap in Case Management for CRM
Web UI.

Audience
Target group intended:
Project Team members who want to know about implementing document storage requirements in CRM and
how they can be linked to CRM Web UI.
A background on the following is desired:

1. Basics of NetWeaver components: ArchiveLink, Case Management and Record Models

2. CRM UI Basics

3. ABAP fundamentals

Purpose
Documents stored via ArchiveLink interface can be viewed from the CRM Case Management in SAPgui by
clicking on the document link in Case. But there is an issue; the same Case when viewed from CRM Web UI
will not show the document link as SAP does not support the same for CRM Web UI. With a few lines of
code in certain implicit enhancements you could achieve this.

Document Structure
The document is structured into four sections. The first section shows you what the actual problem is giving
you details on what gap we are talking about. The second section focuses on what implicit enhancements
you need to take care of to close the gaps. The third section is to show you the result of these steps. The
fourth section is Appendix to give some background information on how to set up the CRM environment.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 3
Case Management with ArchiveLink Integration in CRM Web UI

Issue in CRM Web UI


To show the issue, first we‟ll create a Case in CRM system. After that a document will be attached to the
Case record model from SAPgui and then the document will be viewed from the Case in SAPgui. Finally we‟ll
take a look at the same Case in CRM Web UI where you will see what the issue is.

Note: There are certain prerequisites to be met for simulating the steps below like configuration for Case type and
Record models etc. If you are not familiar with these then you can refer to the appendix for details on how to
complete the configuration part.

CRM Case Creation


Case can be created via transaction SCASE. Navigate to the folder path shown below and click on „Create‟
in the context menu to create a new Case.

On the next screen choose any Case type which is already configured. In this case we are selecting the pre-
configured Case type ZCRM.

You will see the newly created Case in edit mode in the right navigation panel. Here you should click on save
button and then click on the button for „Linked Objects‟ to view the record model structure with the place
holders for documents. Here you can see that there are four different documents configured in the record
model and none of them are having documents currently assigned to it.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 4
Case Management with ArchiveLink Integration in CRM Web UI

Result
You have create a new Case 25036978 of type ZCRM with basic information and has a record model called
„Loan Documents‟ linked to it where it has got 4 nodes/place holders for holding 4 different types of
documents.

Attaching Documents to Case


Go to transaction OAAD and click on button „Store and Assign‟ to create archivelink documents for the Case.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 5
Case Management with ArchiveLink Integration in CRM Web UI

Give the business object as BUS20900 (business object for Case) and choose a document type
corresponding to the one available in the record model for Case. Here we have chosen ZFS3083 which
corresponds to „Supplementary Statement of Disclosure‟ in the Case record model.
Click on „Create‟ button which would then prompt to enter the Case ID. Here give the Case ID for the Case
created in step 1.1 above. You could get the guid for the Case from table SCMG_T_CASE_ATTR.
On continuing you will get the popup to select the document to be attached. Here we are selecting the
document „F3083 Supplementary statement of disclosure‟.

After storing the document successfully you will get the following screen with details on the stored
parameters under the section „Link entry‟. Here the object key is the unique guid for the Case created above.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 6
Case Management with ArchiveLink Integration in CRM Web UI

An entry is created in table TOA01 for every document stored using ArchiveLink services. So the above link
entry can be verified in the table TOA01 for the key fields returned by transaction OAAD.

Since the system is configured to raise the ASSIGNED event for every document stored using ArchiveLink
services for business object BUS20900, a workflow event will be triggered which can be verified using
transaction SWEL (event trace). Here you can note that the status in green which means that the receiver
function module ZZCRM_ALINK_RECMODEL_INS was called and executed successfully.

View Document Link and Display from Case Management


You can check the Case in transaction SCASE to view the Case 25036978 (created in step 1.1 above). Click
on the linked objects button to view the record model. Expand the node for loan documents and you can see
that the document link is store under the configured model node in the record model. Similarly you could add
more documents in transaction OAAD for other document types and verify here.

Double click on the document record to view the document content.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 7
Case Management with ArchiveLink Integration in CRM Web UI

View Document Link and Display from Case Management


Now let‟s view the same Case from CRM Web UI. You need to log into the CRM Web UI first and search for
the Case. The Case will be displayed in the result list.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 8
Case Management with ArchiveLink Integration in CRM Web UI

Case details are displayed where the record model can be seen. The issue here is that there are no
document links found under the node for „Supplementary Statement of Disclosure‟. The same node shows
the document link when viewed from SAPgui as you can see in 1.3 above.

How to Fix the Issue


Implicit Enhancement – One
In SE24 display the class CL_CRM_CMG_API and navigate to the method GET_RECORD_HIERARCHY.
Go the line where the class method cl_crm_cmg_util=>get_srm_sps is called. Double click and go inside this
method.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 9
Case Management with ArchiveLink Integration in CRM Web UI

Get to the implicit enhancement just before method ends and implement a new enhancement to add the
following lines of code, as you can see in the screenshot. Once this is done get back to the method
GET_RECORD_HIERARCHY.
DATA: lv_rmodel_flg TYPE c VALUE 'X'.

EXPORT rmodel_flg FROM lv_rmodel_flg TO MEMORY ID 'RMODEL'.


es_spsde-spid = 'SCMG_SP_BOR'.

Implicit Enhancement – Two


Go to the line where the method lr_poid->get_sp_poid( ) is called and double click to go inside the method.

Switch to enhancement mode, find the implicit enhancement just before ENDMETHOD and implement the
implicit enhancement to add the following lines of code. Once completed come out to get back to the method
GET_RECORD_HIERARCHY.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 10
Case Management with ArchiveLink Integration in CRM Web UI

DATA: ls_sp_poid TYPE srmpoid,


lv_rmodel_flg TYPE c.

IMPORT rmodel_flg TO lv_rmodel_flg FROM MEMORY ID 'RMODEL'.

IF lv_rmodel_flg = 'X'.
ls_sp_poid-id = 'BOR_OBJECT_ID'.
ls_sp_poid-value = '4D8816829DDE07F0E10080000A78382D'.

* Only add an entry if it does not already exist


READ TABLE re_sp_poid WITH KEY id = 'BOR_OBJECT_ID' TRANSPORTING NO FIELDS.
IF sy-subrc <> 0.
INSERT ls_sp_poid INTO TABLE re_sp_poid.
ENDIF.
ENDIF.

DELETE FROM MEMORY ID 'RMODEL'.

Implicit Enhancement – Three


Switch to enhancement mode while in GET_RECORD_HIERARCHY method and implement the implicit
enhancement just before the ENDMETHOD line to insert the below lines of code. Activate the enhancement
and return.
TYPES: BEGIN OF ty_model_id,
id TYPE char100,
END OF ty_model_id.
DATA: ls_elem_attributes TYPE srmxmlar,
lv_crep_id TYPE char2,
lv_doc_class TYPE char20,

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 11
Case Management with ArchiveLink Integration in CRM Web UI

lv_doc_id TYPE char40,


lv_doc_desc TYPE char50,
lv_lastmoduser TYPE char20,
lv_deal_type TYPE zz_deal_type,
lv_lastmoddate TYPE char10,
lv_lastmodtime TYPE char8,
lv_case_ref TYPE REF TO if_scmg_case_api.
LOOP AT et_all_fields ASSIGNING <fs_rec_hier>
WHERE sp_id = 'SCMG_SP_AL_DOCUMENT'.
LOOP AT <fs_rec_hier>-elem_attributes INTO ls_elem_attributes.
CASE ls_elem_attributes-name.
WHEN 'lastModUser'.
lv_lastmoduser = ls_elem_attributes-val.
WHEN 'lastModDate'.
lv_lastmoddate = ls_elem_attributes-val.
WHEN 'lastModTime'.
lv_lastmodtime = ls_elem_attributes-val.
WHEN 'CREP_ID'.
lv_crep_id = ls_elem_attributes-val.
WHEN 'ANCHOR'.
lv_doc_class = ls_elem_attributes-val.
WHEN 'DOC_ID'.
lv_doc_id = ls_elem_attributes-val.
WHEN 'DOC_DESC'.
lv_doc_desc = ls_elem_attributes-val.
ENDCASE.
ENDLOOP.

<fs_rec_hier>-shorttext = 'Document'.

* Assigning the case guid


<fs_rec_hier>-bor_key = <fs_rec_hier>-object_key(32).

* Clearing the default value in this field


CLEAR <fs_rec_hier>-field2.

* Description for the document newly inserted


<fs_rec_hier>-field1 = lv_doc_desc.
* Update details on last modified user, date and time
<fs_rec_hier>-field4 = lv_lastmoduser.
CONCATENATE lv_lastmoddate lv_lastmodtime INTO <fs_rec_hier>-field5
SEPARATED BY space.
* Info fields are updated with Content rep ID, Document class and Archive doc ID
* This will be later used in the event for displaying archive doc in a pop-up
<fs_rec_hier>-info1 = lv_crep_id.
<fs_rec_hier>-info2 = lv_doc_class.
<fs_rec_hier>-info3 = lv_doc_id.
ENDLOOP.
CLEAR et_tech_fields.
LOOP AT et_all_fields ASSIGNING <fs_rec_hier>.
MOVE-CORRESPONDING <fs_rec_hier> TO ls_tech_fields.
APPEND ls_tech_fields TO et_tech_fields.
ENDLOOP.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 12
Case Management with ArchiveLink Integration in CRM Web UI

Modification in BSP Component Workbench


Access the BSP component workbench to make modification to the custom enhancement set created for
component CRMCMP_CMG. This custom enhancement set would already be available or you would have
already created this as part of CRM Web UI configuration for Case display. Here as an example we are
showing the enhancement set ZZZZCS.
Expand the node for „Views‟.

Select the view „CRMCMP_CMG/RecordTree‟ to display the hierarchy on the right section. On the right
section expand the nodes highlighted in yellow.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 13
Case Management with ArchiveLink Integration in CRM Web UI

Continued from above screenshot; finally arrive at the attribute FIELD1 where you will have to re-define the
method GET_P_FIELD1 by selecting redefine from the context menu.

Method GET_P_FIELD1 should be redefined and the following lines of code should be added to the
redefined method. This would ensure that the URL would open up in a new browser window to display the
document.

CONSTANTS: lc_info1 TYPE name_komp VALUE 'INFO1',


lc_info3 TYPE name_komp VALUE 'INFO3',
lc_x TYPE char1 VALUE 'X',
lc_f TYPE char1 VALUE 'F'.

DATA: lr_entity TYPE REF TO if_bol_bo_property_access,


lv_info1 TYPE string,
lv_info3 TYPE string,
lv_url TYPE saeuri,
lv_crep_id TYPE saearchivi,
lv_arcdoc_id TYPE saeardoid.

lr_entity ?= me->bo.

CHECK lr_entity IS BOUND.


* Get property INFO1 - which is content rep ID e.g. 'ZB'
CALL METHOD lr_entity->get_property_as_string
EXPORTING
iv_attr_name = lc_info1
RECEIVING
rv_result = lv_info1.

* Get property INFO3 - which is the archive doc ID


CALL METHOD lr_entity->get_property_as_string
EXPORTING
iv_attr_name = lc_info3
RECEIVING

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 14
Case Management with ArchiveLink Integration in CRM Web UI

rv_result = lv_info3.

lv_crep_id = lv_info1.
lv_arcdoc_id = lv_info3.

CLEAR lv_url.
* Get URL for ArchiveLink document
CALL FUNCTION 'SCMS_AO_URL_READ'
EXPORTING
arc_id = lv_crep_id
doc_id = lv_arcdoc_id
http_url_only = lc_x
loc_info = lc_f
IMPORTING
url = lv_url
EXCEPTIONS
error = 1
OTHERS = 2.

CASE iv_property.

WHEN if_bsp_wd_model_setter_getter=>fp_fieldtype.
* Assign property of FIELD1 as hyperlink
rv_value = cl_bsp_dlc_view_descriptor=>field_type_link.

WHEN if_bsp_wd_model_setter_getter=>fp_onclick.
* Assign URL to the hyperlink field FIELD1
rv_value = lv_url.

ENDCASE.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 15
Case Management with ArchiveLink Integration in CRM Web UI

Result – Case from CRM Web UI


After ensuring that the above modifications and enhancements are made, rerun the Case from CRM Web UI
to see the results. Go the same steps as in 1.4 above to view the record model for Case. Here you can see
that the document is found under the node this time.

On clicking the hyperlink in description 1, you will see the document display in a separate browser window as
shown below.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 16
Case Management with ArchiveLink Integration in CRM Web UI

Appendix
The steps shown below indicate the configurations and settings required for getting started with the Case
creation in CRM system.

Configuration of ArchiveLink
ArchiveLink is a service integrated in the SAP Web Application Server for linking archived documents and
the application documents entered in the SAP system. Basic ArchiveLink settings can be done in SPRO in
the path shown below. The three main steps are highlighted which are the required steps.

Define a content repository ZB which is a HTTP content server that points to a third party physical directory.
The highlighted fields below are specific to the destination server which you need to know while configuring
the content repository.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 17
Case Management with ArchiveLink Integration in CRM Web UI

Define new document types for each document that are going to be generated from SAP and which are to be
stored into external archive. In this example we are considering 4 document types which are newly created
as shown below. Select the new entries button and add the following entries. The document class is currently
entered as „*‟ as it indicates that the document can be of any type, PDF, DOC, XLS etc.

Define linkages in the next step. Here we link the business object for Case (BUS20900) with the new
document types defined in the step above, specify to which content repository the document should be sent
to and also the table for relationship storage (TOA01). For any other new document types for the BP
business object you just need to keep copying any of these entries and keep changing only the document
types.

Result
You have created a new content repository ZB, new document types and linked them to business object
BUS20900 and have assigned table TOA01 to store the linkage.

Configuration of ArchiveLink Element Type


It is in the Registry where you define the ArchiveLink element type, which is to define on how the linking
should work to the external archive for a Case. In transaction SRMREGEDIT, under the area S_AREA_CMG
expand the node for service provider SCMG_SP_AL_DOCUMENT. Right click on the element type
SCMG_SPS_AL_DOCUMENT and select copy from the context menu to create a new element type
ZZCRM_SPS_AL_DOCUMENT and save the entry.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 18
Case Management with ArchiveLink Integration in CRM Web UI

This creates a new entry for element type in the hierarchy. Double click on this new element type to edit
further.

On the classification tab, get into change mode and create a new entry for parameter id for RMS_ID by
clicking the „Create‟ button. Choose the RMS_ID (Record Management System ID) parameter value as
CRM_CMG_DATA since we will be using CRM_CMG_DATA for our Case scenario. Make sure that you
remove any other parameter value for RMS_ID which was defaulted by system while this element type was
created.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 19
Case Management with ArchiveLink Integration in CRM Web UI

The element type would then be updated with the new values for parameter id RMS_ID as follows

Result
You have created a new ArchiveLink element type ZZCRM_SPS_AL_DOCUMENT.

Configuration of Record Model for Case


To model the structure of the case content you should create a Record Model for case. For this go to
transaction SCASE. Make sure you are in the Record Model System CRM_CMG_DATA by clicking on the
change RMS button as shown below and entering CRM_CMG_DATA.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 20
Case Management with ArchiveLink Integration in CRM Web UI

Now you are in the records management system for CRM Case. On the left panel navigate to the node as
shown below to create a new record model for case.

This would create a default structure with two nodes “Worklist” which is a structure node and “Worklist
Element” which is a model node. The attributes of these nodes can be edited by double clicking on the
nodes. This would show the attribute editing screen on the right window panel.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 21
Case Management with ArchiveLink Integration in CRM Web UI

Change the description of the structure node to „Loan Documents‟ by changing the description and clicking
the enter button. The description would then get updated in the model structure. The node type can be kept
as structure node. Leave other parameter values as is.

Now for the model node the following changes have to be made.
Description - update as „Supplementary Statement of Disclosure‟
Element type - there is a drop down menu to select the element type. Here expand the node for archived
documents and select the element type „ZZCRM_SPS_AL_DOCUMENT‟ created in the previous step 4.2.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 22
Case Management with ArchiveLink Integration in CRM Web UI

Relationship - from the drop down menu for available relations select „Document‟.

Attribute for Anchor - update the attribute for ANCHOR as the document type defined about for this
particular document, ZFS3083, defined in step 4.1 above.

After these updates are done select the enter button to update these attributes to the model node. On the
toolbar for the record model, select the icon to save the record model.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 23
Case Management with ArchiveLink Integration in CRM Web UI

At this moment you will be prompted to enter the description and unique ID. Give short description as „Loans‟
which will be the name of your record model. For unique ID, click the drop down menu and system will
automatically generate a 32 character guid for you. Continue by choosing enter button.

Now the model will look shown below. Notice that the status icon has now moved to green.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 24
Case Management with ArchiveLink Integration in CRM Web UI

Similarly create new model nodes for other documents that are required to be stored in this record model.
For this, select the last node and go to the toolbar menu path to create a new node after the current node on
the same level.

In this example we have created four model nodes in total using the same steps shown above. Note the
document descriptions and the related anchor attributes which reflects the document types for the respective
documents which are defined in step 4.1 above.

Also note in the above screen shot that the current status of the record model is „Initial‟. To make it ready for
usage in Cases, it should be in „Released‟ status. To change the status select the menu as shown below and
continue after selecting the „Status Released‟ radio button.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 25
Case Management with ArchiveLink Integration in CRM Web UI

You would now see the status as released in the status of the record model. At this stage you could lock
the record model into a transport request by choosing the menu Model Administration Transport
entry. This will then prompt for entering the transport request.
Once saved into a transport request the record model will be locked for any further changes. You will
have to release the transport request before making any changes to the record model.

The next step is to note the document ID of the record model for updating configuration for Case at a
later stage. Go to the history panel on the left side whether the created record model will be seen. Select
the record model „Loans‟, right click to get the context menu and click „Information‟ to get the information
pop-up where you‟ll have to take note of the document ID.
In this case the value is:
Document ID SRM_MOD02 4DDFFFBBB68F0D20E10080000A78382D

Result
You have created a new Record Model for Case called Loans.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 26
Case Management with ArchiveLink Integration in CRM Web UI

Configuration for Record Model Element Type


New element type for Case Records should be created in transaction SRMREGEDIT. Go to the node for
service provider SCMG_SP_CASE_RECORD and copy the element type SCMG_SPS_CASE_RECORD to
create a new element type ZZCRM_SPS_CASE_RECORD by choosing the copy functionality from the
context menu.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 27
Case Management with ArchiveLink Integration in CRM Web UI

The new element type will be copied over and created where you can update the name and description.
Click on save to create the new element type.

Get into the edit mode of this newly created element type; go to tab „Connection Parameter Values‟ to
redefine the values for parameter MODEL_ID. MODEL_ID is the actual record model created in step 4.3
above. Choose the parameter MODEL_ID and click change button to enter the record model id. On the pop-
up select the area parameter value CRM_CMG_DATA and proceed ahead.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 28
Case Management with ArchiveLink Integration in CRM Web UI

In this pop-up enter the document ID of the record model noted in step 4.3 above and continue.

The element type with the updated values will look like below.

Result
You have created a new record model element type ZZCRM_SPS_CASE_RECORD and have assigned
the newly record model „Loans‟ to it.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 29
Case Management with ArchiveLink Integration in CRM Web UI

Link Record Model to Case Type


The record model created in step above should now be linked to a Case Type. Navigate to the node below
from SPRO.

Create a new case type ZCRM with the essential values highlighted as shown below. Take special note of
the parameters below:
Case Rec. Model - should be updated with the Document ID of the record model created in
step 4.3.
Element Type ID (Rec.) - should be updated with the element type for record model in step 4.4.
The other parameters should be as seen below. If not creating a new one from scratch, you could copy and
create from the existing case type DEMO which is a standard case type for demo purpose and make
changes to the highlighted fields below to reflect the newly defined values.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 30
Case Management with ArchiveLink Integration in CRM Web UI

Result
You have created a new Case type ZCRM and have assigned the record model „Loans‟ to it.

Activating the Trigger for the ASSIGNED Event


In the ArchiveLink Customizing settings in transaction OAG1 (in the Implementation Guide (IMG), choose
SAP Web Application Server → ArchiveLink → Customizing Enhancements → Maintain All Basic Settings),
activate the trigger of the ASSIGNED event.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 31
Case Management with ArchiveLink Integration in CRM Web UI

Setting Up the Event-Receiver Linkage


When you link an event and a receiver, you specify which event causes a reaction for which business object.
You link events and receivers in transaction SWETYPV (from the SAP Easy Access screen, choose Tools →
Business Workflow → Development → Definition Tools → Events → Event Linkages → Type Linkages.
Make the following entries:
Object Type BUS20900
Event ASSIGNED
Receiver call Function module
Receiver Function Module Name of a function module that executes the reaction to the event
The receiver function module must be created as a copy of the
template function module SWE_TEMPLATE_REC_FB. This
function module is included in the function group
SWE_TEMPLATE.
The interface is described in the documentation about the
template function module. The Remote-Enabled Module flag must
be set in the attributes of the receiver function module.
Check Function Module (Optional) Name of a function module that you need to develop. You enter a
check function module to decide whether the receiver function
module needs to be called. You can make use of the data in the
event container. If an exception is triggered when a check function
module is executed, then the event is not linked to the receiver,
and the receiver function module is not executed.
The check function module must be created as a copy of the
template function module SWE_TEMPLATE_CHECK_FB. This
function module is included in the function group
SWE_TEMPLATE.
The interface is described in the documentation about the
template function module.
Linkage Activated Activate the Flag
The configuration will look like below once the entries are made.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 32
Case Management with ArchiveLink Integration in CRM Web UI

The custom logic to be written inside the function module is attached below. The custom function module
receives the event, gets the record model for the BP for which the event is raised, creates a record entry into
the record model for the ArchiveLink entry and saves the record model. Refer to the sample code below for
the receiver function module.

Sample Code:

FUNCTION zzcrm_alink_recmodel_ins.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(EVENT) LIKE SWETYPECOU-EVENT
*" VALUE(RECTYPE) LIKE SWETYPECOU-RECTYPE
*" VALUE(OBJTYPE) LIKE SWETYPECOU-OBJTYPE
*" VALUE(OBJKEY) LIKE SWEINSTCOU-OBJKEY
*" VALUE(EXCEPTIONS_ALLOWED) LIKE SWEFLAGS-EXC_OK DEFAULT SPACE
*" EXPORTING
*" VALUE(REC_ID) LIKE SWELOG-RECID
*" TABLES
*" EVENT_CONTAINER STRUCTURE SWCONT
*" EXCEPTIONS
*" TEMP_ERROR
*" ANY_ERROR
*"----------------------------------------------------------------------
* INCLUDE <cntain>.

DATA: c_documentclass TYPE bapidclass VALUE 'SCMG01',


c_archive_sps_id TYPE bapisrmrec-spsid VALUE 'ZZCRM_SPS_AL_DOCUMENT'.

DATA: lt_property_selection TYPE TABLE OF bapipropqy,


lt_resulting_list TYPE TABLE OF bapidoctab,
lt_element_sp_poid TYPE TABLE OF bapiproptb,
lt_element_properties TYPE TABLE OF bapiproptb,
ls_element_properties TYPE bapiproptb,

lwa_property_selection TYPE bapipropqy,


lwa_resulting_list TYPE bapidoctab,
lwa_element_sp_poid TYPE bapiproptb,

lv_case_guid TYPE scmg_case_guid,


lv_record_pdir TYPE scmg_record_pdir_id,
lv_anchor TYPE bapisrmrec-anchor,
lv_crep_id TYPE bapipropva,
lv_doc_class TYPE bapipropva,
lv_doc_id TYPE bapipropva,
lv_doc_desc TYPE bapipropva,
lv_return TYPE bapiret2,
lv_objecttext TYPE bapiedescr,
lv_rtime01 TYPE i,
lv_rtime02 TYPE i,
lv_rtime_diff TYPE i.

* Get case type and physical dir id for the case

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 33
Case Management with ArchiveLink Integration in CRM Web UI

lv_case_guid = objkey.

SELECT SINGLE b~record_pdir INTO lv_record_pdir


FROM scmg_t_case_attr AS a
JOIN scmg_t_case AS b
ON b~case_guid = a~case_guid
WHERE a~case_guid = lv_case_guid.
* Set property table
lwa_property_selection-propname = 'SRM_POID_ID'.
lwa_property_selection-sign = 'I'.
lwa_property_selection-option = 'EQ'.
lwa_property_selection-propval_lo = lv_record_pdir.
APPEND lwa_property_selection TO lt_property_selection.

* Retrieve correct record model for BP


CALL FUNCTION 'BAPI_RECORD_GETLIST'
EXPORTING
rms_id = 'CRM_CMG_DATA'
sps_id = 'ZZCRM_SPS_CASE_RECORD'
IMPORTING
return = lv_return
TABLES
property_selection = lt_property_selection
resulting_list = lt_resulting_list.

* Get the data from event container


LOOP AT event_container.
CASE event_container-element.
WHEN 'DOCUMENTTYPE'.
lv_anchor = event_container-value.
WHEN 'ARCHIVEID'.
lv_crep_id = event_container-value.
WHEN 'DOCCLASS'.
lv_doc_class = event_container-value.
WHEN 'ARCHIVEDOCUMENTID'.
lv_doc_id = event_container-value.
ENDCASE.
ENDLOOP.

* Set sp poid of ArchiveLink document


READ TABLE lt_resulting_list INTO lwa_resulting_list INDEX 1.
lwa_element_sp_poid-name = 'CREP_ID'.
lwa_element_sp_poid-value = lv_crep_id.
APPEND lwa_element_sp_poid TO lt_element_sp_poid.

lwa_element_sp_poid-name = 'DOC_CLASS'.
lwa_element_sp_poid-value = lv_doc_class.
APPEND lwa_element_sp_poid TO lt_element_sp_poid.

lwa_element_sp_poid-name = 'DOC_ID'.
lwa_element_sp_poid-value = lv_doc_id.
APPEND lwa_element_sp_poid TO lt_element_sp_poid.

* Get the description for the document type, which is defined as in trn OAC2
SELECT SINGLE objecttext
INTO lv_objecttext

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 34
Case Management with ArchiveLink Integration in CRM Web UI

FROM toasp
WHERE ar_object = lv_anchor
AND language = sy-langu.

* Insert document in record


GET RUN TIME FIELD lv_rtime01.
*---------------------------------------------------------------------*
* Add PDF document to the record model. The DO loop is to attempt
* multiple times, up to a max of 1 minute, because the Case might be
* locked by another process/user.
*---------------------------------------------------------------------*
DO.
* If the Case is locked out for more than a minute then exit this loop
GET RUN TIME FIELD lv_rtime02.
lv_rtime_diff = ( lv_rtime02 - lv_rtime01 ) / 1000000.
IF lv_rtime_diff >= 60.
*---------------------------------------------------------------------*
* When the Case is locked for more than a minute - The call to FM is
* scheduled in background task to monitor the LUW in SM58
*---------------------------------------------------------------------*
CALL FUNCTION 'SRM_RECORD_ADDELEMENT'
IN BACKGROUND TASK
EXPORTING
objectid = lwa_resulting_list-objectid
documentclass = c_documentclass
sps_id = c_archive_sps_id
anchor = lv_anchor "document type for e.g. ZFS3083
description = lv_objecttext
TABLES
element_sp_poid = lt_element_sp_poid
element_properties = lt_element_properties
EXCEPTIONS
anchor_not_found = 1
not_authorized = 2
parameter_error = 3
container_not_found = 4
container_is_locked = 5
max_number_of_elements = 6
poid_is_wrong = 7
internal_error = 8
record_is_frozen = 9
OTHERS = 10.
EXIT.
ENDIF.

* Fill element properties table


ls_element_properties-name = 'CREP_ID'.
ls_element_properties-value = lv_crep_id.
APPEND ls_element_properties TO lt_element_properties.
CLEAR ls_element_properties.

ls_element_properties-name = 'DOC_ID'.
ls_element_properties-value = lv_doc_id.
APPEND ls_element_properties TO lt_element_properties.
CLEAR ls_element_properties.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 35
Case Management with ArchiveLink Integration in CRM Web UI

PERFORM get_doc_description USING lv_anchor


CHANGING lv_doc_desc.
ls_element_properties-name = 'DOC_DESC'.
ls_element_properties-value = lv_doc_desc.
APPEND ls_element_properties TO lt_element_properties.
CLEAR ls_element_properties.

CALL FUNCTION 'SRM_RECORD_ADDELEMENT'


EXPORTING
objectid = lwa_resulting_list-objectid
documentclass = c_documentclass
sps_id = c_archive_sps_id
anchor = lv_anchor "document type for e.g. ZFS3083
description = lv_objecttext
IMPORTING
return = lv_return
TABLES
element_sp_poid = lt_element_sp_poid
element_properties = lt_element_properties
EXCEPTIONS
anchor_not_found = 1
not_authorized = 2
parameter_error = 3
container_not_found = 4
container_is_locked = 5
max_number_of_elements = 6
poid_is_wrong = 7
internal_error = 8
record_is_frozen = 9
OTHERS = 10.

IF sy-subrc <> 0
AND sy-subrc <> 5.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
RAISING any_error.

ELSEIF sy-subrc <> 5.


EXIT.
ENDIF.
ENDDO.

COMMIT WORK.

ENDFUNCTION.

*&---------------------------------------------------------------------*
*& Form GET_DOC_DESCRIPTION
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_LV_DOC_CLASS text
* <--P_LV_DOC_DESC text
*----------------------------------------------------------------------*
FORM get_doc_description USING ip_v_anchor
CHANGING cp_v_doc_desc.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 36
Case Management with ArchiveLink Integration in CRM Web UI

DATA: lt_arobj TYPE TABLE OF toasp,


ls_arobj TYPE toasp.

ls_arobj-ar_object = ip_v_anchor.

SELECT * FROM toasp INTO TABLE lt_arobj


WHERE ar_object = ls_arobj-ar_object.

READ TABLE lt_arobj INDEX 1 INTO ls_arobj.


IF sy-subrc <> 0.
CLEAR ls_arobj-ar_object.
ELSE.
cp_v_doc_desc = ls_arobj-objecttext.
ENDIF.

ENDFORM. " GET_DOC_DESCRIPTION

Event type linkage overview screen after the new entry is made.

Result
You have activated an event receiver linkage for event BUS20900.ASSIGNED.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 37
Case Management with ArchiveLink Integration in CRM Web UI

Related Content
SDN - Implement Document Storage Using Records Management
SAP Online Help - CRM UI Configuration Tool
SAP Online Help - SAP Records Management
SAP Online Help - ArchiveLink
For more information, visit the Customer Relationship Management homepage

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 38
Case Management with ArchiveLink Integration in CRM Web UI

Copyright
© Copyright 2011 SAP AG. All rights reserved.
No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG.
The information contained herein may be changed without prior notice.
Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors.
Microsoft, Windows, Excel, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation.
IBM, DB2, DB2 Universal Database, System i, System i5, System p, System p5, System x, System z, System z10, System z9, z10, z9,
iSeries, pSeries, xSeries, zSeries, eServer, z/VM, z/OS, i5/OS, S/390, OS/390, OS/400, AS/400, S/390 Parallel Enterprise Server,
PowerVM, Power Architecture, POWER6+, POWER6, POWER5+, POWER5, POWER, OpenPower, PowerPC, BatchPipes,
BladeCenter, System Storage, GPFS, HACMP, RETAIN, DB2 Connect, RACF, Redbooks, OS/2, Parallel Sysplex, MVS/ESA, AIX,
Intelligent Miner, WebSphere, Netfinity, Tivoli and Informix are trademarks or registered trademarks of IBM Corporation.
Linux is the registered trademark of Linus Torvalds in the U.S. and other countries.
Adobe, the Adobe logo, Acrobat, PostScript, and Reader are either trademarks or registered trademarks of Adobe Systems
Incorporated in the United States and/or other countries.
Oracle is a registered trademark of Oracle Corporation.
UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group.
Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of
Citrix Systems, Inc.
HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C®, World Wide Web Consortium, Massachusetts
Institute of Technology.
Java is a registered trademark of Oracle Corporation.
JavaScript is a registered trademark of Oracle Corporation, used under license for technology invented and implemented by Netscape.
SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP Business ByDesign, and other SAP products and services mentioned
herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and other countries.
Business Objects and the Business Objects logo, BusinessObjects, Crystal Reports, Crystal Decisions, Web Intelligence, Xcelsius, and
other Business Objects products and services mentioned herein as well as their respective logos are trademarks or registered
trademarks of Business Objects S.A. in the United States and in other countries. Business Objects is an SAP company.
All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document
serves informational purposes only. National product specifications may vary.
These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP
Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or
omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the
express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an
additional warranty.

SAP COMMUNITY NETWORK SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com
© 2011 SAP AG 39

Potrebbero piacerti anche