Steps to enhance the standard Business Agreement class
Configuration Steps for Business Agreement class enhancement
This document provides a detailed explanation of Business Agreement class (BUAG class), its usage in CRM Front Office process and how to enhance it for a particular customer requirement.
Business Agreement is slimmer version of its counterpart Contract Account in ECC. It does not have as much accounting information as with the Contract Account. It groups together all of a business partner’s contracts to which the same payment and dunning data applies. A Business Partner can have one or more Contract Accounts, for example if the Business Partner owns multiple properties, each will have their own Contract Account. When this is replicated to ECC it creates a Contract Account as shown in below diagram:
Figure 1 Business Agreement Vs Contract Account
2. Business requirement
Currently in the SAP standard Web IC the Business Agreement class is defaulted and the agent doesn’t have the option of changing it. Ideally we should be able to give an option to the agent for choosing the Business Agreement class at the time of creation of the Business Agreement.
The agents are required to create Business Agreements with different Business Agreement classes in order to complete the Contract creation from the Contract Management process and in the standard system we don’t have the capability of providing the free selection of the Business Agreement classes in the Web IC.
Creation of Business Agreement is an important process for completing the Contract Management process and agents perform move-in for customers in huge volumes. So enhancing the Business Agreement (BUAG) class is very critical.
Agents need to choose the Business Agreement class for creating different types of Business Agreements. Based on the BUAG class the category of the customers would be determined.
Current process (SAP standard)
In Web IC the agent has an option of creating the Business Agreement (as shown below) and the Business Agreement class is determined and defaulted in BUAG create screen.
Figure 2 SAP standard screen for BUAG creation
Process after the enhancement
Agent has already identified the BP/Premise and now he/she wants to create a new Business Agreement. Agent clicks on ‘More’ button to create a new Business Agreement (as shown below). We need to list down all Business Agreement classes (maintained in SAP standard configuration table) in a dropdown box. Agent can select one BUAG class at a time and system will navigate to create BUAG screen.
In create BUAG screen the value of the Business Agreement class should be defaulted with the BUAG class value chosen in dropdown:
Below flow diagram explains the steps to be followed for BUAG creation after the enhancement done:
3. Steps to enhance the standard Business Agreement class
This section provides the detailed description of all the steps required to enhance the BUAG class in Web IC (Front Office process). Standard UI component IUICMD will be enhanced to accommodate this requirement. ZABC_ENH_SET is the enhancement set to be used; all the view/component enhancements will be done under this enhancement set.
Implementation Class CL_IUICMD_DETAILACCOUNT_IMPL
EH_ONCREATEBUAGCONSUMP Method to handle the create BUAG event for ABC01 buag class.
EH_ONCREATEBUAGDAMAGE Method to handle the create BUAG event for ABC02 buag class.
EH_ONCREATEBUAGNONCONSUMP Method to handle the create BUAG event for ABC03 buag class.
GET_LAYOUT_BUTTONS Method to prepare the buttons in toolbar (for custom buttons).
DO_HANDLE_EVENT Method to handle and trigger the events (standard/custom).
Below table shows the Custom controller class and its method. It will be redefined to handle the CREATE BUAG requirement with different BUAG classes.
Implementation Class CL_IUICMD_CUCOMD_IMPL
CREATE_BUAG Method to create Business Agreement
Preparing dropdown BUAG create buttons
Redefine below mentioned method to add code to prepare the toolbar (More option) with custom buttons:
Write below logic in the above redefined method to add the 3 custom buttons in ‘More’ option. Add ‘Create Consumption Business Agreement’, Create Non-Consumption Business Agreement’ and ‘Create Damage Claim Business Agreement’ buttons.
Capturing events raised and trigger the handler methods
DO_HANLE_EVENT method of implementation class need to be redefined and below code should be added to capture the events raised (by custom buttons) and trigger the corresponding handler methods:
Add the event handler for CreateBuAgNonConsump event as well in the same method. This will capture the event raised by these BuAg create buttons.
Handling Create BuAg event in DetailAccount view for custom buttons
As mentioned in above section we have added 3 new custom buttons to create BuAg with different classes i.e. Consumption – ABC01, Damage Claim – ABC04, Non-Consumption – ABC03. View IUICMD/DetailAccount of BSP component IUICMD will be enhanced and 3 new event handler methods will be created to capture the event raised by above custom buttons. Create EH_ONCREATEBUAGCONSUMP, EH_ONCREATEBUAGDAMAGE and EH_ONCREATEBUAGNONCONSUMP methods in implementation Class ZCL_IUICMD_DETAILACCOUNT_IMPL. Below screen shot represents the view; it’s implementation class and event handler method to be redefined:
Write below logic in above highlighted methods; set different BuAg class value in each method (in 2nd step):
1. Determine the current account by calling the below piece of code:
2. Get the enhanced CuCo instance and set the value node with the BUAG CLASS value in case of Create Consumption Business Agreement option fill ABC01 and in case of Create Damage Claim Business Create option fill ABC04 and if it is Non-Consumption type of Buag then fill ABC03.
* Get the enhanced CuCo instance. lref_cucomd ?= me->get_custom_controller( lc_cuco_cust ).
* Get the Buag Class entity - value node. lref_entity ?= lref_cucomd->ztyped_context->zcnbuagclass->collection_wrapper->get_current( ).
* Set the Buag Class entity with buag calss value - Consumption - ABC01. CALLMETHOD lref_entity->if_bol_bo_property_access~set_property EXPORTING iv_attr_name = lc_class_attrib_name iv_value = lc_consump_class.
3. Call method IREF_CUCOMD->CREATE_BUAG( ) with the above fetched BP ID (in step 5) and get the entity back. This will create the business agreement new entity instance by calling the CREATE_BUAG method from the custom controller of the component by passing the partner number and give the same back in a reference variable.
4. Search if the Current Business Partner has had any Business Agreements in the past or if this is the first one. If the Recently created Business Agreement is the First then mark the attribute ‘BUAG_DEFAULT’ as ‘X’.
5. Get the collection wrapper of the context node BUAG by using below syntax:
Add the newly created BUAG entity (in step 7) to the collection wrapper:
LR_DATA_COLLECTION->ADD( LR_BUAG_ENTITY ).
LR_NAV_SRV = CL_CRM_UI_NAVIGATION_SERVICE=>GET_INSTANCE( ME ).
8. Call NAVIGATE_DYNAMICALLY( ) method with LR_DATA_COLLECTION (collection wrapper) filled in above step. This will start the navigation from the popup view to standard BUAG creation view.
9. Get the window controller instance from the view manager instance and call method CALL_OUTBOUND_PLUG( ) with ‘LEAVE’ outbound plug name. This will close the current popup.
Enhancing CREATE_BUAG method of custom controller
As mentioned in the below screen shot we need to create one value node named ZCNBUAGCLASS with one attribute BUAG_CLASS in it. The value for the value node attribute will be set from event handler methods of all the above mentioned 3 buttons (BuAg creation buttons) and it will be used in CREATE_BUAG method of custom controller.
Below screen shot represents the custom controller implementation class in IUICMD component. The implementation class (marked below) contains the main method to create Business Agreement (i.e. CREATE_BUAG).
Redefine and write below logic in CREATE_BUAG method:
1. Comment the call to CREATE_BUAG( ) method of super class.
2. Copy the logic from CREATE_BUAG method of super class method and paste it in redefined CREATE_BUAG( ) method.
3. Referring to super class BUAG_CREATE( ) method logic : In the row number 44 there is a method call to fetch RISK_CLASS after this code and a method call GET_PROPERTY_AS_VALUE( ) with ‘BUAG_CLASS’ as attribute name and get the buag class value (we have set this value in event handler methods in above steps).
4. In line number 58 CHANNEL is filled to the local structure variable to create BUAG entity. After this we can add our code to fill the BUAG_CLASS field of local structure ls_buag_create from the above fetched BUAG class value in step 3.
5. Other steps will be as it is copied from super class BUAG_CREATE( ) method which will handle the creation of buag entity.
4. Configuration Steps for Business Agreement class enhancement
This section provides the details of all the necessary configuration steps required to complete the BUAG class enhancement.
Configuration 1: CRMC_BUAG_CLAS_T is a SAP standard configuration table which is used to store the BUAG class and its attributes (e.g., Description etc); Dropdown field in Web IC screen (under More option) should contain all the BUAG class values maintained in this table.
Configuration 2: Maintain all necessary configurations for the Business Agreement class in the below mentioned SPRO path:
Configuration 2(a): Allocate Business Agreement class
We will need to maintain an entry for each BUAG class (i.e. ABC01/ABC02/ABC03) with unique Risk class value as shown in below screen shot.
Note: In this configuration the combination of channel, usage and risk class is the candidate key to determine the BUAG Agreement class.
Below configuration is related to allocation of ‘payment-relevant parameters’ to new Business Agreement.
For each risk class we will need to maintain the payment relevant parameter as shown in below screen shot:
This document will be very much useful in any CRM Utility project because enhancing SAP standard BUAG is a very common requirement across all the Utility projects. CRM Web IC developer can quickly do the required enhancements by following the above mentioned development/configuration steps.