Skip to Content
avatar image
Former Member

Action and Date Profile Question

REQUIREMENT:  Trigger and E-mail/Alert if the Lead Status = New and Status Since is already over 2 days old.

Problem: May need to use Date profile to configure Milestone?  No idea how to create this.

Read the following blog:

Actions in SAP CRM Part 2: Action conditions and execution

Very Helpful but creating this date profile/type milestone seems diffucult please help.

Thanks,

Manish

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Jan 16, 2015 at 12:20 PM

    Hi Manish,

    The action profile will trigger email only when you do some change in that lead again. For eg. you change the status , then the action profile will check schedule and start conditions and will trigger email accordingly.

    The implementation for this is as follows:

    1. Implement badi EVAL_SCHEDCOND_PPF and write below code :

    DATA: lv_object TYPE REF TO cl_doc_crm_order,

               lv_guid TYPE crmt_object_guid,

               lv_status_profile TYPE jsto-stsma.

         ep_rc = 4.

         TRY.

             lv_object ?= io_context->appl.

             lv_guid = lv_object->get_crm_obj_guid( ).

           CATCH cx_root.

             RETURN.

         ENDTRY.

         CALL FUNCTION 'CRM_STATUS_READ'

           EXPORTING

             objnr            = lv_guid

           IMPORTING

             stsma            = lv_status_profile

           EXCEPTIONS

             object_not_found = 1

             OTHERS           = 2.

         IF sy-subrc = 0.

           IF lv_status_profile <> 'ZSTATUSPROF'.

             ep_rc = 4.

           ELSE.

             ep_rc = 0.

           ENDIF.

         ENDIF.


    The above code will schedule action only when a valid status profile is linked to your lead.


    2. Implement badi EVAL_STARTCOND_PPF and write below code.


    DATA: lv_object TYPE REF TO cl_doc_crm_order,

            lv_guid TYPE crmt_object_guid,

            lt_status TYPE TABLE OF jstat,

            lv_status_profile TYPE jsto-stsma,

            ls_history TYPE crm_jcds,

            lv_date TYPE sy-datum,

            lv_status TYPE j_status VALUE 'E0001'.

         ep_rc = 4.

         TRY.

             lv_object ?= io_context->appl.

           CATCH cx_root.

         ENDTRY.

         lv_guid = lv_object->get_crm_obj_guid( ).

         CALL FUNCTION 'CRM_STATUS_READ'

           EXPORTING

             objnr            = lv_guid

             only_active      = 'X'

           IMPORTING

             stsma            = lv_status_profile

           TABLES

             status           = lt_status

           EXCEPTIONS

             object_not_found = 1

             OTHERS           = 2.

         IF sy-subrc = 0.

           IF lv_status_profile = ''ZSTATUSPROF'.

             READ TABLE lt_status WITH KEY stat = lv_status TRANSPORTING NO FIELDS.

             IF sy-subrc = 4.

               ep_rc = 4.

             ELSE.

               SELECT SINGLE * FROM crm_jcds INTO ls_history WHERE objnr = lv_guid AND stat = lv_status AND inact = '' AND chind = 'I'.

               IF sy-subrc = 0.

                 lv_date = sy-datum - 2.

                 IF ls_history-udate <= lv_date.

                   ep_rc = 0.

                 ELSE.

                   ep_rc = 4.

                 ENDIF.

               ELSE.

                 ep_rc = 4.

               ENDIF.

             ENDIF.

           ELSE.

             ep_rc = 4.

           ENDIF.

         ENDIF.


    The above code will check whether the status is E0001 is 2 days old.


    3. Implement badi EXEC_METHODCALL_PPF to send email.

    4. Mention all the implementations while creating action profile.


    After the above 4 steps, email will be triggered whenever the lead is processed after 2 days of inactivity.


    I suggest you to use a background job instead of Action profile. Schedule the job for daily evening. The job will check all lead's status and date when it was set and will trigger the e-mail if date is 2 days old.


    Thanks,

    Ritu

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 13, 2015 at 06:25 AM

    Hi Manish,

    Chech the Date management.

    First you need to created date rule and date type

    When you create date type choose date profile and milestone

    Then next choose date profile. in your date profile maintain your date rule and date types

    choose your date type and provide which date rule should be used and other details

    Choose your date type and give screen area

    This date profile should be used for your transaction.

    Regards,

    Deepika.

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 13, 2015 at 09:08 AM

    Hi Manish,

    You need to use action Profile to meet the requirement, In the Action Profile look at the option trigger Alert, check the link below

    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/003a26d0-5ed4-2d10-a793-b144489925dd?QuickLink=index&overridelayout=true&49478023721126

    Also when you define the action definition for the trigger alert action, use the rule type as BADI Condition

    You need to take the help of the technical consultant and the logic needs to be written in the BADI Condition, which would be assigned in the action definition, the action definition would be assigned to action profile, the action profile needs to be assigned to the lead transaction type

    Kind Regards

    Atul


    Add comment
    10|10000 characters needed characters exceeded