Remove optinos in user decision task dinamically
Hi all,
I have an user decision task wich have several options. I want to remove (or deactivate) some of these options dinamically or under some conditions...
Do you know how can i do it?
May be it's possible to do with a program exit but i don't find any method in the class for do that.
Thanks in advance.
Hi,
Finally, I had to do it. I put the steps in case anyone is interested:
- Create a Decision Task in workflow builder. Replace the Task used in Control tab by a custom one. You need to create a copy of the standard task 00008267. In my case I've created the task 99000001.
- The FM to get the options and texts is SWU_GET_DECISION_TEXT_TITLE. We need to create an enhancement point at the end of this FM. I've created a method in a custom class to embed all my code:
TRY.
CALL METHOD zcl_im_wf_dec_task=>zz_mod_decision_task
EXPORTING
wiid = wiid
changing
ct_decision_text = decision_text[].
CATCH cx_root.
ENDTRY.
- This method has the following parameters:
WIID TYPE SWW_WIID
CT_DECISION_TEXT TYPE ANY TABLE
With the following code you can change the description of the options you want or delete some options dinamically:
DATA: l_wi_handle TYPE REF TO if_swf_run_wim_internal,
lo_wi_dialog TYPE REF TO cl_swf_run_wim_dialog,
lo_container TYPE REF TO if_swf_cnt_container,
ls_wi_head TYPE sww_wihead,
lv_key TYPE sww_wi2obj-instid,
lv_bstyp TYPE ebstyp.
FIELD-SYMBOLS: <ls> TYPE ANY.
* Obtain the header:
TRY.
CALL METHOD cl_swf_run_wim_factory=>find_by_wiid
EXPORTING
im_wiid = wiid
RECEIVING
re_instance = l_wi_handle.
lo_wi_dialog ?= l_wi_handle.
ls_wi_head = lo_wi_dialog->if_swf_run_wim_internal~m_sww_wihead.
CATCH cx_swf_run_wim .
CATCH cx_root.
ENDTRY.
* Read the container (if you want...):
TRY.
CALL METHOD lo_wi_dialog->if_swf_run_wim_wfm~get_wi_container
RECEIVING
re_container = lo_container.
CATCH cx_swf_run_wim .
ENDTRY.
* Read the Key:
SELECT SINGLE instid INTO lv_key
FROM sww_wi2obj
WHERE top_wi_id EQ ls_wi_head-top_wi_id.
* In this example is a workflow for PO;
SELECT SINGLE bstyp INTO lv_bstyp
FROM ekko WHERE ebeln EQ lv_key.
* Depending on the Task;
CASE ls_wi_head-wi_rh_task.
* Authorize
WHEN 'TS99000001'.
LOOP AT ct_decision_text ASSIGNING <ls>.
* The first 4 characters are the number of the option.
* The following characters are the description.
* Delete an option;
IF <ls>(4) EQ '0001' AND lv_bstyp EQ 'F'.
DELETE ct_decision_text INDEX sy-tabix.
CONTINUE.
ENDIF.
* Change the description:
IF <ls>(4) EQ '0002'.
IF lv_bstyp EQ 'K'.
<ls>+4 = 'Authorize'.
ELSE.
<ls>+4 = 'Continue with the process'.
ENDIF.
ENDIF.
ENDLOOP.
ENDCASE.
Similar Messages
-
HREF in user decision task not working in UWL?
Hi All,
We're on ECC6 and portal version 7.01 SP4.
My problem is that I have defined a link in the body of a user decision task like so..
<A HREF="http://www.google.ie/" target=_blank> GOOGLE </A>
and while in appears as a link in the task in the UWL, clicking it does nothing. When I check the properties of the link, I see that it's actually javascript:void(0);, so hence it doing nothing.
Can anyone give me any guidance on how to get a link working in a user decision task in the UWL?
Thanks in advance,
Liz.Hi Patrick,
Thanks for the respnse, I've since figured out that what I was trying to do was not possible. I have impleneted a workaround myself, where I just added an extra button action in the UWL.
Many thanks,
Liz. -
Not able to open "requested end" in user decision task.
Hi All,
In the user decision task, i have specified the value as +5 day in the "requested end" tab. When i executes the WF, and checks in the workflow log of work item, it shows that user decision step as logical deleted. I open that step on developement server, there value is fine as +5 day, then i tried to open that step on quality server where i am testing, when i clicks on that tab button it displays an error message at bottom of the screen "No Unit with the desired conversion factor is maintained", and with in 1 seconds it came out to initial screen of SAP.
I checked the TR, it is imported correctly.
where can be the issue then ? why i am not able to click on that tab in that user decision task, its very strange, i faced this kind of issue first time.
if you have any idea about that why it is happening then please reply.
Regards,
Raman.Check SWU3 is properly maintained in your quality server.
Thanks
Arghadip -
Regarding creation of generic user decision task in workfow
Hi,
Can any one please guide me how to create generic user decision task in workfow?Hello,
Just go into the workflow builder and create a new step. Choose a Decision Step and it will make one with the generic decision task, TS00008267. Just fill in what the options are and who it should go to. The task text starts with the very generic:
Choose one of the decision options given. This completes the
processing of this step.
regards
Rick Bakker
Hanabi Technology -
Execute User decision task outside SAP
Hi,
Is it possible to execute user decision task outside SAP using the extended notifications? I have tried out using the configuration documents provided in SAP as well as from other sources. But wasnt able to send the notification to outlook.
Please help me out.
Thanks,
SamsonSamson,
You may want to consider using Inbound Distribution.
SO28 transaction - Inbound Distribution
http://help.sap.com/saphelp_crm40/helpdata/EN/6c/69c2e3418d11d1896e0000e8322d00/content.htm
Specify an object with method "RECEIVE" to receive the mail item. The method then needs to parse it and process it. If a mail with subject = "Approve" is to approve a workitem then the appropriate terminating event must be raised in the RECEIVE method.
Hope this helps,
Margaret -
_wi_actual_agent and User Decision task
Hi,
I have a workflow which uses a User Decision task [ BO Process, Method Decision ] and thought I'd store the actual approver by mapping WIACTUAL_AGENT to a suitable workflow container variable.
Problem is, when the workflow runs I can see that
WIACTUAL_AGENT is set, but the workflow container variable remains empty..... any ideas ?Did you bind the standard container element WIACTUAL_AGENT to workflow container element?
Do the following binding
WORKFLOW CONTAINER <----- TASK CONTAINER
Workflow container element <---- WIACTUAL_AGENT
Regards
Aman -
Container Operation step in User Decision
Hi,
I have used one set container operation step in one of the user decision task. But it seems it is not working inside the user decision step.
I have checked the SWI1 log as well, but it is bypassing it.(screen shot attached from Workflow and SWI1).
Please sugegst that can we use container operation step inside the user decision task.
SWI1 log as well ( Not setting the variabl)e
Regads,
PriyankaHi,
check if in the workflow definition you mention if this step should be shown in the log or not. Also make sure using the technical details option in the workflow log that indeed the container operation was executed or not.
If everything seems correct, but still in execution it skips something, then your workflow definition might be corrupt, either fix it by deleting the step in development, saving it and then recreating it. Or if it was corrupted after transport you could try your luck with function module SWD_REPLICATE_FROM_9999.
Kind regards, Rob Dielemans -
ABAP OO & Custom made user decisions...
Hi,
I've been playing with ABAP OO for a little while now, but keep encountering the following problem. I tried to look for the answer here, but could find it.
Often I make a copy of the standard user decision task TS00008267. Then I can create my own text in there. However, normally I can use an attribute of a BOR-object as a variable here via the 'Expression' button, but I can't use the attribute of a class here!
I get the message: "Variable &ZEMPLOYEE.GET.NUMBER& exists in description text Task description, but does not exist in the container."
Has anyone encountered this problem too and maybe has some tips for me? The workaround I use now is by defining container elements in the task for every variable I want to use and pass the value via the binding. This is not really desirable of course.
Any tips of help are welcome!
Regards,
ErikHi Erik,
Is the attribute you want to use in the text a public one? I think it needs to be if you want to use it.
Regards,
Martin -
Use Multiline Container Element in User Decision
Hi Gurus,
I have a Multiline Container in my User Decision Task. I am able to pull the data in a Standard Text to the Multi Line Container Element if type RSTXT-TXLINE. But how do I display the total data in all the lines in that element to the User Decision Workitem Text.
Thanx & regards,
KanYou cannot insert all the table entries in the Decision step workitem Text. it wont allow you to display, one of the possible ways to fix it is please check this [blog|http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3417500)ID1574174750DB11406479040085832269End?blog=/pub/wlg/15666]
-
Objects and Attachments in User Decision Step not possible
Hi all,
I have designed a workflow where during the 1st step(Archivelink image display) I am able to display archived image, and in the inbox for the first workitem I can see the Objects and Attachments link related to the image.
But my second workflow step(is userdecision dialog), I would like to see the same archived image link as the in the previous workitem under Objects and Attachments.(I dont want to create a new attachement)
Can somebody tell me how can I accomplish this task.
Thnks
YogiHello,
what you need todo is to use a container binding from the single step task from the 1st step where you bind the image object to the workflow container.
Then in the user decision task you create a container element which refers to the image object. Then use a binding to 'send' the object from the workflow container to the task container.
Kind regards,
Peter -
Dear experts,
I have a user decision step. Before the approver can approve or reject the workitem i need to show a tocde screen to him. Say for example CN25. My workitem will be generated only after initiator makes changes in that tcode. I want approver who gets the workitem to see CN25 tcode screen and then only make decision. Is there any possibility to attach or bring a tcode screen in user decision step.Dear Hemalatha,
Thanks a lot for your reply.
You can direct;y use the Object which is used to trigger the workflow. Then you can bind this object to get that tcode as
attachment in decision task.
This is exactly my requirement. In my BO i have a standard method "display" to display the Tcode. I want to know how should i do the binding from BO's method to user decision task so that i can display a link as attachment of user decision step, by clicking which user can see the display screen. -
User-Decision COMPLETED buti next step not executed
Hi Gurus,
I have a very strange problem when approving user-decision tasks in my workflow using FM SAP_WAPI_DECISION_COMPLETE.
SOMETIMES, the user-decision step becomes COMPLETED but the result in the workflow logs (SWI1) is blank and does not continue to the next steps of my workflow. I've done my research and checked everything (commit = X, SWU3, Task is General, etc..) but i still have not found any solution yet.
FYI: this does not happen all the time, most of the time the workflow works fine.
Based on SWWWIHEAD, the user ADSUSER(from WebDynpro) is the creator and the last one who updated the workflow instance.
Here's part of my code for your reference: (RFC - called by WebDynpro)
CALL FUNCTION 'SWL_GET_PROCESS_STEPLIST'
EXPORTING
wf_id = wi_id
with_techdetails = space
with_expansion = space
with_errors = space
TABLES
wfm_steplog = lt_wfm_steplog
EXCEPTIONS
workflow_does_not_exist = 1
error_while_reading_wfm_log = 2
OTHERS = 3.
DELETE lt_wfm_steplog WHERE wi_type NE 'W'.
CLEAR: wa_wfm_steplog, li_lines.
DESCRIBE TABLE lt_wfm_steplog LINES li_lines.
READ TABLE lt_wfm_steplog INTO wa_wfm_steplog INDEX li_lines.
IF in_pdf_flag = 'Y'. "Continue
ly_decision_key = '0001'.
ELSE. "Cancel
ly_decision_key = '0002'.
ENDIF.
IF NOT ly_decision_key IS INITIAL .
CALL FUNCTION 'SAP_WAPI_DECISION_COMPLETE'
EXPORTING
WORKITEM_ID = wa_wfm_steplog-wi_id
LANGUAGE = SY-LANGU
USER = SY-UNAME
DECISION_KEY = ly_decision_key
DO_COMMIT = 'X'
IMPORTING
RETURN_CODE = l_subrc.
Thanks in advance.
Regards,
DexterHello Dexter,
Thanks for the reply.
I have tried running the BAPI through Automation Tools which we have. That is Process Runner.
With the help of this I was Approving the WorkFlow. But as i found the issue, so for trouble schooting this i had manually checked in SAP though SE37 t-code.
Below is the code of BAPI 'sap_wapi_decision_complete'
=====================================================================
FUNCTION sap_wapi_decision_complete.
*"*"Lokale Schnittstelle:
*" IMPORTING
*" VALUE(WORKITEM_ID) TYPE SWR_STRUCT-WORKITEMID
*" VALUE(LANGUAGE) LIKE SWR_STRUCT-WILANGUAGE DEFAULT SY-LANGU
*" VALUE(USER) TYPE SYUNAME DEFAULT SY-UNAME
*" VALUE(DECISION_KEY) TYPE SWR_DECIKEY
*" VALUE(DO_COMMIT) TYPE XFELD DEFAULT 'X'
*" EXPORTING
*" VALUE(RETURN_CODE) LIKE SY-SUBRC
*" VALUE(NEW_STATUS) TYPE SWW_WISTAT
*" TABLES
*" MESSAGE_LINES STRUCTURE SWR_MESSAG OPTIONAL
*" MESSAGE_STRUCT STRUCTURE SWR_MSTRUC OPTIONAL
DATA: lh_msg TYPE REF TO cl_swf_utl_wapi_message,
lv_excp TYPE REF TO cx_swf_ifs_exception,
funcname TYPE funcname VALUE 'SAP_WAPI_DECISION_COMPLETE',
lv_wi_handle TYPE REF TO if_swf_run_wim_internal,
ls_t100msg TYPE swf_t100ms,
lv_handle TYPE sytabix,
lh_wapi TYPE REF TO if_swf_utl_wapi_framework,
ls_swwwihead TYPE swwwihead,
l_nodetype TYPE swd_nodetp,
lt_alternatives TYPE swr_decialts OCCURS 0 WITH HEADER LINE.
DATA: lt_cont TYPE swr_cont OCCURS 0 WITH HEADER LINE.
DATA: lh_params TYPE REF TO if_swf_ifs_parameter_container.
DATA: lh_trc_data TYPE REF TO if_swf_cnt_container.
DATA: lt_message_lines TYPE sapi_msg_lines.
DATA: lt_message_struct TYPE sapi_msg_struc.
*- startup framework
lh_wapi = cl_swf_utl_wapi_framework=>create( im_language = language ).
lh_msg = lh_wapi->get_message_object( ).
lh_params = lh_wapi->get_parameter_container( ).
CALL METHOD lh_wapi->set_commit_control( im_commit = do_commit ).
TRY.
CALL METHOD lh_params->set
EXPORTING
name = lh_wapi->c_workitem_id
value = workitem_id.
CATCH cx_swf_cnt_container .
ENDTRY.
lv_handle = lh_wapi->register_function( im_function = funcname
im_parameters = lh_params ).
*~~ begin of trace specific coding ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
IF lh_wapi->m_trace_handle IS BOUND.
TRY.
lh_trc_data = lh_wapi->get_initial_trace_data( ).
CALL METHOD lh_trc_data->element_set
EXPORTING
name = 'WORKITEM_ID'
value = workitem_id.
CALL METHOD lh_trc_data->element_set
EXPORTING
name = 'LANGUAGE'
value = language.
CALL METHOD lh_trc_data->element_set
EXPORTING
name = 'USER'
value = user.
CALL METHOD lh_trc_data->element_set
EXPORTING
name = 'DECISION_KEY'
value = decision_key.
CALL METHOD lh_trc_data->element_set
EXPORTING
name = 'DO_COMMIT'
value = do_commit.
CALL METHOD lh_wapi->write_trace
EXPORTING
im_evt = swwtr_api_init
im_data = lh_trc_data.
CATCH cx_swf_ifs_exception. "#EC NO_HANDLER
ENDTRY.
ENDIF.
*~~ end of trace specific coding ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
TRY.
*- function valid (allowed)
IF lv_handle LE 0.
lv_excp = lh_wapi->get_last_exception( ).
return_code = 900.
RAISE EXCEPTION lv_excp.
ENDIF.
*- get properties
CALL METHOD cl_swf_run_wim_factory=>find_by_wiid
EXPORTING
im_wiid = workitem_id
RECEIVING
re_instance = lv_wi_handle.
* is it a decision at all?
MOVE-CORRESPONDING lv_wi_handle->m_sww_wihead TO ls_swwwihead.
CALL METHOD cl_swf_run_workitem_compatible=>get_def_guid_structure
EXPORTING
im_header = ls_swwwihead
IMPORTING
ex_nodetype = l_nodetype.
IF l_nodetype <> swfco_wd_decision.
return_code = 2.
ls_t100msg-msgid = 'SWR'.
ls_t100msg-msgty = 'E'.
ls_t100msg-msgno = 205.
ls_t100msg-msgv1 = workitem_id.
RAISE EXCEPTION TYPE cx_swf_run_wim
EXPORTING t100_msg = ls_t100msg
wi_id = workitem_id.
ENDIF.
*- get texts
CALL FUNCTION 'SWU_GET_DECISION_TEXT_TITLE'
EXPORTING
language = language
wiid = workitem_id
TABLES
decision_text = lt_alternatives[]
EXCEPTIONS
node_not_found = 1
text_not_found = 2
workflow_not_found = 3
OTHERS = 4.
IF sy-subrc <> 0.
return_code = 2.
ls_t100msg-msgid = 'SWR'.
ls_t100msg-msgty = 'E'.
ls_t100msg-msgno = 206.
ls_t100msg-msgv1 = workitem_id.
RAISE EXCEPTION TYPE cx_swf_run_wim
EXPORTING t100_msg = ls_t100msg
wi_id = workitem_id.
ENDIF.
*- check alternative id
READ TABLE lt_alternatives WITH KEY altkey = decision_key.
IF sy-subrc <> 0.
return_code = 3.
ls_t100msg-msgid = 'SWR'.
ls_t100msg-msgty = 'E'.
ls_t100msg-msgno = 207.
ls_t100msg-msgv1 = workitem_id.
ls_t100msg-msgv2 = decision_key.
RAISE EXCEPTION TYPE cx_swf_run_wim
EXPORTING t100_msg = ls_t100msg
wi_id = workitem_id.
ENDIF.
CATCH cx_swf_ifs_exception INTO lv_excp.
IF return_code IS INITIAL.
return_code = 1.
ENDIF.
CALL METHOD lh_msg->set_exception_object( im_excp = lv_excp ).
*- set export
message_lines[] = lh_msg->get_message_lines( ).
message_struct[] = lh_msg->get_message_struct( ).
EXIT.
ENDTRY.
*- unregister to framework
CALL METHOD lh_wapi->unregister( lv_handle ).
*- complete decision item
lt_cont-element = swfco_wi_result_const.
lt_cont-value = decision_key.
APPEND lt_cont.
lt_cont-element = swfco_om_result_const.
lt_cont-value = decision_key.
APPEND lt_cont.
CALL FUNCTION 'SAP_WAPI_WORKITEM_COMPLETE'
EXPORTING
workitem_id = workitem_id
actual_agent = user
language = language
do_commit = do_commit
IMPORTING
return_code = return_code
new_status = new_status
TABLES
simple_container = lt_cont[]
message_lines = message_lines
message_struct = message_struct.
*~~ begin of trace specific coding ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
IF lh_wapi->m_trace_handle IS BOUND.
TRY.
lh_trc_data = lh_wapi->get_initial_trace_data( ).
CALL METHOD lh_trc_data->element_set
EXPORTING
name = 'RETURN_CODE'
value = return_code.
CALL METHOD lh_trc_data->element_set
EXPORTING
name = 'NEW_STATUS'
value = new_status.
lt_message_lines = message_lines[].
CALL METHOD lh_trc_data->element_set
EXPORTING
name = 'MESSAGE_LINES'
value = lt_message_lines.
lt_message_struct = message_struct[].
CALL METHOD lh_trc_data->element_set
EXPORTING
name = 'MESSAGE_STRUCT'
value = lt_message_struct.
CALL METHOD lh_wapi->write_trace
EXPORTING
im_evt = swwtr_api_result
im_data = lh_trc_data.
CATCH cx_swf_ifs_exception. "#EC NO_HANDLER
ENDTRY.
ENDIF.
*~~ end of trace specific coding ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
ENDFUNCTION.
========================================================================
When I pass all the data through Process Runner Program and check in SAP manually it look like below in SAP
Kindly check the above screen shot and Help me in this regard.
Thanks,
Srikanth -
With a requirement, it is required to display a lot of information in the 'User Decision' ( in the area of Task Description). This means, this description will have to be displayed to help the user know the information about the document which he will require to approve.
As there are huge amount of information to be displayed in here - so I may not be able to use the task description (may be messy, and if a new field is to be added they might have to change the task description).
Question is? How to design a program & its module pool screen to be added to user decision in order to show the screen in the 'User Decision' description. I know by using the function module I will be able to show the logo's. (I see a program & screen option in the same tab).
If there are some examples - please share them too. ThanksThere are different ways you can accomplish this. One way is to create a task that displays the data you want first (for example a task to call MB01). Insert this task before the user decision task. If both tasks have the same agent, the second task will immediately be displayed if the previous task has the "confirm end of processing" flag set.
-
Adobe form as attachment to user decision step
Hi,
i need to add adobe form as attachement to user decision step in workflow.
1. i created activity step which call business object method with parameters workitem id
i am using FM SAP_WAPI_ATTACHMENT_ADD’ which will return attribute id
i am passing that attribute with document id to 'ZSOFM'
ZSOFM <-----------------------------------ZSOFM (Method to task)
Bindings 'Attach_objects' <------------- ZSOFM(Task to Workflow).
2. i created user decision step
Bindings 'Attach_objects' --------------------> 'Attach_Objects'( Workflow to user decision task).
but when we execute first activity step in background i am not getting any PDF output .but when we execute same method from class i can see pdf data is coming is it due to user name WF-Batch.
when i execute activity step in back ground which will have sy-uname as WF-Batch i am not getting any PDF output data.
please help how to solve .
Thanks,
PhaniIn transaction SWO1 create a z-object lets say zmyobjpdf (you might want to use it as a sub object of your standard object without delegation since they will probably have the same key).
create a method in that object calling the adobe form.
set it as the default method in the object header.
now create an instance of the zmyobjpdf in the workflow for example as an attribute of the original object) and transfer it to the decision task.
It will be displayed as an attached object pressing it will call the default method - your adobe form.
If your question was about how to create a function module to display the form see SAP Library - PDF-Based Forms -
EP7 - decision tasks and comments
Hi!
I've to implement a user decision task, but where it schould be possible to enter a comment regarding the decision.
The standard-decision task doesn't support this functionality - isn't it?
Does anybody solved such a problem?
Thank you for any hints!
Kind regards!
PeterHi Paramita,
Ok well you are on the right release but please do check your support pack for portal and your ECC system as well. You need to be on at least SP8 for both
Because then the answer is simple - just use the User Decision Handler option - User Decision with Note in the UWL config.
You'll find the description in the NW04s UWL configuration guide
http://help.sap.com/saphelp_nw04s/helpdata/en/39/a1bb5c4c0d4ab4a417e87ef35f1efa/frameset.htm
Look in Universal Worklist Configuration > Advanced Configuration > Task Launch Customization > Action Handlers > User Decision Handler
for samples and explanations of how to do this.
Also do search the forum for posts on user decisions as this topic has come up before.
Regards,
Jocelyn
Maybe you are looking for
-
IOS 8 Update and Composite AV cable
I have an Ipad 2. Before the IOS 8 update I was able to use an Apple brand composite AV cable to connect my ipad to my TV and watch videos from the internet (like youtube). Now that I have updated my Ipad I am no longer able to do that. The sound wil
-
So we had a power outage at my college today and a bunch of seniors were angry coz they hadn't saved when the power went out and lost hours of work. Sucks to be them. Anyways, I save regularly and I also version control all my files using Git and thi
-
Update multiple InDesign documents using XML
I am looking for a solution to update multiple files using XML. We have over 100 resumes in indesign and each resume has about a dozen projects (name, size, cost, location) I would like to keep all of the projects in a master file "projects.xml" and
-
Audition adds _01 to the file names of my audio files
.I record an input and give it a file name like My test audio. What I end up with is My test audio_01.wav. Strange behaviour.
-
Zen Micro battery won't charge, can't turn on MP3 pla
Hey guys, I;ve bought a Creative Zen Micro 5GB, 3 weeks ago and it was working GREAT...until now. I was using it one night until the battery completely drained off and the Zen Micro turned off by itself. The icon "LOW BATTERY" flashed for a few secon