Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Pass parameter to workflow container

Former Member
0 Kudos

Hi all,

I have called the workflow through program and in the workflow there is one oblligatory element AbsenceForm and i am passing the value through the program by WI_CONTAINER. My problem the value is not passing correctly and the following error is comming when i execute the program .

Import container contains errors (are any obligatory elements missing?)

Please see the following code

INCLUDE <CNTN01>.

TABLES:
 ZCL_LEAVE_WFLOW.

* define table type for data exchange
  TYPES:
    BEGIN OF MYTABLE_LINE,
      LINE TYPE SWC_VALUE,
    END OF MYTABLE_LINE.

DATA:
  FS_MYLINE TYPE MYTABLE_LINE,
  FS_AGENTS TYPE SWHACTOR,
  FS_SWCONT TYPE SWCONT.

DATA:
  OK_CODE LIKE SY-UCOMM,         " return code from screen
  G_REPID LIKE SY-REPID.

  DATA:
* Reference to wrapper class of control based on OO Framework
    G_EDITOR          TYPE REF
                        TO CL_GUI_TEXTEDIT,
* Reference to custom container: necessary to bind TextEdit Control
    G_EDITOR_CONTAINER TYPE REF
                        TO CL_GUI_CUSTOM_CONTAINER.


  DATA:
    T_MYTABLE TYPE TABLE               " To store text in text editor
                OF MYTABLE_LINE,
    T_AGENT   TYPE TABLE               " To store agents
                OF SWHACTOR,
    T_SWCONT  TYPE TABLE               " To store Instance Structure
                OF SWCONT.
  SWC_CONTAINER T_SWCONT.
  SWC_SET_ELEMENT T_SWCONT 'ABSENCEFORM' '0000000005'. "AbsenceForm
  SWC_CONTAINER_TO_PERSISTENT T_SWCONT.

  CALL FUNCTION 'SWW_WI_START_SIMPLE'
    EXPORTING
*     CREATOR                            = sy-uname
*     PRIORITY                           = SWFCO_NO_PRIO
      TASK                               = 'WS30000015'   
*     CALLED_IN_BACKGROUND               = ' '
*     DEADLINE_DATA                      = ' '
*     NO_DEADLINE_PARAMETERS             = ' '
*   IMPORTING
*     WI_ID                              =
*     WI_HEADER                          =
*     RETURN                             =
*     WI_RESULT                          =
*     SWF_RETURN                         =
    TABLES
      AGENTS                             = T_AGENT
*     DEADLINE_AGENTS                    =
*     DESIRED_END_AGENTS                 =
*     LATEST_START_AGENTS                =
*     EXCLUDED_AGENTS                    =
*     NOTIFICATION_AGENTS                =
*     SECONDARY_METHODS                  =
     WI_CONTAINER                       = T_SWCONT
*   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 NE 0.
     MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

Please suggest me what is the exact problem here.

Thanks in advance,

Mahi.

5 REPLIES 5

rejish_balakrishnan
Contributor
0 Kudos

Hi,

Was the workflow active and without any errors.Becoz it seems like a interface connectivity is missing here.

0 Kudos

Yes RBK it is in active and another thing is it is standard workflow.

I need to call custusomise workflow if the present callling is done perfectly....

0 Kudos

Hi Mahi,

Then the problem could any of these.

What is the object type of absence form ?

Does WI_CONTAINER have same structure or data type or reference as like Absence Form.

Make sure you have one container element for the std work flow.This u could check with executing the work flow separately..

Also tell us the work flow number .Let me have a glance at it.

0 Kudos

Hi RBK,

object type is FORMABSENC

My workflow number is WS30000015 and my prgram is pasted previously plese chek my basic tread.

I am very new to workflow please guid me how to solve the error.

Thanks in advance,

Mahi

0 Kudos

Hi

Provide task instead of workflow in exporting parameter.

Connectivity should be

BO-taskworkflow .

call function SWW_WI_START_SIMPLE
exporting
task = TS30000016