cancel
Showing results for 
Search instead for 
Did you mean: 

fill container for alerts

robert_kunstelj
Active Contributor
0 Kudos

Hi.

I created alert that is triggered via action. The alert now displays only some text that i defined. But now I would like to get in that text also the value of transaction number of task from witch alert was triggered.

I saw that there is the option on alerts to define container (SPRO > CRM > basic functions > alert management > define alert categories) but I don't now how to do it.

I added in container BOR object type BUS2000125 and in text the expression &PROCESS_TYPE.OBJECT_ID&, but looks like that is not enough.

Help needed.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Robert,

Maybe note 821188 might be of use.

Regards,

David

robert_kunstelj
Active Contributor
0 Kudos

Thanks. I've awarded points to your reply.

arunprakash_karuppanan
Active Contributor
0 Kudos

Hi Expert,

I have a similar requirement.

We defined the alert category under SPRO transaction SPRO > CRM >

basic functions > alert management > define alert categories).

I have created BADI Implementation for the alert management. Once the Activity created with status open the alert message will be trigger.

Now the Alert is triggered correctly and able to see the alert message in the webui screen. But the Alert Message is not appearing Completely, now the alert message is appearing like eg. "Alert:

Activity is opened (The triggering application determined you as a recipient)". And we need to display the message eg. Activity 10001 is opened. Please find the attachment for more information.

I also noticed for the similar issue already u201CSAP note 821188u201D is available for the previous release.

Incase any alternative note is available for the CRM 2007 kindly let me know it will help us to fix the issue ASAP. Otherwise kindly let me know how to overcome this issue.

Hope you will consider my request and expecting your reply ASAP.

Thanks and Regards,

Arun Prakash

robert_kunstelj
Active Contributor
0 Kudos

hi. There is no new note that I would know about. However I managed to solved the problem via steps from old note, but had to do quite a coding on Z version of TRIGGER_ALERT method.

This is my code source:

METHOD ZTRIGGER_ALERT .

  DATA: lt_container       TYPE swconttab,
       ls_container       TYPE swcont,
       lv_kind_ref        TYPE crmt_object_kind,
       lv_guid_ref        TYPE crmt_object_guid.
  DATA: lt_head_guids      TYPE crmt_object_guid_tab,
        lt_item_guids      TYPE crmt_object_guid_tab,
        lt_req_obj         TYPE crmt_object_name_tab,
        ls_orderadm_h_ref  TYPE crmt_orderadm_h_wrk,
        lt_orderadm_h_ref  TYPE crmt_orderadm_h_wrkt,
        lv_header_ref      TYPE crmt_object_guid,
        ls_orderadm_i_ref  TYPE crmt_orderadm_i_wrk,
        lt_orderadm_i_ref  TYPE crmt_orderadm_i_wrkt.
  DATA: lv_message         TYPE char80,
        lv_preview         TYPE char1.
  DATA: lv_category        TYPE salrtdcat,
        lt_partner         TYPE crmt_partner_external_wrkt,
        ls_partner         TYPE crmt_partner_external_wrk,
        lt_recipients      TYPE TABLE OF salrtsrcp,
        ls_recipients      LIKE LINE OF lt_recipients,
        lv_guid_32         TYPE sysuuid_c.

  INCLUDE crm_log_states_con.
  INCLUDE crm_mode_con.
  INCLUDE crm_object_names_con.
  INCLUDE crm_object_kinds_con.
  INCLUDE com_partner_pft3.

********************************************************************

* get parameter from reference object
  CALL METHOD me->get_ref_object
    EXPORTING
      io_appl_object = io_appl_object
      ip_action      = ip_action
      ip_preview     = ip_preview
      ii_container   = ii_container
    IMPORTING
      ev_guid_ref    = lv_guid_ref
      ev_kind_ref    = lv_kind_ref
      et_container   = lt_container
      ev_preview     = lv_preview.

********************************************************************

* not relevant iv preview is active
  IF NOT lv_preview IS INITIAL.
    MESSAGE s007(crm_action).
    EXIT.
  ENDIF.

********************************************************************

* fill guid of the source document
  REFRESH: lt_head_guids, lt_item_guids.
  IF lv_kind_ref EQ gc_object_kind-orderadm_h.
    INSERT lv_guid_ref INTO TABLE lt_head_guids.
  ELSEIF lv_kind_ref EQ gc_object_kind-orderadm_i.
    INSERT lv_guid_ref INTO TABLE lt_item_guids.
  ENDIF.

* fill requested object
  INSERT gc_object_name-orderadm_h INTO TABLE lt_req_obj.
  INSERT gc_object_name-orderadm_i INTO TABLE lt_req_obj.
  INSERT gc_object_name-partner    INTO TABLE lt_req_obj.


