on 11-25-2011 10:09 AM
Hai Friends,
I am new in workflow.
I created a simple workflow in TCODE : SWDD.
Its input is Time. What it is doing is if the time is > 12pm and < 10 am it will send mail to the workflow initiator's sap inbox.
When I give the input directly to the workflow it is working fine. But when I am trying to initiate it from a program, it is not working. The RETURN_CODE is 0 always. What to do?
CODE IS:
PARAMETERS time TYPE sy-uzeit.
DATA : RETURN_CODE LIKE SY-SUBRC,
WORKITEM_ID LIKE SWR_STRUCT-WORKITEMID,
NEW_STATUS TYPE SWR_WISTAT.
data : IT_CONTAINER TYPE TABLE OF SWR_CONT,
WA_CONTAINER TYPE SWR_CONT.
WA_CONTAINER-ELEMENT = 'TIME'.
WA_CONTAINER-VALUE = TIME.
APPEND WA_CONTAINER TO IT_CONTAINER.
CALL FUNCTION 'SAP_WAPI_START_WORKFLOW'
EXPORTING
TASK = 'WS99900167'
LANGUAGE = SY-LANGU
DO_COMMIT = 'X'
USER = SY-UNAME
* START_ASYNCHRONOUS = ' '
* DESIRED_START_DATE = DESIRED_START_DATE
* DESIRED_START_TIME = DESIRED_START_TIME
* DESIRED_START_ZONLO = SY-ZONLO
* IFS_XML_CONTAINER = IFS_XML_CONTAINER
IMPORTING
RETURN_CODE = RETURN_CODE
WORKITEM_ID = WORKITEM_ID
NEW_STATUS = NEW_STATUS
TABLES
INPUT_CONTAINER = IT_CONTAINER.
Thanks,
Anoop
Hi
Its very simple there could be two reasons,
1. The sy-uname who is starting the workflow might not have right authorizations, if this is a authoraizations issue in teh tables parmeter you can se this message saying missing authorizations.
2. The problem could be that since you are starting the workflow directly with out any eventing mechanism, so you have to make sure that the workflow template is made as general task to do this
1. Execute PFTC , choose the task type as workflow template, mention the workflow template ID without WS
2. open in change mdoe.
3. ON menu click Addtional data ---> Agent assignment ---> Maintain.
4. Choose the workflow template ID on the next screen and click ATTRIBUTES button on the applicaiton tool bar and finall choose General task.
3. Finally refresh the buffer by using SWU_OBUF transaction. and refresh org. environment by using SWUS txn.
finally restart the program.
Regards
Pavan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
SAP_WAPI_START_WORKFLOW has returning table parameter MESSAGE_LINES. Put a break point to the code, and see which message(s) the function returns. You will most probably find the reason for your problem.
Regards,
Karri
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
If you use SAP_WAPI_START_WORKFLOW then you have to set the workflow to General Task.
You should consider using events (and SAP_WAPI_CREATE_EVENT) instead, if there is an object involved.
" if the time is > 12pm and < 10 am"
That's never true. I think you mean 12am.
regards
Rick Bakker
hanabi technology
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.