Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

email notification

Former Member
0 Likes
818

My program is sorting to whom I have to send the mails that the contract is expiring or below 10% so sending mail is delt with functional people

Rt now my program , whenever it is run it is taking 90% reached contracts and is giving contract NO and details (to whom to send emails)

But what I want to do is

If 90% is reached and email is sent once No more emails are required This is the first condition..

And if the contract is renewed by the contract creator then it will be less than 90% so again when it reaches 90% I want the details to display in the output so that they can send email notification...

My thinking is I'm trying to create a a flag and keep the flag when it receives an email and when renewed and is less than 90% it must remove the flag..so that when the program again reaches 90% the contract creator must be emailed.

can anyone suggest me whether my thinking is correct or not if so ca you guide me how to proceed.

Thanks

Hema.

7 REPLIES 7
Read only

Former Member
0 Likes
767

hi Hema,

You can achieve this using multiple options.

<u><b>option 1</b></u>

you can write the logic as mentioned in your program to read the contract;

if contract >= 90%.
        contract_flag = 'X'. mail_flag = 'X'.
else.
       clear contract_flag.
endif.
if contract_flag = 'X' and mail_flag = 'X'. 
        perform send_mail. 
        clear mail_flag .
endif.

<b>But in this case, your program should be scheduled to run periodically in background.</b>

<u><b>Option2</b></u>

create change documents for the contract field.

trigger workflow ->with start condition contract >= 90%

send notification mail. (you can consult with a Workflow consultant on this).

hope this helps,

Sajan Joseph.

Read only

0 Likes
767

.......

Message was edited by:

abap

Read only

Clemenss
Active Contributor
0 Likes
767

your thinking is correct. For a nice and clean solution you should create this flag as an addition to the contract data that can be handled using a BAPI (with extension).

Your check program should run from time to time in background, set the flag via BAPI if the mail should be sent. This will lock the contract for a moment. If this is not possible, someone is just changing the contract - check again later.

In the contract handling itself you could populate a userexit to remove the flag if renewed is less than 90%.

Regards,

Clemens

Read only

Former Member
0 Likes
767

I used a regular program no bapi and userexit the first condition to send emails only once is achieved (emails in the sense the details to whom to send emails)but when renewed the email (details to whom to sent) are not displayed .

I created a field and made it as a flag if 90% reached and email is received flag is set if flag is set no emails

now when renewed its not working

Can you suggest me......

Read only

Clemenss
Active Contributor
0 Likes
767

Hi abap,

both flags must be cleared in the renewal process.

Regards,

Clemens

Read only

Former Member
0 Likes
767

I wrote the following code but it is not working can anyone correct my code....

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

select single zlimit into l_zlimit from zcontractwflow

where ebeln = tb_contract-ebeln.

if L_zlimit = 'x'.

else.

update zcontractwflow

set zlimit = 'x'

where ebeln = tb_conhdr-ebeln "(for header items)

and ebeln = tb_conitm-ebeln. "(for line items)

perform f_create_event_for_workflow using x_objkey c_eventid

changing x_eventid.

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

select single zlimit into l_zlimit from zcontractwflow

where ebeln = tb_contract-ebeln.

if l_menge eq p_conitm-ktmng and p_contype eq c_m

and l_zlimit eq 'X'.

update zcontractwflow set zlimit = ' '.

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

select single zlimit into l_zlimit from zcontractwflow

where ebeln = tb_conhdr-ebeln.

if sy-subrc = 0.

if g_netwr > tb_conhdr-ktwrt and l_contract eq c_w

and l_zlimit eq space.

update zcontractwflow set zlimit = 'X'

Read only

Former Member
0 Likes
767

Hi,

Use the where condition in the UPDATE stmts always. This is a best practice.

Check for ='X' (capitals) and not = 'x'.

Regards

Subramanian