Skip to Content
avatar image
Former Member

'SAP_WAPI_CREATE_EVENT' is not creating mail

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

9 Answers

  • Best Answer
    avatar image
    Former Member
    Jun 30, 2009 at 03:07 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 29, 2009 at 11:58 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

  • avatar image
    Former Member
    Jun 29, 2009 at 12:22 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

    • 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

  • Jun 30, 2009 at 04:28 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 29, 2009 at 11:52 AM

    Instead of using sy-uname, try passing this to the address strings..

    "&_WORKITEM.CREATEDBYUSER.EMPLOYEE.INTERNETADDRESS&".

    Regards,

    PR.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 29, 2009 at 12:08 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 29, 2009 at 01:28 PM

    Hello Geet,

    I uncommented commit_work but still it is not working.

    Best Regards,

    Priyanka Gupta.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

  • avatar image
    Former Member
    Jul 02, 2009 at 08:04 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 06, 2009 at 07:04 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded