Quantcast
Channel: SCN: Message List - SAP CRM: Webclient UI - Framework
Viewing all articles
Browse latest Browse all 7775

Re: Starting a WF with Values of a Form View

$
0
0

Hi Beskau,

 

Follow the below steps to transfer you context node attribute values to Workflow.

 

1. Create a custom class in se24 and a method with input parameters as your attribute values and an event with with the parameters that you want in your workflow.

 

For eg. Class = 'ZCL_COM_WF_UPDATION'

            method = 'TRIGGER'

 

abc.png

 

def.png

 

2. Raise event from your method passing values.

 

METHOD trigger.

 

     DATA: lv_objtype    TYPE sibftypeid,

        lv_event            TYPE sibfevent,

        lv_objkey           TYPE sibfinstid,

        lr_event_parameters TYPE REF TO if_swf_ifs_parameter_container.

 

* Setting values of Event Name

     lv_objtype = 'ZCL_COM_WF_UPDATION'. " Your Class Name

     lv_event   = 'REGISTER_FACT'" Event Name.

 

* 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_objtype

         im_event     = lv_event

       RECEIVING

         re_reference = lr_event_parameters.

 

** Add the name/value pair to the event conainer

     TRY.

         CALL METHOD lr_event_parameters->set

           EXPORTING

             name  = 'VALUE1'

             value = iv_value1.

 

       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.

 

     TRY.

         CALL METHOD lr_event_parameters->set

           EXPORTING

             name  = 'VALUE2'

             value = iv_value2.

 

       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 prepared event container

     TRY.

         CALL METHOD cl_swf_evt_event=>raise

           EXPORTING

             im_objcateg        = cl_swf_evt_event=>mc_objcateg_cl

             im_objtype         = lv_objtype

             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.


Step4. Call your method from the submit button event handler.


zcl_com_wf_updation=>trigger(

       EXPORTING

         iv_value1   lv_val1 

         iv_value2 = lv_val2  

     ).

 

Step 5. Mention the event as the start event in your workflow and do the binding.

 

dddd.png

 

Now your workflow is triggered with all the attributes of your context node.

 

Thanks,

Ritu


Viewing all articles
Browse latest Browse all 7775

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>