Description
This document gives step by step guidance for fact sheet enhancing and customizing in SAP CRM.
The fact sheet provides you with an immediate and condensed overview of information about business partners taken from several sources such as business partner master data, statistical and transaction data, derived from SAP CRM, SAP ECC, and SAP NetWeaver BI. It enables you to see quickly and easily the most important details about your customers.
Here I want to show how you can enhance fact sheet in SAP CRM by adding assignment blocks. For example I will take standard assignment block "Addresses" with technical name BP_ADDR/CorpAccountAddressesOV and add it to the fact sheet BP_ACCOUNT_FS.
To add the assignment block BP_ADDR/CorpAccountAddressesOV to the bsp component BP_FACTSHEET you need to create a new assignment block in BP_FACTSHEET and make it’s classes as inherits from the classes of BP_ADDR/CorpAccountAddressesOV.
Technical data
Transaction code: BSP_WD_CMPWB
Component: BP_FACTSHEET
1. In the component BP_FACTSHEET create assignment block CorpAccountAddressesOV.
On the Component Structure Browser click right mouse button on Views and then click Create.

In the field Name enter the name of the assignment block "CorpAccountAddressesOV" (or another if you want)

After press Continue until the end, it doesn’t need to fill other fields.
2. The next step is to inherit the classes of new assignment block from appropriate classes of the assignment block BP_ADDR/CorpAccountAddressesOV.
For ZL_BP_FACTS_CORPACCOUNTAD_IMPL->Superclass specify CL_BP_ADDR_CORPACCOUNTADD_IMPL: double click on Implementation Class ZL_BP_FACTS_CORPACCOUNTAD_IMPL, choose tab Properties, click on edit-icon than Change Inherit. In the field Superclass specify class CL_BP_ADDR_CORPACCOUNTADD_IMPL
Now we need to redefine method WD_CREATE_CONTEXT. Go to tab Methods, find method WD_CREATE_CONTEXT and press button Redefine.

Enter the following code:
METHOD WD_CREATE_CONTEXT.
* create the context
context = cl_bsp_wd_context=>get_instance(
iv_controller = me
iv_type = 'ZL_BP_FACTS_CORPACCOUNTAD_CTXT' ).
typed_context ?= context.
ENDMETHOD.
And activate it.
For ZL_BP_FACTS_CORPACCOUNTAD_CTXT->Superclass specify CL_BP_ADDR_CORPACCOUNTADD_CTXT

activate (may be you’ll need to exit and enter the assignment block to be able to see the context nodes).
Now you need to redefine methods CREATE_BUILHEADER, CREATE_BUILADDRESS, CREATE_EMAILADDRESSESTO of ZL_BP_FACTS_CORPACCOUNTAD_CTXT class. That’s because the context nodes 'ACTIVEADDRESS', 'PARTNER', 'EMAILADDRESSESTO' are used in component controller BP_ADDR and they aren’t in component controller of bsp component BP_FACTSHEET. So delete the call of method owner->do_context_node_binding:
CREATE_BUILHEADER:
METHOD CREATE_BUILHEADER.
DATA: model TYPE REF TO if_bsp_model.
model = owner->create_model(
class_name = 'CL_BP_ADDR_CORPACCOUNTADD_CN00'
model_id = 'BuilHeader' ).
builheader ?= model.
CLEAR model.
** binding to component controller
* owner->do_context_node_binding(
* iv_controller_type = cl_bsp_wd_controller=>co_type_component
* iv_target_node_name = 'PARTNER'
* iv_node_2_bind = builheader ).
ENDMETHOD.
CREATE_BUILADDRESS:
METHOD CREATE_BUILADDRESS.
DATA: model TYPE REF TO if_bsp_model,
coll_wrapper TYPE REF TO cl_bsp_wd_collection_wrapper,
entity TYPE REF TO cl_crm_bol_entity,
lr_address TYPE REF TO cl_crm_bol_entity.
model = owner->create_model(
class_name = 'ZL_BP_ADDR_CORPACCOUNTADD_CN01'
model_id = 'BuilAddress' ). "#EC NOTEXT
builaddress ?= model.
CLEAR model.
* owner->do_context_node_binding(
* iv_controller_type = cl_bsp_wd_controller=>co_type_component
* iv_target_node_name = 'ACTIVEADDRESS'
* iv_node_2_bind = builaddress ).
*
** initial setting for depandant model node
* coll_wrapper = builheader->get_collection_wrapper( ).
*
* entity ?= coll_wrapper->get_current( ).
*
* CHECK entity IS BOUND.
* builaddress->on_new_focus( focus_bo = entity ).
*
* lr_address ?= builaddress->collection_wrapper->get_current( ).
** reread all communication data for first entry
* IF lr_address IS BOUND.
* lr_address->get_related_entities( iv_mode = cl_crm_bol_entity=>bypassing_buffer ).
* ENDIF.
ENDMETHOD.
CREATE_EMAILADDRESSESTO:
METHOD CREATE_EMAILADDRESSESTO.
DATA:
model TYPE REF TO if_bsp_model.
model = owner->create_model(
class_name = 'CL_BP_ADDR_CORPACCOUNTADD_CN02'
model_id = 'EMAILADDRESSESTO' ). "#EC NOTEXT
emailaddressesto ?= model.
CLEAR model.
* owner->do_context_node_binding(
* iv_controller_type = cl_bsp_wd_controller=>co_type_component
* iv_target_node_name = 'EMAILADDRESSESTO'
* iv_node_2_bind = emailaddressesto ).
ENDMETHOD.
Activate class ZL_BP_FACTS_CORPACCOUNTAD_CTXT.
3. In the page CorpAccountAddressesOV.htm, tab page "Layout" enter the following code:
<%@page language="abap" %> <%@extension name="thtmlb" prefix="thtmlb" %> <%@extension name="chtmlb" prefix="chtmlb" %> <%@extension name="bsp" prefix="bsp" %> <chtmlb:overviewTableConfig id = "Table" table = "//BUILADDRESS/Table" width = "100%" />
In the tab page Page Attributes add attributes:
BuilAddress TYPE REF TO CL_BP_ADDR_CORPACCOUNTADD_CN01
BuilHeader TYPE REF TO CL_BP_ADDR_CORPACCOUNTADD_CN00
EmailAddressesTo TYPE REF TO CL_BP_ADDR_CORPACCOUNTADD_CN02
Activate.
4. Create plug-in Default in assignment block.
If cannot create plug-in you can do this another way: create method IP_DEFAULT in class ZL_BP_FACTS_CORPACCOUNTAD_IMPL with parameter IV_COLLECTION Importing Type Ref To IF_BOL_BO_COL
Parameter IV_COLLECTION contains the entity "BuilHeader".
In the method IP_DEFAULT make data set:
METHOD IP_DEFAULT. DATA: coll_wrapper TYPE REF TO cl_crm_bol_entity_col, entity TYPE REF TO cl_crm_bol_entity, lr_address TYPE REF TO cl_crm_bol_entity. CHECK iv_collection IS BOUND. me->typed_context->builheader->collection_wrapper->add_collection( iv_collection ). *initial setting for depandant model node coll_wrapper ?= iv_collection. TRY. entity ?= coll_wrapper->IF_BOL_BO_COL~GET_FIRST( ). CATCH cx_sy_move_cast_error. ENDTRY. CHECK entity IS BOUND. me->typed_context->builaddress->on_new_focus( focus_bo = entity ). lr_address ?= me->typed_context->builaddress->collection_wrapper->get_current( ). * reread all communication data for first entry IF lr_address IS BOUND. lr_address->get_related_entities( iv_mode = cl_crm_bol_entity=>bypassing_buffer ). ENDIF. ENDMETHOD.
Activate this method.
5. Create new configuration.
In Configuration tab create new configuration and add the fields you need in Displayed fields, then save the configuration (may be you’ll need to exit and enter the assignment block to be able to see tab Configuration).
6. On the Runtime Repository Editor press edit-icon and add this assignment block to MainWindow

