on ā2014 Nov 17 7:45 AM
Dear Consultants,
I am creating a custom workflow , where i am sending work item to all first level approvers at the same time and taking approval of all approvers.
This has been achieved by parallel block profetch. However i am stuck with some scenario -
1. I want to send outlook mail to requestor's outlook ID
2. an outlook mail to all approvers ( With table in item text ,where detail and approver list should appear)
3. an most importantly i want if one of the approver rejects the work item , that work item should go to requestor for edit and resend the item only to the approver who has reected that item, but all the work work item should not go to the all approvers who have already approved the task?
Anyone has any idea?
Thanks
Request clarification before answering.
Hello
hey i am stuck with this ? Also i have one question how to send request agin to requester ?
Do you have any document ,ehich can help me out?
In the same rejection branch, save the rejection agent (_ACTUAL_AGENT from the task to the workflow in a new variable)., say in LV_REJ_AGENT of type SWHACTOR. Pass it back from the block to the workflow
After the block , send a revision item to the workflow initiator if LV_REJECTED = 'X', clear the rejection flag, after that activity of WF Initiator, loop back to top of block, replace the agent table with the LV_REJ_AGENT saved in the rejection branch.
I have created a task to read values but where i hae to creae container?
DATA: ztask_wi_id type SWWWIHEAD-WI_ID,
it_container type table of swr_wihdr,
wa_container type swr_wihdr,
lv_rej_agent type SWHACTOR.
swc_get_element container 'ztask_wi_id' ztask_wi_id.
CALL FUNCTION 'SAP_WAPI_READ_CONTAINER'
EXPORTING
workitem_id = ztask_wi_id
language = sy-langu
TABLES
simple_container = it_container
* MESSAGE_LINES =
* MESSAGE_STRUCT =
* SUBCONTAINER_BOR_OBJECTS =
* SUBCONTAINER_ALL_OBJECTS =
.
IF sy-subrc = 0.
READ TABLE it_container INTO wa_container WITH KEY WI_AAGENT = '_WI_ACTUAL_AGENT'.
ENDIF.
swc_set_element container '_WI_ACTUAL_AGENT' lv_rej_agent.
*MOVE wa_container-value TO reqndetails-employeeid.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sudhanshu
Why did we create a method to manipulate the container?
We need to use a loop step.
the workflow logic should look like this:
1) Start -> Get agents
2) Start loop -> end condition can be LV_APPROVED = 'X'
3) Start Block (with local container data as necessary) - end condition correctly setup - pass back necessary variables back to workflow in binding to read later on
4) End block
5) IF LV_REJECTED = 'X', send workitem to _WF_INITIATOR (available in the workflow container) - After WI completion, loop back to send the WI to the Agnets (you can overwrite the agents table with Actual Agent
6) IF LV_REJECTED <> 'X' - set LV_APPROVED = 'X' so that the loop ends
Regards,
Modak
also check http://scn.sap.com/thread/3603384
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sudhanshu
1) Your screen shot is not that clear to know the business process? What is the BO which you are using? Can't you use the code given below to get the PD responsible in SRM (all you need to supply is the Doc Guid and type ... type for example, for SC will be BUS2121, PO, BUS2201....
Use this code in a new method and get the Document responsible (you can additionally concatenate it with preceding 'US' for the user ID. Receive the result in structure of type SWHACTOR. Use this in the email step as 'Expression' and type ID as 'G' - Org Object
It does not matter if it's SRM System, if the SRM Org Structure has communication Infotype 0105 maintained, emails can be picked up from there. But I guess SU01 approach would be better for your case.
2) for the second case, better use only the approver IDs with a leading US and follow the same approach of SU01/SO16/ Type ID G to send the email
3) All the best for this item
Regards,
Modak
here is the code for getting the PD responsible (my code revolves around PO and SC, you can include BUSxxxxx for Confirmation
DATA lo_wf_pdo TYPE REF TO /sapsrm/if_wf_pdo.
DATA lx_pdo_ex TYPE REF TO cx_static_check.
DATA lt_document_responsible TYPE /sapsrm/t_wf_agent_id.
DATA lr_document_responsible TYPE REF TO /sapsrm/wf_agent_id.
*IV_DOCUMENT_TYPE is of type /SAPSRM/WF_DOCUMENT_TYPE
*IV_DOCUMENT_GUID is of type/SAPSRM/WF_DOCUMENT_GUID
* ev_document_responsible is of type /SAPSRM/WF_AGENT_ID
TRY.
* Get shopping cart / PO instance
lo_wf_pdo ?= /sapsrm/cl_wf_pdo_impl_factory=>get_instance(
iv_document_guid = iv_document_guid
iv_document_type = iv_document_type
).
* Get owner of shopping cart / PO
lt_document_responsible = lo_wf_pdo->get_document_responsible( ).
READ TABLE lt_document_responsible REFERENCE INTO lr_document_responsible INDEX 1.
ASSERT ID /sapsrm/wf_cfg CONDITION sy-subrc = 0.
IF sy-subrc NE 0.
RETURN.
ENDIF.
ev_document_responsible = lr_document_responsible->*.
CATCH /sapsrm/cx_pdo_abort INTO lx_pdo_ex.
RETURN.
CATCH /sapsrm/cx_pdo_error INTO lx_pdo_ex.
RETURN.
ENDTRY.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Modak,
This is a SRM system and i working on custom requirement . Which has nothing to do with SC, PO and GRN.
Business process is like this -
There is one custom web dynpro screen , where user will enter some data and based on cost center it will go for the approval .and at the end it will update one table.
Almost there...
Regards,
Modak
Hi Sudhanshu
1) Outlook email to requester -> where is the email maintained? In SU01 or HR Infotype 0105?
If either of these, just set the email recipient as workflow initiator (expression) (type ID G) in the standard email step.
Go to txn SO16->Tab MailSys Grp -> Select Send to user's home address (this has to be done in all systems once.) - This will enable the workflow to pickup the email address from HR Infotype or SU01 the moment it encounters the above(Type ID G and User ID WF initiator) (if you are using SU01, make sure that just below the email ID, you select the 'communication type' as 'Internet')
2) Not very sure what you want to display in point two email - please elaborate.
To send the email, just keep "Appending" the _ACTUAL_AGENT from the decision step to a workflow container variable of type TSWHACTOR (in the binding from the task to the workflow, use the double arrow button) (http://scn.sap.com/docs/DOC-3036)
Once you have the list of all approvers, bind it back from Block striucture to the workflow and just send an email like above, TYPE ID G, select expression as that table (of type TSWHACTOR) (provided you do SO16 settings)
3) In the rejection branch , set a variable (using container operation), say LV_REJECTED = 'X'. pass this back from block to WF. In the END condition of the Block, check for this LV_REJECTED = X . This will end the block the moment it is rejected.
In the same rejection branch, save the rejection agent (_ACTUAL_AGENT from the task to the workflow in a new variable)., say in LV_REJ_AGENT of type SWHACTOR. Pass it back from the block to the workflow
After the block , send a revision item to the workflow initiator if LV_REJECTED = 'X', clear the rejection flag, after that activity of WF Initiator, loop back to top of block, replace the agent table with the LV_REJ_AGENT saved in the rejection branch.
Regards,
Modak
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Modak,
Believe or not , i was expecting your answer only š I followed your posts and those were interesting. being new in the workflow concept , i could take only some of it .
1. I want to send outlook mail to requestor of confirmation that request has been submitted. and item text should contain the list of approvers agains the cost center . Which i have in my container ET_agents.However i am not sure from where to take requester ID and email.
2. i want to send same mail to all the approvers with same ITEM text.
I have takedn all the approvers email in one container in agent determination stage only , and attached the container directly in send mail and it is serving my purpose. But i want to attach cost center and there approver's list too. Which i am not able to do.
3. Let me apply your suggestion , and i will come back with question:-)
| User | Count |
|---|---|
| 8 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.