cancel
Showing results for 
Search instead for 
Did you mean: 

Alert class creation

Former Member
0 Kudos

Hi all,

Please send me steps to crete an user defined alert class(e.g alert for solutions taking data from solution database) for CRM IC web client(CRM5.0).

Thanks

Rana

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Koustav Saha ,

3.1.3.5.1 Creating New Class

Procedure

1. Access the activity using one of the following navigation options:

Transaction code SE80

SAP CRM menu Architecture and Technology  ABAP Workbench  Overview  Object Navigator

2. Enter the following data:

Field name User action and values

Object Class / Interface

Class ID YCL_BP_ALERT

3. Press ENTER.

4. In the Create Object dialog box choose Yes.

5. In the Create Class <ID> dialog box enter the following data and choose Save:

Field name User action and values

Class YCL_BP_ALERT

Description SAP Best Practices - ICWeb Alert

Instantiation Public

Usual ABAP Class

Final

6. Choose Save, select a package (e.g., $TMP) and choose Save again.

7. Double-click in the object name of the new class, then choose Display <-> Change.

8. On tab Properties choose button Superclass.

9. Maintain the following value and choose Enter:

Field name User action and values

Superclass CL_BSP_WD_CUSTOM_CONTROLLER

10. On tab Interfaces maintain the following values and choose Enter:

Field name User action and values

Interface IF_CRM_IC_EVENT_LISTENER

Abstract <empty>

Final <empty>

Modeled only <empty>

11. Save your entries.

Defining first method CONSTRUCTOR:

This method necessary to register for the event “Business Partner Confirmed”:

1. Select tab Methods.

2. To create a new entry for method CONSTRUCTOR choose button Create constructor.

3. Double-click on new method entry CONSTRUCTOR.

4. To change the coding choose Display <-> Change.

5. Replace the existing coding with the following:

METHOD CONSTRUCTOR.

DATA: lr_ic_event_srv TYPE REF TO if_crm_ic_event_srv.

super->constructor( ).

  • subscribe to events which should be handled

lr_ic_event_srv = cl_crm_ic_services=>get_event_srv_instance( ).

lr_ic_event_srv->subscribe( event_name = if_crm_ic_events_con=>gc_bpconfirmed

listener = me ).

ENDMETHOD.

6. Save your entries and select a workbench request if necessary.

7. Choose Activate to activate the modified method.

8. Choose Back.

Defining second method IF_CRM_IC_EVENT_LISTENER~HANDLE_EVENT:

The second method IF_CRM_IC_EVENT_LISTENER~HANDLE_EVENT is called when the event BP confirmed is raised. First, the event name is checked, and then the classification of the business partner is selected form the database. For customers with classification “YG” our new event YBP_GoldCustomer is raised (see additional settings in the chapters below).

1. On tab Methods double-click on method IF_CRM_IC_EVENT_LISTENER~HANDLE_EVENT.

2. Replace the existing default coding with the following:

METHOD if_crm_ic_event_listener~handle_event.

DATA: lv_name TYPE string,

lr_bdc TYPE REF TO cl_crm_ic_cucobdc_impl,

lv_bpguid TYPE bu_partner_guid,

lv_classific TYPE crmt_bu_cust_classific,

lr_event TYPE REF TO cl_crm_ic_event,

lr_event_srv TYPE REF TO if_crm_ic_event_srv.

TRY.

lv_name = event->get_name( ).

IF lv_name = if_crm_ic_events_con=>gc_bpconfirmed.

  • Check if business partner is a GOLD customer

lr_bdc ?= cl_crm_ic_services=>contextarea_contr->get_custom_controller( 'CuCoBDC' ).

IF lr_bdc IS BOUND.

  • Get Business Partner GUID

CALL METHOD lr_bdc->get_xpath_property_as_value

EXPORTING

iv_xpath = '//currentCustomer/BP_GUID'

IMPORTING

ev_result = lv_bpguid.

  • Get classification

SELECT SINGLE classific FROM crmm_but_frg0041 INTO lv_classific

WHERE partner_guid = lv_bpguid.

IF lv_classific = 'YG'.

  • Raise new event "Gold Customer"

CREATE OBJECT lr_event.

lr_event->set_name( 'YBP_GoldCustomer' ).

lr_event_srv = cl_crm_ic_services=>get_event_srv_instance( ).

lr_event_srv->raise( lr_event ).

ENDIF.

ENDIF.

ENDIF.

CATCH cx_root.

ENDTRY.

ENDMETHOD.

3. Save your entries and select a workbench request if necessary.

4. Choose Activate to activate the modified method.

5. Choose Back.

Thanks&Regards

VEERA.

Answers (0)