* read relevant itmes of the source document
  CALL FUNCTION 'CRM_ORDER_READ'
    EXPORTING
      it_header_guid       = lt_head_guids
      it_item_guid         = lt_item_guids
      iv_only_spec_items   = true
      it_requested_objects = lt_req_obj
    IMPORTING
      et_orderadm_h        = lt_orderadm_h_ref
      et_orderadm_i        = lt_orderadm_i_ref
      et_partner           = lt_partner
    EXCEPTIONS
      document_not_found   = 1
      error_occurred       = 2
      document_locked      = 3
      no_change_authority  = 4
      no_display_authority = 5
      OTHERS               = 6.
  IF sy-subrc NE 0.
*   write message into ppf-log
    CALL METHOD cl_log_ppf=>add_message
      EXPORTING
        ip_problemclass = '2'
        ip_handle       = ip_application_log.
*   set return status
    rp_status = '2'.
    EXIT.
  ENDIF.

  IF lv_kind_ref EQ gc_object_kind-orderadm_h.
    lv_header_ref = lv_guid_ref.
  ELSEIF lv_kind_ref EQ gc_object_kind-orderadm_i.
    READ TABLE lt_orderadm_i_ref INTO ls_orderadm_i_ref INDEX 1.
    lv_header_ref = ls_orderadm_i_ref-header.
*   get business object to built URL
    CALL FUNCTION 'CRM_ORDERADM_H_READ_OW'
      EXPORTING
        iv_orderadm_h_guid     = lv_header_ref
      IMPORTING
        ev_object_type         = ls_orderadm_h_ref-object_type
        ev_logical_system      = ls_orderadm_h_ref-logical_system
      EXCEPTIONS
        admin_header_not_found = 1
        OTHERS                 = 2.
    IF sy-subrc EQ 0.
      ls_orderadm_h_ref-guid = lv_header_ref.
      INSERT ls_orderadm_h_ref INTO TABLE lt_orderadm_h_ref.
    ELSE.
*     write message into ppf-log
      CALL METHOD cl_log_ppf=>add_message
        EXPORTING
          ip_problemclass = '2'
          ip_handle       = ip_application_log.
*     set return status
      rp_status = '2'.
      EXIT.
    ENDIF.
  ENDIF.

********************************************************************

* fill alert category
  READ TABLE lt_container INTO ls_container
       WITH KEY element = 'CATEGORY'.
  IF sy-subrc EQ 0.
    lv_category = ls_container-value.
  ENDIF.

* check mandatory fields
  IF lv_category IS INITIAL.
*   write message into ppf-log
    MESSAGE ID 'CRM_ACTION' TYPE 'E' NUMBER 004
          WITH 'CATEGORY' INTO lv_message.
    CALL METHOD cl_log_ppf=>add_message
      EXPORTING
        ip_problemclass = '2'
        ip_handle       = ip_application_log.
*    set return status
    rp_status = '2'.
    EXIT.
  ENDIF.

********************************************************************

* now filter the employees.
  LOOP AT lt_partner INTO ls_partner
       WHERE partner_pft EQ gc_partner_pft-employee.
    CLEAR: ls_recipients.
    CALL FUNCTION 'BP_CENTRALPERSON_GET'
      EXPORTING
        iv_bu_partner_guid  = ls_partner-bp_partner_guid
      IMPORTING
        ev_username         = ls_recipients-uname
      EXCEPTIONS
        no_central_person   = 1
        no_business_partner = 2
        no_id               = 3
        OTHERS              = 4.
    IF sy-subrc EQ 0 AND
      ls_recipients-uname IS NOT INITIAL.
      INSERT ls_recipients INTO TABLE lt_recipients.
    ENDIF.
  ENDLOOP.

* don't send the alert twice to the same user
  SORT lt_recipients BY uname.
  DELETE ADJACENT DUPLICATES FROM lt_recipients COMPARING uname.

* supply key information
  READ TABLE lt_orderadm_h_ref INTO ls_orderadm_h_ref INDEX 1.
  IF sy-subrc EQ 0.

    lv_guid_32 = ls_orderadm_h_ref-guid.
    CALL FUNCTION 'SWC_ELEMENT_SET'
      EXPORTING
        element   = 'OBJKEY_GUID'
        field     = lv_guid_32
      TABLES
        container = lt_container
      EXCEPTIONS
        OTHERS    = 1.

    CALL FUNCTION 'SWC_ELEMENT_SET'
      EXPORTING
        element   = 'OBJKEY_BOR_OBJECT'
        field     = lv_guid_32
      TABLES
        container = lt_container
      EXCEPTIONS
        OTHERS    = 1.

    CALL FUNCTION 'SWC_ELEMENT_SET'
      EXPORTING
        element   = 'OBJKEY_BOR_OBJECT_TYPE'
        field     = ls_orderadm_h_ref-object_type
      TABLES
        container = lt_container
      EXCEPTIONS
        OTHERS    = 1.

    CALL FUNCTION 'SWC_ELEMENT_SET'
      EXPORTING
        element   = 'OBJKEY_LOGICAL_SYSTEM'
        field     = ls_orderadm_h_ref-logical_system
      TABLES
        container = lt_container
      EXCEPTIONS
        OTHERS    = 1.

  ENDIF.

