cancel
Showing results for 
Search instead for 
Did you mean: 

Workflow not triggering

former_member183835
Participant
0 Kudos

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

Accepted Solutions (0)

Answers (3)

Answers (3)

bpawanchand
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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

former_member185167
Active Contributor
0 Kudos

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