SAP Multichannel Foundation for Utilities: Add new Odata Entity
The OData Service model delivered in SAP Multichannel Foundation for Utilities and Public Sector is built via the SAP Gateway Service Builder (SEGW) tool. Depending on the business needs, the SAP Gateway service model can be extended on different levels:
1. OData entity structure extension (adding append structure with custom fields) Extending the Interface of an OData Entity Using Custom Fields
2. Addition of new OData entities
3. OData entity logic extension (for example, adding additional validations) SAP Multichannel Foundation for Utilities: Implement Custom Logic for an Existing Entity
The common situation a customer faces is that the customer would like to add new entity to existing service model.
In this blog, we will illustrate how to add new entity “ExternalAccountIdentification” to show Account identification. You can also refer to other two blogs mentioned above.
1. Start SEGW in the SAP CRM system and create a new service model project Z_CRM_UTILITIES_UMC_NEW.
2. Right click on Data Model, select Redefine OData service (GW).
3. Select CRM_UTILITIES_UMC as a service to be redefined.
4. Select all entities to be included in the new service
5.Create new entity (ExternalAccountIdentification) and entity set (ExternalAccountIdentifications).
6. Add association and navigation property from Account entity so that ExternalAccountIdentifications can be accessed via navigation from Account Entity.
Navigation Property: Identifications
Association: Account_ExternalAccountIdentifications
7. Save and activate the model service.
8.Create implementation class for newly created entity. You have to inherit the abstract class CL_CRM_IU_UMC_ODATA_ABSTRACT
method IF_CRM_IU_UMC_ODATA_IMPL~GET_ENTITYSET.
DATA: ls_textid TYPE scx_t100key,
lv_string TYPE string,
lt_param TYPE crmt_iu_umc_order_search_param,
lt_result TYPE crmt_isu_order_search_result_t,
lt_cntritem TYPE crmt_iu_umc_cntritem.
DATA ls_idnumber TYPE zcrms_iu_umc_idnumber.
DATA lt_idnumber TYPE TABLE OF zcrms_iu_umc_idnumber.
DATA lt_idnumbers TYPE TABLE OF bapibus1006_id_details.
DATA lt_return TYPE bapiret2_t.
DATA lv_partner_id TYPE bu_partner.
DATA lv_id_type TYPE bu_id_type.
DATA lt_key_tab TYPE /iwbep/t_mgw_name_value_pair.
DATA ls_key_tab1 TYPE /iwbep/s_mgw_name_value_pair.
FIELD-SYMBOLS: <fs_id> TYPE bapibus1006_id_details.
FIELD-SYMBOLS <result> TYPE zcrms_iu_umc_idnumber.
READ TABLE it_key_tab INTO ls_key_tab1 WITH KEY name = gc_key_attribute1.
IF sy-subrc IS INITIAL.
lv_partner_id = ls_key_tab1-value.
ENDIF.
READ TABLE it_key_tab INTO ls_key_tab1 WITH KEY name = gc_key_attribute2.
IF sy-subrc IS INITIAL.
lv_id_type = ls_key_tab1-value.
ENDIF.
CALL METHOD check_user_authorisation
EXPORTING
iv_account_id = lv_partner_id
iv_entity_type = 'ExternalAccountIdentification'.
IF ls_key_tab1 IS NOT INITIAL.
ls_idnumber-accountid = lv_partner_id.
CALL FUNCTION 'BUPA_IDENTIFICATIONDETAILS_GET'
EXPORTING
iv_partner = ls_idnumber-accountid
* IV_PARTNER_GUID =
TABLES
et_identificationdetail = lt_idnumbers.
LOOP AT lt_idnumbers ASSIGNING <fs_id>.
IF sy-subrc IS INITIAL.
ls_idnumber-identificationnumber = <fs_id>-identificationnumber.
ls_idnumber-identificationtype = <fs_id>-identificationtype.
ENDIF.
APPEND ls_idnumber TO lt_idnumber.
ENDLOOP.
IF sy-subrc <> 0.
handle_technical_error( 'GET_ENTITYSET' ) .
ENDIF.
er_entityset = copy_data_to_ref( lt_idnumber ).
ELSE.
TRY. "support of long navigation from other than Account and Business agreement (unlikely)
super->if_crm_iu_umc_odata_impl~get_entityset(
EXPORTING iv_entity_name = iv_entity_name
iv_entity_set_name = iv_entity_set_name
iv_source_name = iv_source_name
it_filter_select_options = it_filter_select_options
it_order = it_order
is_paging = is_paging
it_navigation_path = it_navigation_path
it_key_tab = it_key_tab
iv_filter_string = iv_filter_string
iv_search_string = iv_search_string
io_tech_request_context = io_tech_request_context
IMPORTING er_entityset = er_entityset
es_response_context = es_response_context ).
CATCH /iwbep/cx_mgw_tech_exception .
MESSAGE e008(crm_iu_umc_odata) WITH iv_entity_set_name gc_key_attribute2 INTO lv_string.
handle_technical_error( 'GET_ENTITYSET' ).
ENDTRY.
ENDIF.
endmethod.
9. Create new BAdI implementation using the implementation class created in the previous step and give the filter value “ExternalAccountIdentification”(Entity Name).
10. In SAP Gateway system, add and activate backend service.
11. You can use the advanced REST client to test your newly created entity. You can add your username and password in the Authorization header.
Useful post, thanks! A bit more information would have been useful (what step does what/why, how it impacts the flow logic). Of course after you match the pieces together it can be understood but it can help a lot while you try to put things together.
The funny thing is I have discovered this post just before I have finished the last step by myself π
Hi,
Can you help me underastand SAP MCF.
I am new to SAP Multichannel Foundation. π
Thanks Alot.
Pavan G
Hi!
Well, it is complex. The standard needs a lot of modifications just to get the standard functionality working due to numerous problems. The customization is not well documented and solving issues via debugging takes an enormous amount of time.
You can only understand it by trying to implement it and by asking specific questions. As a reference it took 2 senior ABAP developers and 1 junior all-rounder approx. two months to get the mobile version working in a browser, without packing it together into a mobile app, which is still in progress.
Bálint
Hi Balint, why do you need a lot of modification to make standard run? π Standard shipment is supposed to run out of box unless you have tons of Z-coding and Z-processes then yes you would need modifications. I understand it is not easy because it is a lot of new technologies (OData, sap ui5, javascript) but we wrote so many blogs and improved admin guide many times to make it more clear. We released 5 SPs so far and we got a lot of feedback (even by phone, would you be interested?) about documentation and we improved it. But if you can be specific, we could still try to improve. You could also send your feedback to my email which is my firstname.lastname@sap.com.
Best Regards, Yevgen
We will be moving between systems, which means a new configuration/installation. I will try to collect the issues as we run into them. Can you send me the newest form of the install guide if that is newer than found here? Then we would see what has not been caught yet.
Our scenario is the IS-U only variant, maybe that makes it harder π I can see that you are trying hard, it is visible on your work here, for which I am grateful π .
I will try to get back soon but I cannot promise a deadline. Should I forget, contact me via e-mail.
Kind regards,
Bálint
Hi Balint, help.sap.com/umc has the latest one released for SP05 in September. Yes, for ISU only variant a bit of work is required. By the way, there is a feature to send private messages on SCN if we follow each other.
Thanks Yevgen
Hi,
will stay in touch, and get back to you once I can write a summary of the issues we encounter. Sorry, but I am just a bit overwhelmed now. π³
Bálint
Hi Pavan, the good news MCF is based on NW GW, OData and SAP UI5 (for template UIs). It seems that you are familiar with those. Architecture-wise it is similar to standard SAP FIORI approach. Specficially, about application, you have seen already this page which describes the product from functional and technical side: Key Topic: SAP Multichannel Foundation for Utilities and Public Sector. Two other resources to read: SAP Multichannel Foundation for Utilities and Public Sector – SAP Help Portal Page with admin guide and application help.
Application help concentrates on customization of features. Admin guide - on installation.
There is also an official training https://training.sap.com/shop/course/wdeumc-sap-multichannel-foundation-for-utilities-classroom-010-de-de/ and https://training.sap.com/shop/course/wnaumc-multichannel-foundation-for-utilities-virtual-remoteclassroom-010-us-en/
Best Regards, Yevgen
Very Nice blog! Thanks for sharing your knowledge.
I am new to MCF, Can anyone help me with the technical design, req below:
1.Mobile app is being developed in front end(Ios and Android), which only needs few fields data to be retrieved likeΒ customer details, Meter readings based on date range ,Payment History, Payment details Consumption details, Connection history, Raise complaint & Service request, Service request status, emergency Call-Should call emergency no's helpline etc.
what should be the technical approach for building Odata service in order to fulfill this requirement.
Thanks & Regards,
Santosh.K