cancel
Showing results for 
Search instead for 
Did you mean: 

Action and Date Profile Question

Former Member
0 Kudos

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:

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

Thanks,

Manish

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

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

Former Member
0 Kudos

Thanks Ritu for this I am sure One of the solutions here will work!!!  You code looks great I will run it past an ABAP developer.

Former Member
0 Kudos

   Hi all thanks for the above suggestion...

i want to just ask if the following is at all possible.

Create a new date called Status Since + 2. (Via Config)

Create a new rule that take Status since date and adds 2 days to it.  Everytime Status Since date is update it re-calculates?   It will make is much easier then to using that date to trigger any actions or alerts...

manish

deepika_chandrasekar
Active Contributor
0 Kudos

Hi Manish,

It always takes updated dates. you can use the above solution.

Regards,

Deepika.

former_member196521
Active Participant
0 Kudos

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-b14448992...

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


deepika_chandrasekar
Active Contributor
0 Kudos

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.