on 10-16-2007 7:21 AM
Hi Sapgurus,
I have made a scenerio in which if user enters the measuring point value greater than target value in IK11 then a notification is generated *(i.e IW21) now i want when this notification is generated a workflow should trigger that can intimate user that the notification has been generated my problem is when i try to trigger it i get the short dumb saying
The call of a COMMIT WORK in a FORM, that will not be executed until
the commit or rollback point of the caller using the variant
PERFORM ... ON COMMIT or PERFORM ... ON ROLLBACK is not permitted.
Could anyone please tell mee what is the reason below is the code which i m writing to trigger the workflow.
*&!!!@@@@@@@@@@##############$%%%%%%%%%%^^^^^^^^^^^^^^^&&&&&&&&&&&&&&&&&&&&&
CLEAR wa_swcont.
wa_swcont-element = 'FLAG'.
wa_swcont-elemlength = '001'.
wa_swcont-type = 'I'.
lv_test = p_key.
wa_swcont-value = lv_test.
APPEND wa_swcont TO i_container.
it_container-container = p_key.
append it_container.
*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
CALL FUNCTION 'SAP_WAPI_START_WORKFLOW'
EXPORTING
TASK = 'WS99900237'
LANGUAGE = SY-LANGU
DO_COMMIT = 'X'
USER = SY-UNAME
START_ASYNCHRONOUS = ' '
DESIRED_START_DATE =
DESIRED_START_TIME =
DESIRED_START_ZONLO = SY-ZONLO
IFS_XML_CONTAINER =
IMPORTING
RETURN_CODE =
WORKITEM_ID =
NEW_STATUS =
*TABLES
INPUT_CONTAINER = it_container
MESSAGE_LINES =
MESSAGE_STRUCT =
AGENTS =
.
CALL FUNCTION 'SWE_EVENT_CREATE'
EXPORTING
OBJTYPE = 'BUS2038'
OBJKEY = p_key
EVENT = 'CREATED'
CREATOR = ' '
TAKE_WORKITEM_REQUESTER = ' '
START_WITH_DELAY = ' '
START_RECFB_SYNCHRON = ' '
NO_COMMIT_FOR_QUEUE = ' '
DEBUG_FLAG = ' '
NO_LOGGING = ' '
IDENT =
IMPORTING
EVENT_ID =
TABLES
EVENT_CONTAINER =
EXCEPTIONS
OBJTYPE_NOT_FOUND = 1
OTHERS = 2
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
wa_agents-objid = 'BSPDEV01'.
APPEND wa_agents TO i_agents.
*CALL FUNCTION 'SWW_WI_START_SIMPLE'
EXPORTING
CREATOR = ' '
PRIORITY = SWFCO_NO_PRIO
TASK = 'WS99900237'
CALLED_IN_BACKGROUND = ' '
DEADLINE_DATA = ' '
NO_DEADLINE_PARAMETERS = ' '
IMPORTING
WI_ID =
WI_HEADER =
RETURN =
WI_RESULT =
SWF_RETURN =
TABLES
AGENTS = i_agents
DEADLINE_AGENTS =
DESIRED_END_AGENTS =
LATEST_START_AGENTS =
EXCLUDED_AGENTS =
NOTIFICATION_AGENTS =
SECONDARY_METHODS =
WI_CONTAINER = i_container
CHANGING
WI_CONTAINER_HANDLE =
EXCEPTIONS
ID_NOT_CREATED = 1
READ_FAILED = 2
IMMEDIATE_START_NOT_POSSIBLE = 3
EXECUTION_FAILED = 4
INVALID_STATUS = 5
OTHERS = 6
.
*IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*ENDIF.
*
*
**commit WORK.
endif.
I have used the all the FM to triiger workflow but getting the same dumb again and again.
the FM i have user are
1. SAP_WAPI_START_WORKFLOW
2. SWE_EVENT_CREATE
3. SWW_WI_START_SIMPLE
All are giving the same dumb.
Please help me out.
Thanks and Regards,
Rachit Khanna
Hi Rachit,
Another thought ! If you just need to send a notification , I think no need to go for workflow !
As you are using the SWE_EVENT_CREATE , I hope you already have the user-exit available. Check based on these required condition, use FM to send mail.
Regarding your point about error/dump, as transaction IW21 has not yet been completed and still you are executing <b>commit work</b> statement for raising the event, dump might be occuring.
Hope this helps to start off..
Regards,
Akshay
Message was edited by:
Akshay Bhagwat
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Karuna,
I am now able to trigger the workflow but the problem is that in my SBWP inbox the title is coming in German Language the code which i m writing to trigger the workflow is :-
CALL FUNCTION 'SWE_EVENT_CREATE'
EXPORTING
OBJTYPE = 'BUS2038'
OBJKEY = 'WS99900237'
EVENT = 'CREATED'
CREATOR = ' '
TAKE_WORKITEM_REQUESTER = ' '
START_WITH_DELAY = ' '
START_RECFB_SYNCHRON = ' '
NO_COMMIT_FOR_QUEUE = ' '
DEBUG_FLAG = ' '
NO_LOGGING = ' '
IDENT =
IMPORTING
EVENT_ID =
TABLES
EVENT_CONTAINER =
EXCEPTIONS
OBJTYPE_NOT_FOUND = 1
OTHERS = 2
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Could i can have the title in my SAP inbox as English.
And one more thing if i want that when the mail is send to the outlook through my report can i do something so that i can know that the user has read the mail or not.
Thanks and Regards,
Rachit Khanna
Hi Rachit,
In such case , you will have to go with workflow option, that too you will have to use work items for the same. i.e use a custom dummy method - which does nothing- so that you can create task basedon this method and then assign required agent. So that user receives Work item in his inbox when workflow is triggered.
Also You can use deadline monitoring , such that if he does not act on this work item for say 1 day, then you can intimate his manager or some admin person etc etc..and in turn make sure that person sees / executes the work item.
Hope this serves your requirement.
Regards,
Akshay
Hi Khanna,
>if user enters the measuring point value greater than target value in IK11 then a >notification is generated
My openion, why do not you use Start condition using tcode SWB_COND, start conditions are used for triggering EVENTS only.
Ex:
If greater than xxx value ,
True -
> Start Workflow
False -
> No Action
Thanks and Regards,
Prabhakar Dharmala
Hi Akshay ,
Thanks for your reply but i m really confused for BOR objects role, its use i have read the forums also but not able to understand the importance of BOR objects in Workflow.
My second doubt is how to pass the value from my program to workflow container element.
I tried to create my own BOR object but not able to do so.
I have seen in the forums that when we are using the FM SWE_EVENT _CREATE
CALL FUNCTION 'SWE_EVENT_CREATE'
EXPORTING
OBJTYPE = 'BUS20838'
OBJKEY = p_key
EVENT = 'CREATED'
what we have to give in OBJTYPE ?
Do we have to give my workflow name or the BOR object name
In OBJKEY what i have to give?
the value that i want to pass in my workflow ot some other thing
Please help me out as i m really very confused.
Please..........
Thanks and Regards,
Rachit Khanna
Hi Rachit,
Pls fine pointwise reply:
1. Object type is the type name whch you have created in SWO1.
e.g refer Object BUS1001006 i.e. material in SWO1 and you will have an idea.
2. Object nkey is the key field which oyu have used for your custom BO type.
e.g. In case of material object it is material number i.e. value of matnr from mara table.
Hope it helps to resolve your confusion.
Regards,
Akshay
Some points would be nice if it helps
> my problem is when i try to trigger it i get the short dumb saying
>
> The call of a COMMIT WORK in a FORM, that will not be executed until the commit or rollback point of the caller using the variant PERFORM ... ON COMMIT or PERFORM ... ON ROLLBACK is not permitted.
>
So, the code you have written is being called as part of a "PERFORM ... ON COMMIT" - which means you can not have any COMMIT WORK statements, explicitly or implicitly.
> Could anyone please tell mee what is the reason below is the code which i m writing to trigger the workflow.
>
Yes. I can.
CALL FUNCTION 'SAP_WAPI_START_WORKFLOW'
EXPORTING
TASK = 'WS99900237'
LANGUAGE = SY-LANGU
DO_COMMIT = 'X'
USER = SY-UNAME
...
You must pass space to the DO_COMMIT parameter.
<i>Message was edited by Kjetil Kilhavn:</i>
Sorry, but apparently the tags for CODE don't work any longer (or today, or whatever)... so the alignment isn't optimal.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well, I thought I wouldn't spell it out in detail for you, but OK...
There's a parameter for controlling COMMIT also for the function module SWE_EVENT_CREATE (which you should replace with SAP_WAPI_CREATE_EVENT if it is in your own code).
Now, please do put a little more effort into it yourself next time. Don't expect us to do your job, when you ask for help you should expect guidance - not code that you can copt & paste.
Check the Code below it is with SWE_EVENT_CREATE.
<b>Reward Points if useful</b>
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
75 | |
9 | |
7 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.