Programmed binding in workflow
i had to do calculation with in programmed binding . can any one help me to do it .
regards
kamal
Hello Kamal,
I would not recommend programmed binding for this type of scenario. You would be binding e.g. a value of 10 from your BO and getting a value of 8 in your WF container. To say it would confuse anyone not familiar with the WF design would be putting it mildly.
Create a new attribute <i>DiscountedValue</i> in your object where you can call your function module, and use that directly in your WF/task instead of a net value element.
This is easier to develop and clearer to anyone viewing the WF, and also much easier to debug any problems as you can test the object and see the values. Programmed bindings should really only be used in rare cases if you have no alternatives.
Hope that helps.
Cheers,
Mike
Similar Messages
-
Programmed Binding (Container IF)
Hello Everyone,
I was experimenting on Programmed Binding (Container IF) but I can't seem to make it work. I have had tried to refer the codes from the Programmed Binding (BOR Container) but to no avail.
Is there anyone who can guide me on this?hi Liew
You can use programmed binding in a binding instruction. You can use programmed binding to create more complex assignments, such as:
· Perform calculations or checks on container elements before assignment
· Combine two or more container elements before assignment
You can implement a programmed binding as an ABAP class or a function module
You can use an ABAP class to implement the Container ® Container and Expression ® Expression bindings.
A binding that is implemented as an ABAP class is displayed in the list of binding statements as an enhancement and is visible in all Workflows. This type of ABAP class is therefore particularly suitable for making company-wide enhancements.
An enhancement such as this is completely integrated in the binding editor. You can implement you own checks for the class and choose the names and symbols to be used to display the enhancement in the binding editor.
Function module
You can use a function module to implement the Container ® Container binding.
A function module can use the BOR container interface or the container interface
The BOR container interface supports compatibility reasons. It is therefore advisable to use the container interface for new function modules for the following reasons:
· The container interface has no restrictions with regard to data types. The BOR container does not support the following data types: REF TO, STRING, XSTRING, fields that are longer than 255 characters.
· No data type conversions are required for the container interface. This improves performance.
for more info please go through the following link
http://help.sap.com/saphelp_nw2004s/helpdata/en/7c/b82bcd7b9611d194b80000e82dec10/content.htm
guess it will surely help
regards
ashish -
Read current workitem ID inside Programmed Binding code
Hi Experts,
In one of the workflow we have some approval steps (for FI documents), which creates items in Useru2019s inbox. Now we want to develop a report which shows how much time an approver has taken to approve a particular payment.
SOLUTION APPROACH: The approach we had taken was to capture the workitem ID in a programmed binding of the task container, which can then provide the start and end timestamps (for the workitem ID and hence) of the approval step.
ISSUE: The issue is the task container doesnu2019t have the recently generated workitem ID for the step. It gets populated to the task container after the programmed binding is executed. So, we are now stuck up as to how to read the workitem ID.
Additional Information: While debugging I could find out that the workitem ID gets generated by the class CL_SWF_RUN_WIM_LOCAL in method CREATE_VIA_WFM. But it doesnu2019t get assigned to the task container until just after the CREATEWORKITEM_CONTAINER method which executes the binding operations. In short the programmed binding code gets executed just before the workitem ID is made available to be read and used. See the code snippets of the class below.
The workitem ID gets generated in method CREATE_VIA_WFM.
*- get next number
l_wiid = _get_next_number( ).
me->set_wiid( l_wiid ).
The binding operations get executed a little late in the same method.
*- set properties via method (with dependant data or default data)
me->m_workitem_context = _create_workitem_context( ).
The workitem ID gets assigned to the task container just 2 line after the above line.
me->_set_workitem_container( im_check_oblig_parameters = 'X'
im_container = l_container ).
me->_set_workitem_object( ).
I have already tried a number of generic workflow related classes (eg. CL_SWF_RUN_WIM_FACTORY), but couldnu2019t read this workitem ID.
Any suggestions or pointers regarding this would be well appreciated.
Thanks and Regards
BaradaHi Karri,
Thanks for the reply. Honestly I wasn't expecting someone to answer on a weekend.
I had gone through the wiki section for programmed exits but wasn't very sure if that would help or not. Now after you suggested I am feeling a little more confident about going ahead with it. I was actual hoping someone would suggest that.
About the question regarding the actual requirement, I want to capture the workitem ID of a decision step once it is created (even before executing).
My earlier approach was obviously because my incomplete understanding of the use of programmed binding.
Let me take a try with programmed exits and I will update the thread once I am done.
Thanks
Barada. -
Event binding (Programmed Binding (Container IF))
Hello WF gurus !
I am currenlty trying to trace and debug a WF run and I am having difficulty to understand the binding mechanism of a "Wait for event" step in my workflow. Here is the story: Through its execution run, the WF encountered two "Wait for event" step based on the same BOR-Event (ex: BOR = ZISPROCES1 - Event = ABANDON ). The first occurence is directly is the WF (we will call this WF: WF1) and the 2nd occurence is in a sub-workflow (WF2). The 2 work items for those 2 "wait for events" steps were created in March 2010, obviously waiting for the same event to occur. The ABANDON event occured in June 2010 trigerring the execution of both work items waiting for this event.
When I look at the binding configuration of these "Wait for event" step (Popup screen: Display Binding From Event), I see the following:
- Under "Workflow" column: Programmed Binding (Container IF)
- Under "Event 'ABANDON' column: ZCONTAINER_BINDING_MAIL_ISIS
When I click on the "Programmed Binding (Container IF)" buton, i get a popup screen titled: "Binding Instruction Display" with the following config:
> Binding Instruction: Container --> Container: Programmed Binding (Container IF)
> Exit Function Module: ZCONTAINER_BINDING_MAIL_ISIS
When I look ath the FM ZCONTAINER_BINDING_MAIL_ISIS, I see that it uses three (3) import parameters:
DATAFLOW_EVENT TYPE SWA_DAFLOW
SOURCE_CONTAINER TYPE SWFPARACNT
TARGET_CONTAINER TYPE SWFPARACNT
Assumption: Currently, from what I understand, the "Wait for event" step adds an object called "DELETOR" in the container of the workflow it belongs meaning that when the event will occur, the work item associated to these "Wait for event" steps will process and I should expect to have an object called "DELETOR" in the conainer of WF1 and WF2.
The problem: When I look at my WF log using TCode SWI6, and I look at the container data for each step following the "Wait for event" step (SEND MAIL step), I notice that the WF1's "Send Mail" step container contains an instance of the object called "DELETOR" with data in it. WF2's "Send MaiL" step also contains an object called "DELETOR" but with mention <No Instance> and I don't understand why...
QUESTIONS:
- Where can I see what are the values passed to the FM import parameters ?
- Does anyone have an idea why in WF1's container, object "DELETOR" is instanciated and holds values and in WF2's container, there is an object "DELETOR" but is not instanciated.
Edited by: PAQUEJO on Dec 2, 2010 10:04 PMHere is the code of FM ZCONTAINER_BINDING_MAIL_ISIS
FUNCTION zcontainer_binding_mail_isis.
*"*"Interface locale :
*" IMPORTING
*" VALUE(DATAFLOW_EVENT) TYPE SWA_DAFLOW
*" VALUE(SOURCE_CONTAINER) TYPE SWFPARACNT
*" VALUE(TARGET_CONTAINER) TYPE SWFPARACNT
*" EXCEPTIONS
*" BINDING_ERROR
INCLUDE <cntn01>. " macros for accessing BOR objects and container
INCLUDE <swfcntn01>. " macros for accessing the new ABAP-OO-container
TYPE-POOLS: swfbn.
DATA: my_integer TYPE i.
DATA: lcx_container TYPE REF TO cx_swf_cnt_container,
l_msg TYPE swf_t100ms.
DATA : l_creator(14).
DATA : lo_usr01 TYPE swf_bor_object,
lo_zis type swf_bor_object.
IF dataflow_event = swfbn_dataflow_export. " 'E'
**** 'EXPORT' point of time. This could be:
**** - workflow container to workitem container (before method call)
**** - event container to workflow container (event receive or wf start)
**** - workflow container to role container (before role resolution)
**** always move data from source to target container
TRY.
CALL METHOD source_container->get
EXPORTING
name = '_EVT_CREATOR' "#EC NOTEXT
IMPORTING
value = l_creator.
* ADD 17 TO my_integer.
swf_create_object lo_usr01 'USR01' l_creator+2.
CALL METHOD target_container->set
EXPORTING
name = 'DELETOR' "#EC NOTEXT
value = lo_usr01.
CATCH cx_swf_cnt_container INTO lcx_container.
l_msg = lcx_container->t100_msg.
MESSAGE ID l_msg-msgid TYPE l_msg-msgty NUMBER l_msg-msgno
WITH l_msg-msgv1 l_msg-msgv2 l_msg-msgv3 l_msg-msgv4
RAISING binding_error.
ENDTRY.
ELSEIF dataflow_event = swfbn_dataflow_import. " 'I'
**** 'IMPORT' point of time. This could be:
**** - from workitem container to workflow container (after method exec)
**** - from workflow container to event container to (raise event)
**** always move data from source to target container
TRY.
CALL METHOD source_container->get
EXPORTING
name = '_EVT_CREATOR' "#EC NOTEXT
IMPORTING
value = l_creator.
* ADD 17 TO my_integer.
swf_create_object lo_usr01 'USR01' l_creator+2.
CALL METHOD target_container->set
EXPORTING
name = 'DELETOR' "#EC NOTEXT
value = lo_usr01.
CALL METHOD source_container->get
EXPORTING
name = '_EVT_OBJECT' "#EC NOTEXT
IMPORTING
value = lo_zis.
CALL METHOD target_container->set
EXPORTING
name = '_WI_OBJECT_ID' "#EC NOTEXT
value = lo_zis.
CATCH cx_swf_cnt_container INTO lcx_container.
l_msg = lcx_container->t100_msg.
MESSAGE ID l_msg-msgid TYPE l_msg-msgty NUMBER l_msg-msgno
WITH l_msg-msgv1 l_msg-msgv2 l_msg-msgv3 l_msg-msgv4
RAISING binding_error.
ENDTRY.
ENDIF.
ENDFUNCTION. -
How to perform binding in workflow?
Hi all,
Please tell me what are types of binding in workflow?
and how we perform binding to transfer data from event->workflow,workflow->task etc and
how i know which container elements are passed in binding?
Regards,
Arpita.Welcome to the world of WORKFLOWS
binding to transfer data from event->workflow,workflow->task etc and
how i know which container elements are passed in binding?
You can perform Binding event to workflow from the BASIC DATA (CTRL + F8) of the workflow hee in the version independent tab you can see a tab START EVENTS here under this tab you will mention the BO ( Business Object Name) and EVENT that for which you want to trigger the workflow here you will do the binding between WORKFLOW AND EVENT conatiners.
check this [link|http://help.sap.com/saphelp_nw04/helpdata/en/c5/e4b0ae453d11d189430000e829fbbd/content.htm]
Even you can send the values from the ABAP program to the workflow conatiner by using the various FM
Search SE37 by using SAP_WAPI_* -
Summary : WF: PO - Emailing PO's from concurrent program using new workflow
Hi Consultants,
We have requirement to send PO - Emailing PO's from concurrent program using new workflow
Request details>
develop a way to email a PO as a PDF from the reports menu. Currently the PO can only be emailed from the PO approval screen.
The business would like a way to email the PO anytime after the PO is approved. Reference IT Request ticket #87341.
Ticket#87341: Details
Details: If a purchase order has been sent to the supplier by email, and it needs to be resent for some reason (lost, recipient out on vacation, etc.)
we have to print off a hard copy, then scan it and email it out.
We cannot just send a new email copy directly. We would like to have the ability to re-send an email copy of the PO directly.
Business Justification: If a purchase order has been sent to the supplier by email, and it needs to be re-sent for some reason (lost, recipient out on vacation, etc.) we have to print off a hard copy, then scan it and email it out. We cannot just send a new email copy directly.
This takes extra time and is inefficient.
Please advice me how can i achive this one
Thanks,
AshokPl post details of OS, database and EBS versions.
Pl see if MOS Doc 387949.1 (How Can a User Email a Purchase Order To an Email Address Without Modifying and Reapproving the PO?) can help
HTH
Srini -
Scope Of ABAP Programming in the WorkFlow
Can any one tell me the scope of programming in the workflow and also the way to start it.
Amit:
Not sure what you mean by "scope", but anyway .....
You can call a function module as a workflow task. Once in the function module, you can write as much ABAP as you want. In terms of data available, any parameters / values you want to access and / or modify within the called function module has to be passed in the workflow container.
Suggested reading is Practical Workflow for SAP available from SAP Press: link is http://www.sap-press.com/H950.html Also try the following links for more documentation:
https://sapneth9.wdf.sap.corp/workflow
http://help.sap.com/saphelp_webas620/helpdata/en/a5/172437130e0d09e10000009b38f839/frameset.htm
Regards,
D. -
Programmed Binding (Container IF) - how to access source container data
Hi,
I have created a programmed binding (container IF) using a function module based on SWA_BINDING_TEMPLATE.
I want to access an element (Meldung) based on BUS2078 (QM notification) from my source container and then retrieve the material from this element.
When the element is a simple element such as WfInitiator for example I cant retrieve the value using the get method on the source container but when it is a complex element such as a BOR object it does not work. How can I retrieve such data.
Thanks for your help,
EmmanuelI finally found the answer last week, here is how I have done :
DATA : l_matnr TYPE matnr.
DATA : l_string TYPE string.
DATA: lcx_container TYPE REF TO cx_swf_cnt_container.
DATA: b_meldung TYPE swf_bor_object.
TRY.
CALL METHOD source_container->get
EXPORTING
name = 'Meldung'
IMPORTING
value = b_meldung.
swf_get_property b_meldung 'Material' l_matnr.
CATCH cx_swf_cnt_elem_not_found .
l_string = 'cx_swf_cnt_elem_not_found'.
CATCH cx_swf_cnt_elem_type_conflict .
l_string = 'cx_swf_cnt_elem_type_conflict'.
CATCH cx_swf_cnt_unit_type_conflict .
l_string = 'cx_swf_cnt_unit_type_conflict'.
CATCH cx_swf_cnt_container INTO lcx_container.
l_string = lcx_container->t100_msg.
ENDTRY.
Emmanuel -
Error: Binding from workflow to workitem aborted
Hi ,
I am getting an error in binding which I am not able to resolve. Let me try to explain the scenario first.
1) In the workflow a container element is existing with the name ZBUS2081 which is having reference to object type BUS2081.
2) BUS2081 is having an <b>attribute</b> "Company code" which is again having reference to object type BUS0002. BUS0002 has a key field "CompanyCodeId" which is having reference to database table T001-BUKRS.
3) In a particular step of the workflow there is a binding between ZBUS2081.Companycode.CompanyCodeId ->CCODE where CCODE is a task container element having dictionary reference T001-BUKRS.
4) When the workflow is executing it is giving error in this particular step. The error description are "Binding from workflow to workitem aborted" "ZBUS2081.Companycode.CompanycodeId of binding assignment is not available " Error when determining attribute COMPANYCODE of object"
5) When I check the container in the technical details I see that ZBUS2081.Companycode.CompanycodeId is set to a value. I also checked the corresponding database table for the invoice document and found that this value is existing.
Can anybody please help me on this as to why this binding error is occuring?
Thanks in advance,
AbhishekHi Kjetil,
the workflow started when a document is parked. Its triggering event is BUS2081-Parked. Even I was thinking in the same lines that may be the workflow is trying to access database information which has not been updated at that moment.
When I checked the attribute Companycode of object BUS2081 I even found that the source is set to "Database field" and not "Virtual".
But when I check the workflow container ZBUS2081.Companycode.CompanycodeId is having the correct value. This means the data <b>has</b> been fetched correctly from the database.
Hence I feel if we cannot use an attribute with object reference directly in the binding, rather use a container operation to assign the value to another workflow container element and then use this element in the binding.
Any inputs from any body to confirm this are welcome.
regards,
Abhishek -
Calling report program to my workflow method
hi friends
I have writen the logic to find the email id for travel admin now i want to call this REPORT program to my workflow method. How can i do that. I know how to do that in function module but i want to try with report program. How to get the import and export parameter in the report program. I know there is some thing called memory id export but i dont no how to do that. Can any one show with sample code.
Regards
vijayHi Vijay,
You can make use of the following sample code.
BEGIN_METHOD ' ' CHANGING CONTAINER.
export itab to memory id 'PQR'.
submit zMM_R_BUDJETDISP AND RETURN."exporting list to memory and return.
END_METHOD.
In your program you can use
import itab from memory ID 'PQR'.
Here Itab is a internal table.
Similarly you can define single data elements as well.
you can use this syntax to import, export parameters.
let me know if you have any queries.
Regards,
Raj -
Binding from workflow to work item aborted
Hi,
In my workflow the first two steps are multi condition.
after my second condition i have created activity step - Task and binding the bapi attribute value.
i checked binding no error.
I am getting error in this part.
The error is
Workflow 'TEST' step number 1039: work item could not be created
Source (expression '&PurchaseRequisition.Zvalue&') of binding assignment is not available
Error in the evaluation of expression '&PurchaseRequisition<???>.Zvalue&' for item '20'
Step 15 of WS23000111: Binding from workflow to work item aborted
Error when determining attribute 'Zvalue' of object instance '[BO.BUS2105.001039]'
Step 15 of WS23000111: Binding from workflow to work item aborted
Message no. WFEA031
Diagnosis
Serious errors have occurred in the binding from workflow to work item in step 15 of multistep task WS23000111. As a consequence, workflow 1039 has been forced into error status.
Procedure
"Change Workflow Container" then "Restart After Error" may suffice. It is probable, however, that the binding definition in WS23000111, step 15will have to be changed.
pl help me to proceed further.
Thnks in advance.
sharmaHi,
Seems that your custom BOR is not delegated to the supertype, please do the same in SWO6 and
also check the binding from event to workflow.
Thanks and Regards,
Swaminathan -
Binding definition error with programmed binding classes
Hi all,
640/NW04s/ECC5 SP14 system, I'm trying to use a programmed container->container binding class.
I've created my class implementing interface IF_SWF_IFS_BIND_TRANSFORM_CONT, but when I try to put it into the binding editor, it complains with:
SWF_BND_001/100: Error when executing binding operaton 'CNT'
I've tried all sorts, even gone as far as implementing the presentation interface and giving it a little icon in the binding editor (nice touch!).
Looks nice, but still no joy so back to basics: I figured to make sure there's no problem with my code I created two completely empty classes, one for Expression->Expression binding and one for Container->Container binding. The binding editor is happy with the expression binding class, but still gives the same message about the container binding class.
No luck with any notes on OSS, any input welcome...
Cheers
Mike
(Cross-posted to SAP-WUG and SDN-BPM)Hi
I have had the same problem but if you tick the checkbox handle error as warning
it works. Now I will try to code and see the results...
this workflow is very heavy tool... -
Has anyone implemented Program exits in Workflow?
hi all,
i know we can capture workflow container values in the program exits.
but i need to manipulate/change the container values and pass the new container values back to the task from the class.
so how should i implement the binding and the class.
thanks,
Subbafor this you will have to create a dummy method of a class and use the macros from <cntn01> to modify the contents. Probably you know this.
Note that only the variables created in workflow , that are not default can be set as export parameters.
get the required parameters as import parameters and export parameters of the method you create. Create a task out of that and insert it in the workflow definition.
Write logic inside the method such that... only if required, modify the contents else pass the same to export.. so that net effect is nil.
This is one method of creating program exits.
another method is what you are asking
add the class, shd have the interface IF_SWF_IFS_WORKITEM_EXIT in its definition.
Define its methods.
By default the task container will be available for the class to operate on. they will be public. so you can reference them in your method.
regards,
Sandeep Josyula
*Mark helpful answers -
Container to Container binding in Workflow binding editor
Hi all,
I have an issue using Container --> Container binding in the Workflow binding editor (transaction SWF_BAM). What I want to do is to be able to extend the data provided by the event (i.e call a BAPI using values supplied) before assigning it to the target structure.
This is what I have done:
- Created an entry in Event Linkage: Application Object to Message Proxy, where the object type is BUS2005 (event RELEASED)
and proxy is a generated proxy.
- In the binding editor, I clicked in the Binding Instruction selection and chose Container --> Container as Binding Instruction.
Now I have created my own class that implements the interface IF_SWF_IFS_BIND_TRANSFORM_CONT, so this class shows up in the drop down list under a section called Enhancement.
- The class I created and implemented the interface, now contains three methods, where Transform is one. I have put a break point in this method and when I trigger the event (transaction SWUE) the debugger stops. So, the call to the method works fine.
My problem is, that I cannot access the values provided by the event (these are supplied in parameter SOURCE_CONTAINER).
Is there anyone who have used this technique and could supply some example code? Is there another technique that I can use to obtain the same result?
Best regards
Patrik DonaldsonHi to the both of you!
Thanks for you answer. I will try to elaborate.
My scenario is as follows. I want to react on the event CHANGED, of business object BUS2032 (SalesOrder). The information (field values) supplied by the container under EVTOBJECT (in the binding editor) does not fully correspond to what I need to populate in the receiver interface. I would like to send out i.e SalesOrderNumber and PricingProcedure to the receiver interface.
Now, SalesOrderNumber is supplied by the container (_EVT_OBJECT-SalesDocument, as seen in the binding editor), but hte PricingProcedure would have to be looked up in table VBAK using SalesOrderNumber as a key.
Issue 1: How do I get hold of the value of field SalesDocument in my class? (as I mentioned earlier I have created a class which references interface IF_SWF_IFS_BIND_TRANSFORM_CONT, so I have the transform method and I can put code there. I have put a break point, so I know processing stops there).
I tried to following:
CALL METHOD source_container->if_swf_ifs_parameter_container~get(
EXPORTING
name = 'SALESDOCUMENT'
IMPORTING
value = l_vbeln ).
No, success (cx_swf_cnt_elem_not_found). Makes me think that SalesDocument is not a parameter of the event but something else.
Issue 2: Once I have solved issue 1 and also lookup up the PricingProcedure. How do I go about setting my values in the receiver interface. I know I also have a reference to TARGET_CONTAINER in the TRANSFORM method, but where to go from there?
Any clues would be grately appreciated. Being successful with this scenario, would open for many interesting possibilities.
Best regards
Patrik Donaldson -
How do the Program exits in Workflow work?
hi all,
there is a Program Exit available in Workflow tasks...and it says
You can execute additional methods that you have programmed when predefined events occur. Add the ABAP classes that contain these methods. The ABAP classes added must support the IF_SWF_IFS_WORKITEM_EXIT interface.
now i want to use this program exits in my workflow...so that this program exit(which is basically a class) will take input from Workflow container and gives back processed data <b>back to workflow</b>.
so how to go about with these Program exits.
thanks,
subbahi
good
go throgh this links
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/82d03e23-0a01-0010-b482-dccfe1c877c4
http://help.sap.com/saphelp_nw04/helpdata/en/1a/6b023c3f6aaf08e10000000a11402f/content.htm
thanks
mrutyun^
Maybe you are looking for
-
How can I split a large library without days of tedious work???
I've been reading other discussions for a few hours but feel my situation warrents a new discussion to see if anyone can help. I've been using iPhoto for many years. I've been using a 2 GHz Intel Core Duo 2007 era iMac the whole time. I'm now using i
-
Adding query string to files already within shared documents
Am a Sharepoint newbie, so hopefully this is an easy one. Am trying to add a query string to some hyperlinks (of PDF files) that are already published in a Shared Documents web part. What's the best way to accomplish this? Can't seem to find an easy
-
Ipod nano keeps turning on and off
My ipod nano keeps turning off and on automatically and when I push a button once its on then it freezes, and when I reset it then it starts turning on and off again....what do I do someone please help me
-
Error #2048 (Sandbox Violation) in AIR prevents future hostname resolution
Scenario: Create an application which tries opening 100 socket connections. This in turn triggers an Error #2031(Socket Error) on a few of them, I believe this is a limitation in Flash? or something similar? After a few seconds, those same socket con
-
My Mac desktop is incredibly slow after I installed Yosemite - any suggestions?
My Mac desktop is incredibly slow after I installed Yosemite - any suggestions? Thanks