03-07-2007 10:03 AM
Hi,
I need some help from experts in this forum.
I use CL_BCS to send email if a certain condition is met inside a customer exit.
This exit is called before a confirmation dialog pop up asking whether we want to save or cancel.
I did not put commit work statement in this exit since it will commit all database update even though the transaction can still be canceled. Email will also be sent if the transaction is save. Hence, I'm relying on commit statement that come from the transaction itself.
However, this logic has create one problem for me.
If user hit cancel in the confirmation dialog that pop up after the exit is called, no commit will be executed. Hence, no email will be sent.
The problem is when the user change the data and re-save the data, there will be 2 email sent. One email come from the save action from the user and the other come from previous email that was not sent before due to no commit statement executed.
Is there any way to prevent this to happen? Please help.
PS: Points will be rewarded for those with helpful answer
Message was edited by:
Abraham Bukit
03-08-2007 4:45 AM
May be this will be a round away solution.
Why don't you update a custom table from your user exit on the basis of popup selection. and after saving the document . using this custom table entries you can send mail.
aRs
Message was edited by:
aRs
03-07-2007 10:19 AM
further explanation, it seems that the flow of the transaction as below:
Press Save -> User Exit -> Confirmation Dialog -> Commit Work if Yes, no Commit if Cancel.
Please help.
03-08-2007 3:22 AM
I tried to use Update Function Module to sent email.
However, the same thing happen. It seems that if the user does not change the screen, the user will still on the same LUW, hence it will not erase previously stacked update FM that called before.
I do not know if there are any other ways to make this work.
I'm thinking to clear this stacked update FM every time the user change and re-save the record so that it will only execute the last FM called. But until now, I haven't found any way to do that.
Any experts know how to solve it?
03-08-2007 3:45 AM
Hi,
May be you use commit this way.
Create a custom function moudle , with you CL_BCS class codes and with comitt work inside and call the function in your userexit like
call function 'Y_CL_BCS_TRIGGER' " << Your function module name
starting new task yscchdr-docno
exporting
xxxxx = xxxxx
aRs
03-08-2007 4:06 AM
Hi Ars,
Thank you very much for your idea. I consider it for a while. I guess it will create separate LUW with the initial transaction so it will be save to put commit work in the FM.
However, I have one problem here.
The transaction will pop up confirmation dialog if there are warning message.
When user choose to cancel, the email will still be send despite no record be created.
I don't think the user will like it when they got email for something that does not exist.
I appreciate your suggestion though, in case the user accept the idea of sending email eventhough no item created, it will be great to use your method.
03-08-2007 4:17 AM
Hi,
"The transaction will pop up confirmation dialog if there are warning message"
What kind of confirmation message? Whether you are getting a return code after popup?
aRs
03-08-2007 4:25 AM
confirmation message consist of 3 button, save, edit and cancel.
If user choose edit and cancel, the record will not be saved.
The issues here are the exit is called before the confirmation dialog pop up, hence there are no way we can identify which one that user choose.
03-08-2007 4:33 AM
It seems that the only way to solve it is to be able to clear stacked in update task FM.
I heard that the stack will be saved in VBLOG table.
Is there a way to locate the entries in VBLOG table for certain function module and delete it from there so that only last FM call that will be executed when commit work?
03-08-2007 4:45 AM
May be this will be a round away solution.
Why don't you update a custom table from your user exit on the basis of popup selection. and after saving the document . using this custom table entries you can send mail.
aRs
Message was edited by:
aRs
03-08-2007 10:33 AM
Nice idea though, but i finally chose much simpler solution.
I'll export to memory flag from user exit A that was called before pop up and import from memory in user exit B which is called after the pop up. That way, email sending will be executed after user choose Save in the pop up dialog. Thanks for your idea aRs.
08-02-2009 3:40 PM
Hello,
I would like to know the user exit in which I can insert a code that sends e-mail to specified users in SAP who have changed their login password.
Please respond as fast as you can.
Thanks in advance,
Noemi
Edited by: noemi.pocsai on Aug 2, 2009 4:40 PM