Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9076

Re: Task Parameter (TS000..) for Function Module workflow

$
0
0

Hi Carlos

 

You need to define the FM in the same way as that of SWX_GET_MANAGER and use in the rule.

 

I am not sure which part is still causing an issue at your end; hence was motivated to to try this myself. Here are some screen shots  and the code to help you...just pickup the ones for which you are not clear about...

 

Hope this helps.

 

regards,

Modak

 

 

Sample Table Design (I have kept the same name as given by you)

1.jpg

 

2.jpg

 

 

 

Rule Design:

 

3.jpg

* "Terminate if Rule Resolution Without Result" will make the WF go in error if no agents are found (and that is the right way)

 

4.jpg

 

Rule Usage:

 

5.jpg

 

Outcome:

 

6.jpg

 

FM Design:

 

7.jpg

 

FM Code:

 

FUNCTION z_get_approver.

*"----------------------------------------------------------------------

*"*"Local Interface:

*"  TABLES

*"      ACTOR_TAB STRUCTURE  SWHACTOR

*"      AC_CONTAINER STRUCTURE  SWCONT

*"  EXCEPTIONS

*"      NOBODY_FOUND

*"----------------------------------------------------------------------

 

* Necessary Macros for reading the container AC_CONTAINER

   INCLUDE <cntain>.

 

 

   TYPES: BEGIN          OF   lty_approvers,

            approver_id  TYPE xubname,

          END            OF   lty_approvers.

   DATA:    lv_wf_id     TYPE sww_task,

            lv_task_id   TYPE sww_task,

            ls_approver  TYPE lty_approvers,

            ls_actor     TYPE swhactor,

            lt_approvers TYPE TABLE OF lty_approvers.

 

   REFRESH: actor_tab.

 

* Get the Workflow Number

   swc_get_element ac_container 'WF_ID' lv_wf_id.

* Get the oTask Number

   swc_get_element ac_container 'TASK_ID' lv_task_id.

 

* Exit if necessary data is not supplied

   CHECK lv_wf_id   IS NOT INITIAL AND

         lv_task_id IS NOT INITIAL.

 

* Get all approvers based on the WF and Task Numbers

   SELECT      approver_id

   INTO TABLE  lt_approvers

   FROM        zhsp_wf_hgs_apr

   WHERE       wf_id = lv_wf_id

   AND         task_id = lv_task_id.

 

* Raise Exception if no approver is available

   IF sy-subrc NE 0 OR lt_approvers IS INITIAL.

     RAISE nobody_found.

   ENDIF.

 

* Set Object type to US - User as approvers .... user IDs maintained in table zhsp_wf_hgs_apr

   ls_actor-otype = 'US'.

 

* Assign data to Actor tab

   LOOP AT     lt_approvers            INTO ls_approver.

        CLEAR  ls_actor-objid.

        MOVE   ls_approver-approver_id TO ls_actor-objid.

        APPEND ls_actor                TO actor_tab.

   ENDLOOP.

 

ENDFUNCTION.

 

 

 

Let's see if this helps you


Viewing all articles
Browse latest Browse all 9076

Trending Articles



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