Skip to Content
avatar image
Former Member

passing data from user exit to workflow

Hi All,

I am working on a custom workflow which is being triggered when a error message is shown while creating a purchase requisition. This workflow is triggered through a user-exit.

My requirement is, i want to pass the data from the purchase requisition ( that cannot be saved ) that is in the buffer to workflow. I am able to read the data. But not able to pass it to workflow.

How can i do it??

Please let me know.

Thanks and regards,

Raj

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Oct 21, 2008 at 04:20 AM

    assuming you are passing the data to workflow containers

    1. by calling workflow directly (using FMs)

    2. or by passing it to event containers and then receiving in the workflow..

    Try to enable workflow trace and see what container values are being set during workflow initiation. Check if their is a data type mismatch.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 21, 2008 at 05:28 AM

    Hello,

    Hopefully you should be using either "SAP_WAPI_START_WORKFLOW" or "SWE_EVENT_CREATE" to trigger the workflow from the user exit. As you are able to read the data from the buffer, pass the same to the workflow using the event container parameters (INPUT_CONTAINER or EVENT_CONTAINER)which are present in the function modules. For this you need to create the parameters in the events of the BO first and then pass the data using the same while executing the function module.

    Hope this will help.

    Regards,

    Samson

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hello,

      To create an event parameter for an event in the BO, select the event of the BO and click on the 'parameters' button. Create an element in the event container with reference to the ABAP dictionary data fields. Once you create a parameter, Use the following sample code to populate the same.

      data : event_con type SWCONT.

      event_con-element = name of the parameter in event.

      event_con-value = value to be passed.

      pass the event_cont to the import parameter EVENT_CONTAINER of the function module SWE_EVENT_CREATE.

      The ABAP declaration may not be correct.

      Hope this will help.

      Regards

      Samson

  • avatar image
    Former Member
    Oct 21, 2008 at 07:08 AM

    Raj,

    If you are triggering your workflow from an error message, you can do it directly from the transaction SWUY.

    It opens a wizard which helps you to create a workflow definition that can be started from a message.

    The message class, the message number, the message type (E, A, I, S, W), the four variables, the message and the message including the replaced variables are passed to the workflow definition.

    Enter the message class and message number for which a workflow is to be started on this screen. If a workflow linkage already exists for this message, you can delete the existing linkage and replace it with the new one, or leave the old linkage unchanged.

    If you want to trigger it from an exit itself, read the data from the buffer and pass it as the objkey to the FM SWE_EVENT_CREATE with a COMMIT WORK after it.

    Try this sample code with your values in user exit.

    data:
      w_key type sweinstcou-objkey,
      w_creator type swhactor.
    
      w_key = zmara-matnr.
      w_creator-otype = 'US'.
      w_creator-objid = 'SAPDEV02'.
        CALL FUNCTION 'SWE_EVENT_CREATE'
          EXPORTING
            objtype                       = 'ZZBUS1001'
            objkey                        = w_key
            event                         = 'EDIT'
            creator                       = w_creator
         EXCEPTIONS
           objtype_not_found             = 1.
        IF sy-subrc EQ 0.
          COMMIT WORK.
        ENDIF.

    Pass the values to the objkey and COMMIT WORK after it.

    Regards

    Indu.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 23, 2008 at 11:55 AM

    Created event parameter and it worked

    Add comment
    10|10000 characters needed characters exceeded