********************************************************************

* trigger alert
*{   INSERT         CRDK903440                                        1
data: object_id(10) type c.
data: lt_date_wrkt type CRMT_DATES_WRKT.
data: wa_date_wrk type CRMT_DATES_WRK.
data: lt_date type CRMT_DATE_WRKT.
data: wa_date type CRMT_DATE_WRK.
data: ZTASK_PLAN type SC_DATEFRO.
data: ZTASK_REQUIR type SC_DATEFRO.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
  EXPORTING
    input         = ls_orderadm_h_ref-object_id
 IMPORTING
   OUTPUT        = object_id.


* document number
CALL FUNCTION 'SWC_ELEMENT_SET'
  EXPORTING
    element             = 'OBJECT_ID'
    field               = object_id
  tables
    container           = lt_container
  EXCEPTIONS
    TYPE_CONFLICT       = 1
    OTHERS              = 2.

*document description
CALL FUNCTION 'SWC_ELEMENT_SET'
  EXPORTING
    element             = 'OBJECT_DESCRIPTION'
    field               = ls_orderadm_h_ref-description
  tables
    container           = lt_container
  EXCEPTIONS
    TYPE_CONFLICT       = 1
    OTHERS              = 2.

*document dates
refresh lt_date_wrkt.
CALL FUNCTION 'CRM_DATES_READ_DB'
  EXPORTING
    IV_REF_GUID                         = ls_orderadm_h_ref-guid
    IV_REF_KIND                         = 'A'
  IMPORTING
    ET_DATE_WRKT                        = lt_date_wrkt
  EXCEPTIONS
    PARAMETER_ERROR                     = 1
    ENTRY_DOES_NOT_EXIST                = 2
    AT_LEAST_ONE_RECORD_NOT_FOUND       = 3
    OTHERS                              = 4.

refresh lt_date.
CALL FUNCTION 'CRM_DATES_READ_SINGLE_OW'
  EXPORTING
    iv_ref_guid                = ls_orderadm_h_ref-guid
    iv_ref_kind                = 'A'
*   IS_LOGICAL_DATE_KEY        =
  IMPORTING
*   ES_DATE_WRK                =
   ET_DATE_WRK                = lt_date
  EXCEPTIONS
    LINK_DOES_NOT_EXIST        = 1
    ENTRY_DOES_NOT_EXIST       = 2
    OTHERS                     = 3.

clear wa_date.
read table lt_date
with key APPT_TYPE = 'ORDERPLANNED'
into wa_date.
ZTASK_PLAN = wa_date-date_from.

if wa_date is initial.
clear wa_date_wrk.
read table lt_date_wrkt
with key APPT_TYPE = 'ORDERPLANNED'
into wa_date_wrk.
ZTASK_PLAN = wa_date_wrk-date_from.
endif.


clear wa_date.
read table lt_date
with key APPT_TYPE = 'ZTASK_REQUIR'
into wa_date.
ZTASK_REQUIR = wa_date-date_from.

if wa_date is initial.
clear wa_date_wrk.
read table lt_date_wrkt
with key APPT_TYPE = 'ZTASK_REQUIR'
into wa_date_wrk.
ZTASK_REQUIR = wa_date_wrk-date_from.
endif.

CALL FUNCTION 'SWC_ELEMENT_SET'
  EXPORTING
    element             = 'ORDERPLANNED'
    field               = ZTASK_PLAN
  tables
    container           = lt_container
  EXCEPTIONS
    TYPE_CONFLICT       = 1
    OTHERS              = 2.

CALL FUNCTION 'SWC_ELEMENT_SET'
  EXPORTING
    element             = 'ZTASK_REQUIR'
    field               = ZTASK_REQUIR
  tables
    container           = lt_container
  EXCEPTIONS
    TYPE_CONFLICT       = 1
    OTHERS              = 2.

*}   INSERT
  CALL FUNCTION 'SALRT_CREATE_API'
    EXPORTING
      ip_category            = lv_category
      ip_wait_on_commit      = false
    TABLES
      it_recipients          = lt_recipients
      it_container           = lt_container
    EXCEPTIONS
      alert_category_unknown = 1
      alert_no_recipients    = 2
      alert_error_unknown    = 3
      destination_undefined  = 4
      communication_failure  = 5
      system_failure         = 6
      OTHERS                 = 7.

  IF sy-subrc NE 0.
*   write message into ppf-log
    CALL METHOD cl_log_ppf=>add_message
      EXPORTING
        ip_problemclass = '2'
        ip_handle       = ip_application_log.
*   set return status
    rp_status = '2'.
    EXIT.
  ENDIF.

********************************************************************

* register new document for saving
  CALL METHOD me->register_for_save
    EXPORTING
      iv_source_header_guid = lv_header_ref
      iv_recursive_det      = false
      ii_container          = ii_container
      ip_application_log    = ip_application_log
    IMPORTING
      rp_status             = rp_status.

ENDMETHOD.                    "

arunprakash_karuppanan
Active Contributor
0 Kudos

Hi,

Thanks for your quick reply. Now the object Id is displayed in the alert, now I need Status also should appear in the alert message. May I know how to fix this issue.

Thanks and Regards,

Arun Prakash.

robert_kunstelj
Active Contributor
0 Kudos

You can look at my code how iz for example OBJECT_ID defined to be filled in container. The same you should then do for field status.

gregorw
Active Contributor
0 Kudos

Hi Robert,

does your coding provide a link to the business object when you open the alert details? I'm in a discussion in the Thread: already and haven't found a solution to provide that link functionality as it was possible in CRM 4.0 and 5.0 PC-UI using the Portal UWL or the Alert iView.

Best regards

Gregor

robert_kunstelj
Active Contributor
0 Kudos

Sorry for the late reply, but I was very busy. Yes, the link from alert to activity is generated, but this doesn't have to do with my coding but is the standard functionality. We have sp4 implemented.

gregorw
Active Contributor
0 Kudos

Hi Robert,

thanks for your reply. As you can see in the thread I've linked above I was able to solve the problem after patching from SP1 to SP4.

Best regards

Gregor

Former Member
0 Kudos

Hi Robert,

I need to display alerts in CRM IC 2007......when the BP is confirmed, the alert is supposed to display one of its long text.

How do I do this using the above discussed procedures?

Regards

Vicky

Former Member
0 Kudos

Hi Robert

I have tried already what you suggested, but it does not work.

Do you ghave any idea on how may i "trigger" tha debugger?

I am using the standard way to debug from CRM 2007 (external debugger)

down to IF_EX_EXEC_METHODCALL_PPF~EXECUTE but i get no result.

Any kind of help will be appreciated.

regards,

marios

robert_kunstelj
Active Contributor
0 Kudos

Sory for late reply, but I'm in the middle of the live-going project.

The aboved procedure just shows how to provide container data for alert. So in your case you should modify the container in that way that the method would provide long text of BP. Then you can use this in alert.

I don't know what you mean with "confirm BP", but you have to create action on whateever with which you than call method ZTRIGGER_ALERT with paramether "your alert category".

robert_kunstelj
Active Contributor
0 Kudos

Put the brakepoint in ZTRIGGER_ALERT method. But the problem is probably that you don't trigger this method. Check if you have set the actions which call this method properly.

gregorw
Active Contributor
0 Kudos

Hi Vicky,

I think you're mixing up Alerts displayed in the IC-Web Client Header area with the Alerts sent to the Alert Inbox.

Best regards

Gregor

Former Member
0 Kudos

Hi Gregor,

You are right, I mixed it up. I'll open a new thread for Alerts in IC WebClient.

Thanks

Vicky

Former Member
0 Kudos

Hi Robert,

You are right. This is our problem. Let me list the steps we have been through.

1. Created a badi for definition EXEC_METHODCALL_PPF (with method ZMKT_ALERT_CREATE)

2. Defined the alert category: SPRO>CRM>basic functions>alert management>define alert categories

3. Defined the method under CRM -> Basic Functions -> Actions -> Actions in the Transaction -> Change Actions and Conditions. Under Processing Types -> Settings Method Call.

We should mention that we are trying to trigger alert for category CRM_CAMPAIGN_NOT_RELEASED!

Is there something we miss? (could we send you our steps in more detail?)

Thanking you in advance,

Best regards,

Marios

robert_kunstelj
Active Contributor
0 Kudos

Did you create your method in CL_ACTION_EXECUTE class as copy of TRIGGER_ALERT method? I don't know if it works also for other classes?

Also check if you defined all settings in action profile for the method you are calling - type of alert, class...

Answers (0)