cancel
Showing results for 
Search instead for 
Did you mean: 

Email on Status Change

Former Member
0 Kudos

Hi Everyone,

has anyone come up with a starting condition that will send an email when the status is changed? I want one that only fires once until the status is changed to something else. It should be able to fire an infinite amount of times until the message is set to Confirmed.

I don't want one that only fires once when changed from New to In Process, and then doesn't work again if the status is changed from Proposed Solution back to In Process. And I don't want one that sends an email every time the Save button is clicked. These two examples are currently the problems I am trying to get around.

thanks,

Jason

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Jason,

I hope you must have implemented the required configuration as per SAP Note 691303. In the attached tutor, you will find the configuration for E0002 i.e. mail to be sent when the status is changed to In process.

You have to repeat the configuration for various values i.e. E0003, E0004 and so on.

Hope this will be helpful to you.

Please reward points suitably.

Regards,

Naresh.

Former Member
0 Kudos

Hi Naresh,

Thanks for your response. Unfortunately, that note results in the situation I mentioned I do not want.

"I don't want one that only fires once when changed from New to In Process, and then doesn't work again if the status is changed from Proposed Solution back to In Process. "

Any other ideas?

regards,

Jason

DoloresCorrea
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Jason,

I can not test this just now but if you select Action Merging "Max. 1 Unprocessed Action for Each Action Definition", every time you put the message "In process" a mail will be send, but also if you change the message processor being in this "in process" status.

However I did not check if this action is sending mails every time you save the message even if you don´t make any change.

Did you test this?

Thanks a lot,

Dolores

Former Member
0 Kudos

Hi Dolores,

thanks for the idea. Unfortunately setting it up this way results in the other result I am trying to avoid:

"And I don't want one that sends an email every time the Save button is clicked."

The only thing I have seen in the forums is changing the ABAP code to look at the previous status and/or previous Message Processor and only send the email if the value is different.

regards,

Jason

Former Member
0 Kudos

Hi Jason,

this can only be achieved with the configuration described in NOTE 865619.

However, the ABAP coding in this note will only work for system status, not user status. You will have to modify the code a little to make it work for the user status also. If you have trouble with that, I can post the coding here if necessary.

Regards,

Thomas

Former Member
0 Kudos

Hello Thomas,

I would be gratefull if you could post the code for getting it working with User Status. This is exactly what I was looking for, I have been unsuccesfull with getting the code form SAP note 865619 working.

I was under the impression that the code specified in the note was taking the user status into account. But maybe that is why it is not working for me.

Thanks....

Message was edited by:

Guido Jacobs

Former Member
0 Kudos

Hello Guido,

here's the code i'm using:

METHOD if_ex_container_ppf~modify_container.

DATA: ls_object TYPE sibflporb,

lt_value TYPE swconttab,

ls_value TYPE swcont,

lv_return TYPE sy-subrc,

lv_guid TYPE crmt_object_guid,

lt_status TYPE crmt_status_wrkt,

ls_cont_status TYPE j_status,

lv_switch TYPE char1 VALUE 'X'.

CHECK: ci_container IS BOUND,

ci_parameter IS BOUND.

  • ------- Get the GUID ----------

CALL METHOD ci_container->get_value

EXPORTING

element_name = 'BUSINESSOBJECT'

IMPORTING

data = ls_object.

lv_guid = ls_object-instid.

CALL METHOD ci_parameter->get_values

RECEIVING

values = lt_value.

  • ------- Get the status --------

CALL FUNCTION 'CRM_STATUS_READ_OW'

EXPORTING

iv_guid = lv_guid

  • IT_GUID =

  • IV_ONLY_ACTIVE = TRUE

IMPORTING

et_status_wrk = lt_status

  • ES_CURRENT_USER_STATUS =

  • ES_CURRENT_SYSTEM_STATUS =

EXCEPTIONS

not_found = 1

OTHERS = 2.

CHECK sy-subrc = 0.

  • -------- Check if status is newly set ---------------

LOOP AT lt_value INTO ls_value

WHERE element = 'STATUS_TABLE'.

lv_switch = 'X'.

ls_cont_status = ls_value-value.

READ TABLE lt_status TRANSPORTING NO FIELDS

WITH KEY status = ls_cont_status

active = 'X'

active_old = ' '.

IF sy-subrc NE 0.

CLEAR lv_switch.

ELSE.

exit.

ENDIF.

ENDLOOP.

IF sy-subrc NE 0.

CLEAR lv_switch.

ENDIF.

  • --------- Set the parameter -----------

IF lv_switch IS NOT INITIAL.

CALL METHOD ci_parameter->set_value

EXPORTING

element_name = 'STATUS_IS_NEW'

data = 'X'

RECEIVING

retcode = lv_return.

ENDIF.

ENDMETHOD.

Hope this helps,

Thomas

Former Member
0 Kudos

Hello Thomas,

I have implemented the code, and it is working for me! Sorry I did not respond earlier, but I did had the time to test it.

Thanks!

Former Member
0 Kudos

Hello Thomas,

Could this BADI be used for email notifications in Charm scenario?

I think yes, but I have some problems with it

Thank you in advance,

Natalia

Answers (1)

Answers (1)

Former Member
0 Kudos

thanks this worked perfectly

Former Member
0 Kudos

Do you use the same BADI for email notifications in Charm scenario?

I have some problems with it? What about you?

Thank you in advance,

Natalia

Former Member
0 Kudos

Hi Jason,

Sorry to rake up this thread after so long. Will it be possible for you to spend some time in posting elaborately for me (being a non-ABAPer).

If you can spare time, I will post a new thread and would certainly like to acknowledge your help.

Regards,

Srini