cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Workflow Event Parameter Mapping Instance

Former Member
0 Kudos

Hi Experts, I have created a workflow(Class Based). Below are details of the workflow

Class -

- Interface IF_WORKFLOW added and implemented LOPR and FIND_BY_LOPR

- One Event created with a parameter EQUNR

Workflow -

- New Event is mapped with Workflow

When i trigger this event from SWUE workflow starts however Event parameter is not passed to the workflow and Event Object is always initial. I debugged this workflow putting infinite loop in the constructor and can see that the EQUNR value is always initial.

Can you help here?

Thanks, Pritam

  METHOD constructor.
    m_equipment = im_equipment.
    m_lpor-instid = m_equipment.
    m_lpor-typeid = '/XXXXX/CL_WF_EQUIPMENT'.
    m_lpor-catid  = 'CL'.
  ENDMETHOD.
    MOVE lpor-instid TO lv_equnr.
    READ TABLE mt_instance WITH KEY equnr = lv_equnr INTO ls_instance.
    IF sy-subrc IS NOT INITIAL.
      ls_instance-equnr = lv_equnr.
      TRY.
          CREATE OBJECT ls_instance-object
            EXPORTING
              im_equipment = lv_equnr.
        CATCH cx_bo_error.
          EXIT.
      ENDTRY.
      result ?= ls_instance-object.
      APPEND ls_instance TO mt_instance.
    ENDIF.
  METHOD bi_persistent~lpor.
    result = m_lpor.
  ENDMETHOD.

Accepted Solutions (1)

Accepted Solutions (1)

bpawanchand
Active Contributor

Hi Pritam,

I am talking about the object key but not about the event parameters. As the event parameters can be optional as well as mandatory. LPOR basically is a structure which is a combination of the Instance ID, Class name and BOR Type. LPOR will be filled by the instance or event when the event is created. So the main point over here is about the object key which helps to instantiate the workflow by the system. Make sure you pass the object key. The EQUNR or the equipment number must be the part of object key . Not as a part of event parameters. The instance of the business class must be the unique and this is identified by the system by passing the object key.

Thanks, Pavan

Former Member
0 Kudos

My event parameter is optional. Object Key is EQUNR. When i trigger event, i don't get option to put key attribute. I think there is something wrong here. Please see the screen attached.

wf2.jpg

bpawanchand
Active Contributor
0 Kudos

Hi

I think you might have forgot to enable the key for the business class you created for the euqipment.Please find below

Thanks,

Pavan

Answers (3)

Answers (3)

pokrakam
Active Contributor

Your binding looks a little weird. You are binding equipment twice and it looks like you are using the id as an event parameter. If equipment is the object, you don't need the equipment number as a parameter too.

You must also define the key attribute(s) of a business class in SE24 on the attributes tab - in your case equipment number. WF will then know to use it as your instance ID (LPOR-INSTID).

Former Member
0 Kudos

Hi Mike,

Issue was solved yesterday. You are rite, Key was not defined correctly that is why i was facing issue.

Thanks a lot.

Pritam

Former Member
0 Kudos

Dear Pavan,

I forgot to mention that Event parament is passed correctly and i tried executing report program to trigger workflow as well.

One thing to remrmber here - Event parament is available in workflow however it doesn't create instance object. therefore any other task that is dependent on the instance of the class object fails.

Thanks

Pritam

bpawanchand
Active Contributor
0 Kudos

Hi Pritam,

I hope when you are trying to create the event from SWUE I assume that you are forwarding the Object Key. Because the object key will be the INSTID of the business class. However, I would also recommend to create a test program and try to start workflow by creating an event by using the SAP_WAPI_CREATE_EVENT. For example, have a look at the below screen shot.

Thanks,Pavan