Custom Webservice for S4 HANA Utilities BPEM CASE
Enabling the Utility Extension to C4C allows SAP C4C to be used as a Utilities Service and Call Center Solution running on top of IS-U. The Integration of CRM Solution with the Back-end ERP supports seamlessly transition between the different support channels, allowing all the utility services performed in this cloud solution are correspondingly updated in the ERP system.
Part of CRM Solutions in C4C is Service Ticket. Recently I have created a solution to automate the creation of BPEM Case in S4 HANA and will be displayed as Service Ticket in C4C. I’d like to share this with other Cloud for Customer users and ABAP Developers who will work on customizing Webservices for their requirement.
CSR/User is currently notified when a Premise needs to be inspected in the Utilities 360 Tab(Enhancement) in the C4C Front End, BPEM Case is expected to be created and should be available once the Notification/Message is shown in the Highlights Section of Utilities 360 Tab.
The Premise Status is retrieved in the Back End and return as a message in the Highlights Section.
C4C Utilities 360 Tab
Given that the configuration for Standard Webservice ISU_C4C_OBJECT_HIER_V2 is already available in the System, Customization can be done in the Back End, Developer can create BADI implementation based on enhancement spot ES_COD_UTIL_SEARCH_IDENTITY.
Webservice for the Highlights Section in C4C Utilities 360 Tab
Enhancement Spot ES_COD_UTIL_SEARCH_IDENTITY
Once you created the BADI Implementation, Implementation Class will be created as well, and method will be available for customization. In our case since the BPEM CASE needs to be created once the notification or message is shown on the Highlights Section, Code change for the notification message and the creation of BPEM Case will be catered on the Method IF_COD_UTIL_OBJ_HIER_BADI~OBJ_HIER_POST_V2.
BADI Implementation created in the Enhancement Spot ES_COD_UTIL_SEARCH_IDENTITY
Implementation Class generated from the Creation of BADI Implementation above.
Method for Customization
The condition for the requirement is to trigger a message when the Premise has a certain STATUS. Let’s say that the STATUS we want is ‘E002’. Check out the pseudocode below on how the Function Module STATUS_READ and BAPI_BPEM_CASE_CREATE was used to meet the requirements.
"Read the Status using PREMISE CALL FUNCTION 'STATUS_READ' "Read Object Status (JSTO and JEST) EXPORTING client = SY-MANDT " sy-mandt Client objnr = " jsto-objnr Object Number = PREMISE OBJNR only_active = 'X' " jest-inact 'Transfer Active Statuses Only' Flag TABLES status = lt_objnr_stat " jstat Table of Individual Statuses for the Object EXCEPTIONS OBJECT_NOT_FOUND = 1 " Status Object Not Found IF line_exists( lt_objnr_stat[ stat = 'E0002' ] ). "STATUS to check "APPEND Message to EXTENSION DATA APPEND VALUE #( ref_field_name = 'The Premise needs to be' ref_field_value = 'Inspected') TO ct_extension_data. **CREATE CPEM CASE *fill out ls_casecreate and lt_objects *values depends on the configuration on your system CALL FUNCTION 'BAPI_EMMA_CASE_CREATE' "Create Clarification Case Manually EXPORTING case_create = ls_casecreate " bapi_emma_case_create Fields for Creation of Manual Case TABLES objects = lt_objects " bapi_emma_case_object Case Objects case_text = lt_case_text " bapi_emma_tline Long Text return = lt_return " bapiret2 Return Parameters . " BAPI_EMMA_CASE_CREATE READ TABLE lt_return TRANSPORTING NO FIELDS WITH KEY type = 'E'. "Check for errors IF sy-subrc = 0. CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'. ELSE. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'. ENDIF. ENDIF.
In testing the integration from C4C you may go directly to the Utilities 360 Tab to trigger the Notification Message and the Automatic creation of BPEM Case. However, in S4 side the process can be tested upon running the webservices in transaction SE80 and with the medium of XML messages to process the data. Below is the sample payload that was sent out to C4C.
C4C BPEM CASE
Standard Webservice can be Enhanced using BADI implementation to meet customer requirement of Automatic creation of a BPEM Case in the Utilities 360 Tab. Webservice has extendable parameters which are passed back to C4C.