on 06-29-2009 12:46 PM
Hello All,
I am currently working on a requirement in which a mail has to be sent using workflow to the initiator when the net value of a sales item is below a certain value. I have created a standard task for sending mail and I am calling this task in the user exit "userexit_save_document" using FM 'SAP_WAPI_CREATE_EVENT'. I have created a new event for triggering this task.
My problem is that the task is getting triggered but mail is not being sent. I think I am making a mistake in the container elements part. I am passing only element 'ADDRESSSTRINGS' to the container with value sy-uname.
Can anyone please suggest me how to solve this problem.
Thanks in Advance,
Priyanka Gupta.
Ensure the workflow is started correctly when the event occurs.
Hope you have put "Email" step in your workflow. r u using the Email step or any other step ??
If you are using the email step, then you need to pass the email address to the "Address Strings" in the binding..
Regards,
PR.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
Thank you all for your valuable inputs. I changed the receiver function module in SWE2 and it started working. Points have been awarded.
I think I should use 'SWE_EVENT_CREATE_IN_UPD_TASK' as suggested by SVS since I am calling my event in a user exit.
Just need one more clarification - if I call the function module in update task then will this event be called after the standard program's commit work statement?
Best Regards,
Priyanka Gupta.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Priyanka,
Use SWE_EVENT_CREATE_IN_UPD_TASK function module instead of SAP_WAPI_CREATE_EVENT. Commit work is necessary in after FM SAP_WAPI_CREATE_EVENT which u cant do since you are calling it in User exit.
DATA : gv_objtype TYPE swetypecou-objtype VALUE 'ZSD_SORDER',
gv_objkey TYPE sweinstcou-objkey,
gv_event TYPE swetypecou-event VALUE 'ORDER_CHANGED',
gv_creator TYPE swhactor.
CALL FUNCTION 'SWE_EVENT_CREATE_IN_UPD_TASK' IN UPDATE TASK
EXPORTING
objtype = gv_objtype
objkey = gv_objkey
event = gv_event
creator = gv_creator
TABLES
event_container = lt_cont
EXCEPTIONS
objtype_not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
* do nothing
ENDIF.
Regards,
Sagar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi PG,
I could be wrong, but why are you using a task to send the mail to the initiator.
Since you already using UserExit, you could use the FM 'SO_NEW_DOCUMENT_SEND_API1', so you dont need to involve WF either.
I could be wrong as I said, because you requirement requires an event to be called.
If not, this would be the best option I feel.
Hope it helps.
Aditya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Geet,
I uncommented commit_work but still it is not working.
Best Regards,
Priyanka Gupta.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
You wrote:
ZBUS2032 ZMINEXISTS 29.06.2009 14:10:45 No receiver entered
BUS2032 CHANGED 29.06.2009 14:10:51 SUBSCRIBE Check FM with exception
Is ZBUS2032 a subtype of BUS2032?
In the first line here it says "No receiver entered" so that means there's no active entry for that event in SWE2.
In the second line it says "Check FM with exception" which means the start condition was False, and hence no workflow started. So perhaps it is working as designed.
Was a workflow actually started? Check SWIA.
regards
Rick Bakker
Hanabi Technology
Hello,
Below is the status from SWEL transaction:
ZBUS2032 ZMINEXISTS 29.06.2009 14:10:45 No receiver entered
BUS2032 CHANGED 29.06.2009 14:10:51 SUBSCRIBE Check FM with exception
Here ZMINEXISTS is the new event that I have added to Z Business object 'ZBUS2032'. I am changing some value in VA02 transaction and saving them.
In transaction SOST, there are no transmission requests.
Best Regards,
Priyanka Gupta.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In no user-exit the statement COMMIT WORK is allowed at any time!
This can lead to inconsistencies within the standard application tables.
The statement had to be corrected to
...
COMMIT_WORK = SPACE
...
instead.
However, the requirement could be solved by not using this exit at all, but hook on the event <Object>.CREATED (should be BUS2032 here) and to use a check-function -module in the event linkage to check for the low-priced order line-items.
Additionally I agree with the proposal, not to use the workflow at all, but to call the eMail interface directly. (as seen at a post above).
Furthermore, you could also configure an output message via SAP Forms, using a custom "requirement" (programming) within the SD output determination and use the printer type "email" to get the eMail out. Please refer to the SD Forums.
The more easy way is probably to use the user-exit and the OFFICE-API to send the eMail.
Best wishes,
Florin
Hi Priyanka,
Can u please elaborate more on this..You are saying the workflow is triggered and the mail is not sent.Can u please tell where exactly or in what state the workflow is.Also check in SOST whether it is there or not.
Try debugging your code for sending mail....you might find out.
Regards,
Geet
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello PR,
I am not very clear about what to send from your reply.
Please find my code below:
wa_cont-element = 'ADDRESSSTRINGS'.
wa_cont-value = sy-uname.
APPEND wa_cont TO itab_cont.
CALL FUNCTION 'SAP_WAPI_CREATE_EVENT'
EXPORTING
object_type = 'ZBUS2032'
object_key = g_objkey
event = 'ZMINEXISTS'
commit_work = 'X'
EVENT_LANGUAGE = SY-LANGU
LANGUAGE = SY-LANGU
user = sy-uname
IFS_XML_CONTAINER =
IMPORTING
RETURN_CODE =
EVENT_ID =
TABLES
input_container = itab_cont
MESSAGE_LINES =
MESSAGE_STRUCT =
.
In transaction SWEL, I am getting "No receiver entered" message.
Best Regards,
Priyanka Gupta.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Priyanka,
As fas as I can understand, you are going to use value present in the event container element 'ADDRESSSTRINGS' to send the mail.
Please use the variable '_EVT_CREATOR' present in the event container which by default contains the userid of the initiator. The system binds this variable to the workflow container element '_Wf_Initiator' by default. Please recheck the binding and then use the variable '_Wf_Initiator' in the sendmail step to send the mail to workflow initiator.
The problem with your approach is that to send the mail to the initiator, you need to prefix 'US' to the SY-UNAME and then use it in the sendmail step. EIther use the above mentioned system variable or change the type of variable 'ADDRESSSTRINGS' to WFSYST-INITIATOR which is of length 14 in place of SY_UNAME which is of length 12. Prefix the sy-uname with 'US'.
Hope this will help.
Thanks,
Samson
Hi Priyanka,
IF in transaction SWEL,"No receiver entered" message still showing then pls use go to transction swe2
and maintain the event linkage with the task
1. Go to t code SWE2
2. Click on new entries
3. Fill the following entries
Object Category : BOR Object type
Object Type : <your custom boject>
Event : <your custom event>
Receiver Type : <your task eg. ws90000001 or TS9000001>
Receiver Call : Function module
Receiver Function Module : SWW_WI_CREATE_VIA_EVENT
You must check the ' LINKAGE ACTIVATED' checkbox
save your entries
4. After save the entry in this table , pls retrigger the task again
5. Go to SWEL , this time reveiver will found
Pls reply back what happen
Thanks
Sanjay
Instead of using sy-uname, try passing this to the address strings..
"&_WORKITEM.CREATEDBYUSER.EMPLOYEE.INTERNETADDRESS&".
Regards,
PR.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.