on 04-05-2006 6:13 PM
Friends,
How can I get the Wi id in a dialog step task ? Inside the same method that is called by this wi ? Sending it from the WF to the method by binding ?
I want to store this id in a table.
Glauco,
The following code in your object method should do it.
DATA:
workingwi type swc_object,
wi_id type swwwihead-wi_id.
swc_get_element container '_Workitem' workingwi.
swc_get_property workingwi 'WorkitemId' wi_id.
Cheers,
Ramki.
Message was edited by: Ramki Maley - Deleted previous incorrect answer.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ramki,
But I'm trying this as following (inside the dialog task's method) but it doesn't work.
DATA:
workingwi type swc_object,
wi_id type swwwihead-wi_id.
swc_get_element container '_Workitem' workingwi.
swc_get_property workingwi 'WorkitemId' wi_id.
MESSAGE I000(SV) WITH workingwi.
MESSAGE I000(SV) WITH wi_id.
But these two messages show first: empty and the second, show 000000000000.
What must I do ?
ps.: I'm using 46C.
Message was edited by: Glauco Kubrusly
Hi, Ramki,
I need this WI ID, BEFORE the WI is executed. I need to store its ID in a table, in the same moment the WI is generated.
I've saw the Methods Tab, on the task. And I can see options to execute methods BEFORE. Is it possoble to execute it before the wi is executed and pass parameter wi_id to it ?
<b><i>I can see options to execute methods BEFORE. Is it possoble to execute it before the wi is executed and pass parameter wi_id to it?</i></b>
Theoretically yes. Only way to find out is try it. You need to have a separate method from your primary method to get the WI Id and do whatever you want with it. I don't understand what you mean by passing parameter wi_id to it. Pass to what and from where? Pleas explain.
Ramki.
<b>I don't understand what you mean by passing parameter wi_id to it. Pass to what and from where? Pleas explain.</b>
I want to pass a parameter with the wi_id so the method can see and store in the table. But I'm asking you, because I can't see the binding button to this BEFORE method and I don't know if the method can see the wi_id if I don't make the binding.
Did you understand now ?
Glauco,
No Binding is available for Before & After Methods.
The code I gave above will get you the current WI Id as long as the method is called from a task. _Workitem is a system element available in the method container when called by a task and No binding is needed. You can only test the method by starting the task directly using txn SWUD or by starting the workflow. I am not sure the code will work if used in a before method but you can test by starting the workflow. Testing the method from txn SWO1 will return zeroes since there is no Task instance associated with it.
Ramki Maley.
Message was edited by: Ramki Maley
OK. That's all right. It works.
But the method is executed only when the user executes the wi. in this case, it has the same result to me. It's the same I put the "store wi id's code" in the main wi method.
Do you know if I can execute this method when the wi is generated (even the user don't execute the wi)?
PS: I've already found the tables that I have to search the actual Dialog(Type W)WI ID, in the same momment it was created:
In the table SWW_CONTOB I find my wi by field object key, after that, I search SWWWIHEAD by wi_id and type = W(Dialog).
But I have to do it by anoter program out of the workflow, like a job.
Message was edited by: Glauco Kubrusly
<b><u>Do you know if I can execute this method when the wi is generated (even the user don't execute the wi)? </u></b>
I don't think it is possible. Dialog methods are executed only when WI is executed. Background methods are the only methods that can be executed as soon as the WI is created. I have not been able to find any user exits or BADIs at workitem creation in an ECC5 system. I doubt if any exist in 4.6C.
Batch job will not work because there is a chance the WI is executed before the job runs.
Do you absolutely have to store the WI id in the table? Can you do with the WF id (parent WI)? In which case you can have a background method that stores the WF Id. This might work if your main method occurs only once in the workflow. You can also consider a subworkflow with a background task to store the subworkflow id followed by your main task.
Cheers,
Ramki.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.