BSP Application - BP_FACTSHEET
View - CorpAccountAddressesOV
7. Create Navigation Link "ToAddress" for this assignment block

You will need to enter the following data:
ID - ToAddress
Source View:
View - MainWindow
Target View:
View - BP_FACTSHEET/CorpAccountAddressesOV
Inbound Plug - DEFAULT

8. Add InboundPlug "Address" to MainWindow.
Click right mouse button on folder InboundPlugs and choose Add Plug with Follow Up Navigation

Inbound Plug - Address
Navigational Link ID - ToAddress

Save Runtime Repository Editor.
9. The next step is to assign the assignment block to component BP_FACTSHEET
Transaction code SPRO

then: Customer Relationship Management -> UI Framework->UI Framework Definition -> Fact Sheet -> Maintain Fact Sheet

Choose BP_ACCOUNT_FS and enter the folder View Assignments

Press New Entries and enter the following data:
Component Name - BP_FACTSHEET
Interface View - MainWindow
Inbound Plug - ADDRESS
Title - Business partner addresses (you can name it as you wish)

Press "enter", if the warning "Choose the key from the allowed namespace" appears – ignore it (you should press "enter" again). Save changes.
10. The last step is to add assignment block in the configuration of fact sheet.
Component BSP_DLC_FS is a Controller for Component BP_FACTSHEET.
Transaction code: BSP_WD_CMPWB
Component : BSP_DLC_FS
In the view BSP_DLC_FS/factsheet, open tab Configuration, press edit button and in dropdown list box Fact Sheet choose Account Fact Sheet (BP_ACCOUNT_FS)

Press Search and in table Result List choose the configuration you need (may be you will need to create a new configuration) and press Next.
On step 3 Assign Views find assignment block Business partner addresses and add it to Fact Sheet Views

Then press Finish button.
Comments (3)
Oct 03, 2011
sivahari says:
Hi Lenar Danilov, New Assignment block creation step by step procedure fo...Hi Lenar Danilov,
New Assignment block creation step by step procedure for BP_FACTSHEET component is very help full for me.
I want to do the same in Business partner (BP_HEAD) Mail page window. i tried the same procedure you mention above but the Assignment block link is not working.
Can you please provide me a step by step procedure for Business partner (BP_HEAD) main page also? if possible.
Reg,
hariharan.
.
Oct 04, 2011
Lenar Danilov says:
Hi, Sivahari! I will be glad to help you. Tell me please what standart ass...Hi, Sivahari!
I will be glad to help you.
Tell me please what standart assignment block to add to BP_HEAD Main page window as example.
I also recommend you to take a look to this article.
Best regards, Lenar.
Mar 01
Ankin89 says:
Hi Lenar, I have followed the same procedure which you described in the doc. It...Hi Lenar,
I have followed the same procedure which you described in the doc. It is quite helpful but still it is giving dump while calling method DO_INIT_CONTEXT. What changes I need to do?
would you please guide me?
Many Thanks in Advance.
Ankin Shah