Skip to Content
0

Start Event in workflow not working using CL_SWF_EVT_EVENT=>RAISE

Jan 18, 2017 at 11:53 PM

277

avatar image

Hello Everybody,

I have been working on this for a couple of days and this is my first time doing WF. I think I have gone far but now I am struggling here.

The problem is that I cannot run the workflow raising an event. I don't get any message on debugg, but when I use SWUE It works perfectly and I see it on SWI1.

I don't even get any error during debugg:

I appreciate the help

Thanks,

I created a WF with a START EVENT that should trigger from the class:

This is how the WF START Event looks like with the bindings:

This is how my class looks like and I already added the code for all the IF_WORKFLOW methods:

Here is the code for the program i created to call my class TRIGGER_START_WF:

SPAN {
font-family: "Courier New";
font-size: 10pt;
color: #000000;
background: #FFFFFF;
}
.L0S33 {
color: #4DA619;
}
.L0S52 {
color: #0000FF;
}
.L0S55 {
color: #800080;
}
.L0S70 {
color: #808080;
}

REPORT zwftestjkl.


DATA: lr_wf TYPE REF TO zcl_plant2.

DATA: lv_werks TYPE werks.

lv_werks = '0010'.

CREATE OBJECT lr_wf

  EXPORTING

    plant = lv_werks.


CALL METHOD lr_wf->trigger_start_wf

    .

Here is the code for the TRIGGER_START_WF method:

SPAN {
font-family: "Courier New";
font-size: 10pt;
color: #000000;
background: #FFFFFF;
}
.L0S31 {
font-style: italic;
color: #808080;
}
.L0S33 {
color: #4DA619;
}
.L0S52 {
color: #0000FF;
}
.L0S55 {
color: #800080;
}
.L0S70 {
color: #808080;
}

  METHOD trigger_sTART_wf.



* Data Declarations

    DATA: lv_class            TYPE sibftypeid,

          lv_event            TYPE sibfevent,

          lv_objkey           TYPE sibfinstid,

          lr_event_parameters TYPE REF TO if_swf_ifs_parameter_container,

          lv_param_name       TYPE swfdname,

          lv_plant            TYPE WERKS.



    lv_objkey = me->plant.

    lv_class = 'ZCL_PLANT2'.

    lv_event   = 'START_WF'.



* Instantiate an empty event container

    CALL METHOD cl_swf_evt_event=>get_event_container

      EXPORTING

        im_objcateg  = cl_swf_evt_event=>mc_objcateg_cl

        im_objtype   = lv_class

        im_event     = lv_event

      RECEIVING

        re_reference = lr_event_parameters.


* Set up the name/value pair to be added to the container


    TRY.


        lv_param_name  = 'WFID'.  " parameter name of the event

        lv_plant         =  me->plant.


        CALL METHOD lr_event_parameters->set

          EXPORTING

            name  = lv_param_name

            value = lv_plant.


        lv_param_name  = 'I_CL_PLANT'.  " parameter name of the event

        CALL METHOD lr_event_parameters->set

          EXPORTING

            name  = lv_param_name

            value = me.


      CATCH cx_swf_cnt_cont_access_denied .

      CATCH cx_swf_cnt_elem_access_denied .

      CATCH cx_swf_cnt_elem_not_found .

      CATCH cx_swf_cnt_elem_type_conflict .

      CATCH cx_swf_cnt_unit_type_conflict .

      CATCH cx_swf_cnt_elem_def_invalid .

      CATCH cx_swf_cnt_container .

    ENDTRY.



* Raise the event passing the event container

    TRY.

        CALL METHOD cl_swf_evt_event=>raise

          EXPORTING

            im_objcateg        = cl_swf_evt_event=>mc_objcateg_cl

            im_objtype         = lv_class

            im_event           = lv_event

            im_objkey          = lv_objkey

*            .

            im_event_container = lr_event_parameters.

      CATCH cx_swf_evt_invalid_objtype .

      CATCH cx_swf_evt_invalid_event .

    ENDTRY.

    COMMIT WORK.

  ENDMETHOD.
wf1.png (24.4 kB)
wf2.png (53.8 kB)
wf3.png (53.1 kB)
wf4.png (37.2 kB)
wf45.png (134.5 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

5 Answers

Manoj Rawat Jan 28, 2017 at 07:32 PM
0

Hello Julius,

Have you done linkage in Tcode SWE2 for your class and workflow template . And also on event trace and run tcode SWEL to check your workflow triggered or not .

Regards,

Manoj Rawat

Share
10 |10000 characters needed characters left characters exceeded
Jocelyn Dart
Jan 30, 2017 at 05:39 AM
0

Hello Julius

Check the methods lpor & find_by_lpor are working correctly

In particular check your class attribute that persists the lpor value is formulated correctly & contains the correct content at runtime ... ie with class, class id, and object key - not just plant number

Make sure you have read and applied all of the ABAP OO for workflow blogs.

If you skipped anything take another look.

Also check also in Txn SM58 & ST22 in case something else is going on

Good luck

Rgds

Jocelyn

Share
10 |10000 characters needed characters left characters exceeded
Stéphane Bailleul Jan 30, 2017 at 05:00 PM
0

Humm

May be you should start the event trace in SWELS and try then check in SWEL if something was raised

Cheers

Stephane

Share
10 |10000 characters needed characters left characters exceeded
Anjan Paul Jan 31, 2017 at 10:26 AM
0

hi,

Also you check the parameter WFID and I_CL_PLANT is same name or not?

Share
10 |10000 characters needed characters left characters exceeded
Pavan Bhamidipati Mar 30, 2017 at 12:40 PM
0

Hi,

Some where in your binding definitions I see that there is no binding definiton between WFID event container element to any of the workflow container element. I assume it could be because of the missing binding definitions.

Thanks,Pavan

Share
10 |10000 characters needed characters left characters exceeded