Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

function module -> do some step in workflow

Former Member
0 Kudos

Hello,

i have some easy question i think :).

I have some workflow and i need to do some step in this wf from function module(st. like simulating of clicking the button), which parameters i need(what everything make identifikator for the instance of concrete wf) and how can i get an concrete object of wf?

thanks

JJ

2 REPLIES 2

morten_nielsen
Active Contributor
0 Kudos

Hi

You need to create your own methods for executing these function modules.

Depending on how the FM's is defined you have the option to get the method created automatically.

You need to find your delegated business object, place the cursor on methods, and push create, if possible it will generate the source code for you, otherwise you need to do it manually - see example.

When you created the method, create a task with this method and implement it in your workflow.

Regards

Morten Nielsen

-


<b>Example</b>

begin_method assign_role_to_user changing container.
DATA:
      to_date TYPE syst-datum,
      from_date TYPE syst-datum,
      user_name TYPE syst-uname.
swc_get_element container 'To_Date' to_date.
swc_get_element container 'From_Date' from_date.
swc_get_element container 'User_Name' user_name.

IF from_date IS INITIAL.
  from_date = sy-datum.
ENDIF.

IF to_date IS INITIAL.
  to_date = sy-datum + 180.
ENDIF.

CALL FUNCTION 'PRGN_ADD_USER_ASSIGNMENT'
  EXPORTING
    user_name                     = user_name
    activity_group                = object-key-role
   FROM_DATE                     = From_Date
   TO_DATE                       = To_Date
*   ORG_FLAG                      = ' '
*   SHOW_ERROR_MESSAGES           = 'X'
 EXCEPTIONS
   ACTGROUP_NOT_AUTHORIZED       = 1
   ACTGROUP_NOT_EXISTING         = 2
   ACTGROUP_ENQUEUED             = 3
   OTHERS                        = 4
          .
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
exit_return 9001 object-key-role user_name ' ' ' '.
ENDIF.

end_method.

0 Kudos

Hi,

first thanks a lot for answer.

But i dont know if u mean the same as i.

what i need: i have some workflow, in one of its step can user make some decisions and fill some values.

And i need to do this step from some function module - i will call it from java side...

thanks