Dear Experts,
while saving a transaction(t-code),i have to generate a message to sbwp of the user with 3 radio buttons(3 managers) and user will select particular manager in sbwp and submit.
on submission, the message will go to the particular manager and manager should have the option of accept or reject.if he selects accept, then a message should be sent to other two managers that it was accepted.If Reject was selected then a mail needs to be sent to the user that it was rejected.
Now can anyone tell me,how should i do this.
Kind Regards
Sajid
Request clarification before answering.
This can be accomplished by ABAP Program only just try to find an User Exit and put the coding there.
Thanks
Arghadip
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sajid
You can do this workflow flow itslef no need to go to EXIT. When ever some thing is done in F-47 trigger a workflow with a custom screen presenting the details of the 3 managers. When the initiator selects the any manager presented on the screen. You capture which manager he is selecting based on that create a user decision step with appropratiate manager. Do the same process for all.
Regards
vijay
Dear Experts,
I have found the enhancement spot, and i have written the following code to call the workflow
CALL FUNCTION 'SAP_WAPI_CREATE_EVENT'
EXPORTING
OBJECT_TYPE = 'BKPF'
OBJECT_KEY = var_obj_key "'100000140000152009'
EVENT = 'CREATED'
* COMMIT_WORK = 'X'
* EVENT_LANGUAGE = SY-LANGU
* LANGUAGE = SY-LANGU
USER = SY-UNAME
* IFS_XML_CONTAINER =
IMPORTING
RETURN_CODE = RETURN_CODE
EVENT_ID = EVENT_ID
* TABLES
* INPUT_CONTAINER =
* MESSAGE_LINES =
* MESSAGE_STRUCT = .In my workflow, i have defined a container Receiver to whom the mail should be sent.I have binded this with &_EVT_RECEIVER_ID& in the start conditions Create Event of BKPF object.
In the above code i also need to specify to which manager(Reciever) the mail should be sent. How can i specify that?
I suppose i have to pass the values in input_contyainer.But how can i do it (any sample code)?
Regards
Sajid
Edited by: shaik sajid on Jun 8, 2009 7:02 AM
You have to populate the Manager's User Id in the INPUT CONTAINER parameter.
Additionally I think it would be a better idea to use SAP_WAPI_START_WORKFLOW Function module since you are using enhancement point to trigger workflow
Check this code for Event.
Please note that in your requirement you have to create custom event and create a parameter Manager which is multiline and then use it.
FUNCTION zwf_process_trip.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(I_EMP_NUMBER) TYPE PERNR_D
*" VALUE(I_EMP_TRIP) TYPE REINR
*"----------------------------------------------------------------------
INCLUDE <cntn01> .
DATA:i_emp_details TYPE STANDARD TABLE OF p0001, "Employee Details
wa_request TYPE p0001, "Workarea for Employee details
v_country_grp TYPE molga, "Country SubGrouping
v_object_key TYPE sweinstcou-objkey. "Key for the buisness object ZWOBUSTRIP
CONSTANTS: c_bo_trip TYPE swo_objtyp VALUE 'ZWOBUSTRIP',
c_event_trip TYPE swo_event VALUE 'TripCreate',
c_infy_type_1 TYPE infty VALUE '0001'.
* Event Container declaration
swc_container i_event_cont.
swc_create_container i_event_cont.
* Reading the INFO TYPE 0001 to obtain the
* Employee details
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
pernr = i_emp_number
infty = c_infy_type_1
begda = sy-datum
endda = sy-datum
TABLES
infty_tab = i_emp_details
EXCEPTIONS
infty_not_found = 1
OTHERS = 2.
* SY-SUBRC check is not required as the error
* handelling will be done by WorkFlow rule
* resolution.
CLEAR wa_request.
READ TABLE i_emp_details INTO wa_request INDEX 1.
IF sy-subrc = 0.
* Retrieving the Country SubGrouping for the employee
SELECT SINGLE molga
FROM t001p
INTO v_country_grp
WHERE werks = wa_request-werks
AND btrtl = wa_request-persk.
ENDIF.
* Sending the relevant data to event container
swc_set_element i_event_cont 'EmpId' i_emp_number.
IF sy-subrc <> 0.
* No Processing needed.
ENDIF.
swc_set_element i_event_cont 'PersonnelArea' wa_request-werks.
IF sy-subrc <> 0.
* No Processing needed.
ENDIF.
swc_set_element i_event_cont 'CountryGrouping' v_country_grp.
IF sy-subrc <> 0.
* No Processing needed.
ENDIF.
swc_set_element i_event_cont 'EmpSubGrp' wa_request-persk.
IF sy-subrc <> 0.
* No Processing needed.
ENDIF.
swc_set_element i_event_cont 'EmpTripId' i_emp_trip.
IF sy-subrc <> 0.
* No Processing needed.
ENDIF.
* Raising the event to trigger the workflow
v_object_key = i_emp_number.
CALL FUNCTION 'SWE_EVENT_CREATE'
EXPORTING
objtype = c_bo_trip
objkey = v_object_key
event = c_event_trip
TABLES
event_container = i_event_cont
EXCEPTIONS
objtype_not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
* No Processing needed.
ENDIF.
COMMIT WORK.
ENDFUNCTION.Thanks
Arghadip
Edited by: Arghadip Kar on Jun 8, 2009 7:13 AM
Edited by: Arghadip Kar on Jun 8, 2009 7:14 AM
Edited by: Arghadip Kar on Jun 8, 2009 7:16 AM
Dear Arghadip Kar,
thanks for the code.But still there is a small problem.
Workflow is getting started (SBWP->outbox->started workflows) but there is error in the graphic that no agent with status as READY.
Actually i am passing the managers username (to which the mail id should be sent) through the function moduleSAP_WAPI_CREATE_EVENT.
swc_set_element i_event_cont 'RECEIVER' var_receiver.Receiver is a container in my workflow.
When the workflow executes, a mail will be sent to the manager (Receiver).For this in the user decision step, i have kept the Expression as &RECEIVER&. In the start condition of the business object BKPF i have binded &RECEIVER& with &_EVT_RECEIVER_ID&.
I think in workflow i did wrong somewhere.Can u pls tell me how to correct it as i am new to workflow.
Kind Regards
Sajid
Dear Arghadip,
I executed the FM and No Agents found.
EVT_RECEIVER should be binded with WF_INITIATOR.
I have binded EVT_RECEIVER with RECEIVER so that i have values of manager (Reciever) and user who requested (initiator) so that mail will be sent to manager for user decision and then on his rejection a mail will be sent to initiator.
Now if i bind EVT_RECEIVER with WF_INITIATOR then how will i be able to know who triggered this.
Regards
Sajid
Dear Arghadip,
I executed the FM and No Agents found.
EVT_RECEIVER should be binded with WF_INITIATOR.
I have binded EVT_RECEIVER with Receiver so that i have values of both the Manager(Receiver) and Requester (Initiator) because Manager gets a mail for user decision and then on rejection the reuqester will get a mail that it was rejected.
Now if EVT_RECEIVER should be binded with WF_INITIATOR. then how will i know the requestor to whom the mail should be sent.
Regards
Sajid
Dear Arghadip,
It is a user Decision step (approve / reject) and in its expression i have given &Receiver& and before that in the start conditions i have binded Receiver properly with &_EVT_RECEIVER_ID& of the business object BKPF create event. In my program while trigerring the workflow, i am sending to the container the receiver name.
CONCATENATE 'US' var_receiver into var_receiver.
swc_set_element i_event_cont '_EVT_RECEIVER_ID' var_receiver.Regards
Sajid
I think the EVTRECEIVER_ID will not be populated by the value that you are providing. This is a standard container element and gets populated with the Event receiver which is a Workflow Template. I think the value(Manager) needs to be determined inside the Wflow design.Just write a method and implement this in your Workflow
Thanks
Arghadip
Hi,
If its a Std SAP Tcode, Then find the appropraite exit/enhancement spot and trigger the WorkFlow using
SAP_WAPI_START_WORKFLOW passing the Radio button selected .
In one of the Steps, call a function to find the 3 managers .
Send USER DECISION to selected manger .
Based on decision , send mail to other 2 mangers/user.
If Custom generated Tcode, then do the above in your PAI.
Hope u find this useful
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
while saving a transaction(t-code),i have to generate a message to sbwp
of the user with 3 radio buttons(3 managers) and user will select particular
manager in sbwp and submit.For this you have to create a custom Webdynpro Screen
on submission, the message will go to the particular manager and manager
should have the option of accept or reject.if he selects accept, then a message
should be sent to other two managers that it was accepted.If Reject was selected
then a mail needs to be sent to the user that it was rejected.For this you can Create a User Decision having two branches (one for Approved, another for Rejected), below the Approved & Rejection branch create the 'send mail' step with the respective message.
Regards,
Surjith
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi
are you talking about transation in general or any particular set of transaction ??
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 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.