cancel
Showing results for 
Search instead for 
Did you mean: 

Error while starting worflow

Former Member
0 Kudos

Hello everyone

I am trying to start a workflow from my program and for this I have written the following code:

LV_WIID TYPE SWW_WIID,
      ls_input_container TYPE swr_cont,
      lt_input_container TYPE TABLE OF swr_cont,
      lt_message_lines TYPE sapi_msg_lines,
      ls_agents TYPE tswhactor with header line.

ls_agents-OTYPE = 'ZN'.
ls_agents-OBJID = 'Ztest'.
APPEND ls_agents.
ls_input_container-element = 'bus_act'.
ls_input_container-value = 'RFBU'.
APPEND ls_input_container TO lt_input_container .
ls_input_container-element = 'header_txt'.
ls_input_container-value = 'test doc'.
APPEND ls_input_container TO lt_input_container .
ls_input_container-element = 'comp_code'.
ls_input_container-value = '001'.
APPEND ls_input_container TO lt_input_container .
ls_input_container-element = 'doc_date'.
ls_input_container-value = sy-datum.
APPEND ls_input_container TO lt_input_container .
ls_input_container-element = 'pstng_date'.
ls_input_container-value = sy-datum.
APPEND ls_input_container TO lt_input_container .
ls_input_container-element = 'fisc_year'.
ls_input_container-value = '2010'.
APPEND ls_input_container TO lt_input_container .
ls_input_container-element = 'fis_period'.
ls_input_container-value = '00'.
APPEND ls_input_container TO lt_input_container .
ls_input_container-element = 'doc_type'.
ls_input_container-value = 'JE'.
APPEND ls_input_container TO lt_input_container .
ls_input_container-element = 'ref_doc_no'.
ls_input_container-value = 'test 1234'.
APPEND ls_input_container TO lt_input_container .

CALL FUNCTION 'SAP_WAPI_START_WORKFLOW'
  EXPORTING
    TASK                      = 'ZZ10000001'
   USER                      = sy-uname
 IMPORTING
   RETURN_CODE               = L_RETURN_CODE
   WORKITEM_ID               = LV_WIID
 TABLES
   INPUT_CONTAINER           = lt_input_container
   MESSAGE_LINES             = lt_message_lines
   AGENTS                    = ls_agents

if sy-subrc = 0.
  commit work.
endif.

but I am getting workflow id value as '0'... I tried to debug and I am getting this error message: "Import container contains errors (are any obligatory elements missing?)"

Can you please what I am missing.

Thanks,

Rajat

Edited by: rajatg on Jun 11, 2010 2:51 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

As the error suggest some Manadatory parameter is missing while you trigger the Workflow. Please make all the parameters optional in Your Workflow Container.

Thanks

Arghadip

Former Member
0 Kudos

Thanks for the reply, Arghadip.

I am not a worflow person and I am just working on a program where I need to start a workflow, so can you please tell me how can I make my fields optional in the workflow container.

Former Member
0 Kudos

You need to go to PFTC Tcode provide the template number and click on container tab and search with container having yellow icon.Doubleclick on that container element and go to second tab wher you have to uncheck Mandactory

Thanks

Arghadip

Answers (0)