Function module - object - workflow(complicated to explain:))
I have a problem.
I created in se37 the function ZRR_ACTORS. I have as the import parameter PRNUMBER with type BAPIEBANC-PREQ_NO. As an export parameter i have RECIPIENT with type BAPIEBANC-REASON_BLOCKING( i have not found an appropriate type for the recipient that works in a function module for the object, so i used this..i do not think that is the problem).
The code is:
data:begin of gs_eban,
menge type eban-menge,
preis type eban-preis,
end of gs_eban,
gt_eban like table of gs_eban,
gv_sum type i,
gv_aux type SWD_MRCPNT.
select menge preis from eban into TABLE gt_eban where banfn = prnumber.
loop at gt_eban into gs_eban.
gv_sum = gv_sum + gs_eban-menge * gs_eban-preis.
if gv_sum > 20.
select single recipient from zteam_approvers into gv_aux where zuser = 'xxxx.
select single recipient from zteam_approvers into gv_aux where zuser = 'yyyy'.
recipient = gv_aux.
As you probably see, i am sending this function the purchase requisition number. In the function I am calculating the value of the purchase requisition. If the value is bigger then 20 i want the recipient to be the email adress of the user xxxx. Else the other email. zteam_approvers is a table with users and their emails.
When i test this function everything is ok.
I created subtype for object BUS2015(purchase requisition), called ZBUS2015. Here i created a method which uses the function ZRR_ACTORS. I released it and after that i selected in swo1 BUS2015 and delegated ZBUS2015. So now when i test object BUS2015, i can use method ZRR_ACTORS which contains the function module ZRR_ACTORS.
If i test this object, the method ZRR_ACTORS works fine. I give the method the number of the purchase requisition and it returns me the user xxxx or yyyy.
Now, i created a workflow. In this workflow i want to send an email to the user xxxx or yyyy. So i have to execute the function ZRR_ACTORS. I create an activity(zrr_activity) in the new workflow. In it, i create a new task(zrr_task) in the activity with object category BUS2105 and method ZRR_ACTORS. I am setting this method as a background method, because after the execution of the function i want to create a Send email step, with the recipient being the one of the emails.
My problem is the binding. In the workflow container i set the PRNUMBER as an import parameter and the Recipient as an export parameter.
In the binding of the step(zrr_activity) i set the following bindings:
&PRNUMBER& -> &PRNUMBER&
&BUS2105& -> &_WI_OBJECT_ID&
&RECIPIENT& <- &RECIPIENT
If i click in the activity, in the task i created(zrr_task), in the object method i set the bindings:
&PRNUMBER& -> &PRNUMBER
&RECIPIENT& <- &RECIPIENT&
I run the workflow. Now i enter the PRNUMBER 0010000420, but it remains 10000420 (maybe this i because of the type PREQ_NO.) and execute.The task has the status In Process. I click on Workflow log, then on list with technical details, and then in the container, i see the Recipient is empty.
So, i think the function did not work properly. What do you think?
Thank you very much,
Edited by: Efren23 on May 30, 2011 7:31 PM