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,

 

No the parameters need not be of the same name. You have to map trigger method parameters with Event Register_Fact parameters. You have write code in Trigger method for the mapping.

 

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_COMWF_TERP10'. " 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  = 'EP_BP_ID'

             value = iv_bp_id.

 

       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  = 'EP_BP_MAIL'

             value = iv_bp_mail.

 

       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  = 'EP_BP_NAME'

             value = iv_bp_name.

 

       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  = 'EP_MDT_NR'

             value = iv_mdt_nr.

 

       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  = 'EP_START_DATE'

             value = iv_start_date.

 

       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  = 'EP_SYSTEM'

             value = iv_system.

 

       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.


Let me know if you still face issues.


Thanks and Regards,

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>