Professional Documents
Culture Documents
If the list of the documents is huge, this puts additional performance overhead.
- You can also put a filter on the transactions. For instance you can store only not-completed transactions. In
this case, the table should always be small enough.
- You can set up different tables to support different searches. The split can be done according to any need, based on business role, search criteria, etc.
1.3. Example
In my example the table ZDMSH_ICSRV_IDX will contain only not confirmed (status <> I1005) service-related
transactions (object type = BUS2000116).
Table ZDMSH_ICSRV_IDX will contain the same fields as the standard index table CRMD_AUI_BTIDX, plus:
DIS_CHANNEL (Distribution Channel),
SALES_ORG (Sales Organization ID),
SALES_ORG_RESP (Organizational Unit (Sales)),
SERVICE_ORG (Service Organization) and
SERVICE_ORG_RESP (Organizational Unit (Service)), which can be used for authorization checks and
ZZ_BILL_TO (Bill to Party),
ZZ_PAYER (Payer),
ZZ_SERV_RCPNT (Service Recipient), which supposed to be shown on the screen.
The table will be built using the standard customizing: SPRO -> CRM -> Interaction Center Web Client >Customer-Specific System Modifications -> Business Transaction Search.
The search for non-completed service transactions will be supported by the table ZDMSH_ICSRV_IDX. (As of
today, the authorization checks are not considered, but in fact it's very easy for implementation).
All other searches will not be changed and will be supported by the standard index table CRMD_AUI_BTIDX.
The table ZDMSH_ICSRV_IDX will not store completed transactions. It will be populated from ORDER_SAVE
BADI using the update function module. The same functionality will be used to delete the data from the table,
once the document reaches the status completed - I1005.
Initial load will be performed using the automatically generated report.
Hint: For performance you can run several background jobs in parallel. Also parallelization should be enabled
for each background job.
There you need to specify the table fields using existing flat structures. You can use the structures:
CRMT*_*_IX or any other one, e.g. CRMT_AUI_INDEX, which is used in the standard index table
CRMD_AUI_BTIDX.
Hint: Later you will be using the method CL_CRM_IC_SOS_QUERY_MANAGER => EXECUTE_QUERY,
which returns CRMT_REPORT_LOCATORLIST_TA. So that for your new index table you can take the fields
from the structure CRMT_REPORT_LOCATORLIST. In this case you can just use MOVE-CORRESPONDING
command to simplify the mapping process.
Hint: You will also need to construct BTAUISearchResult (BOL/GENIL) objects. This object has a structure
CRMS_AUI_SRCH_RESULT. Usage of the fields from this structure can also simplify the mapping process.
Next we set up the fields with the filters. Normally you can set up the filters for corresponding business partner
functions.
But in fact this is not necessary fields; this just will be used for automatic generation of the ORDER_SAVE
BADI generation and the generation of the initial load report. If you plan to re-write the ABAP coding, you can
customize only the flat structure.
You do not need to place fields CLIENT and GUID. These fields will be automatically added to the index table
structure. These fields will be considered as primary database key.
Hint: The following customizing tables are involved:
CRMC_IC_SOS_TABL contains the header information for the index table. Used for index table
determination.
CRMC_IC_APPL_SOS contains the fields' information. Used for building the dynamic ABAP query.
CRMC_IC_APPL_SO2 contains the structures information. Used for building the dynamic ABAP
query.
This class needs to be inherited or copied from the standard class CL_CRM_IC_SOS_QUERY. In my case
I had to change core methods and thus it was copied. If the custom class is not mentioned in the table, the
standard class CL_CRM_IC_SOS_QUERY will be used.
Hint: The global variable GR_RESULT_LIST will contain the reference to result of the selection from your
index table. This table will be of type: TYPE STANDARD TABLE OF <YOUR INDEX TABLE>.
Authorization Object
Description
CRM_REPORT_RF_CHECK_AUTHORITY
All below
CRM_REPORT_RF_AUTH_OBJ_ORD_LP
CRM_ORD_LP
CRM_REPORT_RF_AUTH_OBJ_ORD_PR
CRM_ORD_PR
CRM_REPORT_RF_AUTH_OBJ_ORD_OE
CRM_ORD_OE
CRM_REPORT_RF_AUTH_OBJ_ORD_PO
CRM_ORD_PO
CRM_REPORT_RF_AUTH_OBJ_ORD_OP
CRM_ORD_OP
CRM_REPORT_RF_AUTH_OBJ_ORD_RS
CRM_ORD_RS
In my case I have created a separate class (ZL_DMSH_SOS_IDX_UPDATE) which implements the BADI
interface - IF_EX_ORDER_SAVE.
The method CHANGE_BEFORE_UPDATE looks as below:
CHANGE_BEFORE_UPDATE
method if_ex_order_save~change_before_update.
data: lr_instance type ref to if_ex_order_save.
lr_instance = zl_dmsh_sos_idx_update=>get_instance( ).
if lr_instance is not initial and
lr_instance is bound.
lr_instance->change_before_update( iv_guid = iv_guid ).
endif.
endmethod.
If you are not using the standard BT inbox index table CRMD_AUI_BTIDX, then GET_1O_QUERY_RESULT
will be called (see picture below).
Query Name
Standard Class
BTAdvQueryAUI
CL_CRM_QUERYAUI_RUN_BTIL
Standard Index
CRMD_AUI_BTIDX
BTAdvQueryIndexAUI
CL_CRM_QUERYINDEXAUI_RUN_BTIL
We do a substitution of the GENIL implementation for the query BTAdvQueryIndexAUI via the customizing
table CRMC_OBJ_BTIL_C.
Our new class needs to be inherited from the standard class CL_CRM_QUERYINDEXAUI_RUN_BTIL;
however the last one is marked final. We need to SAP Note: 2107260 Class
CL_CRM_QUERYINDEXAUI_RUN_BTIL is marked as final beforehand to overcome this problem.
Search
Query Name
Custom Class
Standard Index
CRMD_AUI_BTIDX
BTAdvQueryIndexAUI
ZL_DMSH_QUERYINDEXAUI_RUN_BTIL
Should I remind you that in the table CRMC_OBJ_BTIL_C the class name should be posted without postfix
_RUN and _BTIL.
We re-define the search method in a way that it distinguishes the searches that are supported by customdeveloped indices, in our case it's just one index table.
ZL_DMSH_QUERYINDEXAUI_RUN_BTIL=>IF_CRM_QUERY_RUNTIME_BTIL~GET_DYNAMIC_QUERY_RESULT
method if_crm_query_runtime_btil~get_dynamic_query_result.
* check if we can use the customer index table
if check_custom_index( it_selection_parameters ) = abap_true.
* Read the Custom Index Table
call method me->get_from_custom_index
exporting
is_query_params
= is_query_params
it_selection_parameters = it_selection_parameters
ir_root_list
= ir_root_list.
else.
* Use the standard query
call method super->if_crm_query_runtime_btil~get_dynamic_query_result
exporting
is_query_params
= is_query_params
it_selection_parameters = it_selection_parameters
ir_root_list
= ir_root_list.
endif.
endmethod.
Below method contains checks for supportability by the custom indices. In our case all queries for noncompleted service documents should go into our index table.
ZL_DMSH_QUERYINDEXAUI_RUN_BTIL=>CHECK_CUSTOM_INDEX
method check_custom_index.
data: ls_selection_parameters like line of it_selection_parameters.
data: lv_process_type type crmt_process_type.
data: ls_proc_type type crmc_proc_type.
rv_code = abap_false.
read table it_selection_parameters into ls_selection_parameters
with key attr_name = 'MAINCATEGORY'.
lv_process_type = ls_selection_parameters-low.
call function 'CRM_ORDER_PROC_TYPE_SELECT_CB'
exporting
iv_process_type
= lv_process_type
importing
es_proc_type
= ls_proc_type
exceptions
entry_not_found
=1
text_entry_not_found = 2
others
= 3.
The method GET_INDEX_NAME can be used in order to get the exact index that need to work at this point in
time. In the check described above we just need to distinguish if we run a standard search or via the custom
tables, which can be several, e.g. one for Closed documents, one for Open documents. Such check can be
done at the level of this BADI.
The BADI is specified as per IMG: SPRO -> CRM -> Interaction Center WebClient -> Customer-Specific
System Modifications -> Business Transaction Search -> BAdI: Determination of Search Index for Business
Transaction Search.
The BADI CRM_IC_SOS_INDEX should return us the correct index name. Note that it could be several indices
and the proper name should be retrieved by this BADI.
ZCL_IM_DMSH_ICSRV_IDX_SOS => IF_EX_CRM_IC_SOS_INDEX~GET_INDEX_NAME
method if_ex_crm_ic_sos_index~get_index_name.
if iv_caller = 'ZL_DMSH_QUERYINDEXAUI_RUN_BTIL' and " Place from where it's called
iv_profile = 'ZDMSH_IC_LI' and
it_parameters[] is not initial.
You might get problems passing IT_PARAMETERS into the BADI implementation. This is due to
outdated BADI generation. You should re-generate the BADI following SAP Note: 893181 BAdI
CRM_UPLOAD_CO was not generated correctly.
= 'ZL_DMSH_QUERYINDEXAUI_RUN_BTIL'
= lv_profile
iv_parameters
iv_requested_fields
= lt_parameter
= lt_parameter
it_selection_parameters = it_selection_parameters).
* check the result list is not initial
check lr_result_list is not initial.
* get the index line from the global buffers
data: lv_guid type crmt_object_guid.
data: lr_index_line type ref to data.
data: ls_index_line type zdmsh_icsrv_idx.
data: ls_attributes type crms_aui_srch_result_hana.
data: lt_result type crmt_aui_srch_result_hana.
data: ls_result type crms_aui_srch_result.
field-symbols: <fs_index_line> type any,
<fs_locator_tab> type crmt_report_locatorlist_ta,
<fs_locator_line> type crmt_report_locatorlist.
assign lr_result_list->* to <fs_locator_tab>.
if <fs_locator_tab> is assigned.
loop at <fs_locator_tab> assigning <fs_locator_line>.
lv_guid = <fs_locator_line>-guid.
clear: lr_index_line.
lr_index_line ?= cl_crm_ic_sos_query_manager=>get_index_data_ref( lv_guid ).
if lr_index_line is not initial.
assign lr_index_line->* to <fs_index_line>.
if sy-subrc = 0.
ls_index_line = <fs_index_line>.
Implementing Class
CL_CRM_AUI_CASE
CL_CRM_AUI_FAX
CL_CRM_AUI_LET
CL_CRM_AUI_ERP
CL_CRM_AUI_ONEORDER
CL_CRM_AUI_OUTCORRESP
CL_CRM_AUI_SAPOFFICE
CL_CRM_AUI_WF_WORKITEM
CL_CRM_AUI_WORKITEM
The settings are done in the customizing table CRMC_AUI_ITEMSCL or as per IMG: SPRO -> CRM -> Agent
Inbox -> Basic Settings for Item Types -> Assign Implementation Classes.
You must create a new user-defined implementation class according to the ABAP OO paradigm: A new
implementation class must be inherited from the standard implementation class.
See more about enhancing the standard IC Inbox objects here: http://scn.sap.com/docs/DOC-39631