on 02-25-2009 10:45 AM
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?)
How to pass the parameters to workflow by using the following function module.
fs_swcont-element = 'AbsenceForm'.
fs_swcont-type = 'C'.
fs_swcont-value = '0000000013'.
append fs_swcont to 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.
ENDFORM. " call_workflow
Thanks in advance,
Mahi.
Hello,
Thanks for posting the code, even better if you'd included the variable declarations so we can cut&paste to try it out.
But in any case I think I have the answer:
Use
fs_swcont-element = 'ABSENCEFORM'
instead of
fs_swcont-element = 'AbsenceForm'
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.
According to Rick Suggestion i have modified the value to upller case, even then it is not working .
See my entaire code related to workflow calling.
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.
FS_SWCONT-ELEMENT = 'ABSENCEFORM'.
FS_SWCONT-TYPE = 'C'.
FS_SWCONT-VALUE = '0000000013'.
APPEND FS_SWCONT TO T_SWCONT.
PERFORM FILL_INSTRUCT.
CALL FUNCTION 'SWW_WI_START_SIMPLE'
EXPORTING
* CREATOR = sy-uname
* PRIORITY = SWFCO_NO_PRIO
TASK = 'WS30000015' "'WS80000018'
* 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 how to pass the values to workflow
In the workflow the element ABSENCEFORM is Mandatory so i am getting following error message.
Import container contains errors (are any obligatory elements missing?)
Hey Ruslim Chang,
I am not able to understand your modification and error is comming when i am replacing your code and i did not create any object in my program.
Thanks,
Mahi
Hello,
The uppercase problem was the first one I encountered, it seems there are more.
Try this, I think it will solve your problem:
INCLUDE <CNTN01>.
data: lv_rc like sy-subrc.
data: lt_messages type standard table of SWR_MESSAG.
data:
begin of lv_object_instance,
objtype type swo_objtyp,
objkey type swo_typeid,
end of lv_object_instance.
* Define the container
swc_container lt_wf_cont.
* Create the container
swc_create_container lt_wf_cont.
* Clear the container
swc_clear_container lt_wf_cont.
lv_object_instance-objtype = 'FORMABSENC'.
lv_object_instance-objkey = '0000000088'.
lt_wf_cont-element = 'ABSENCEFORM'.
lt_wf_cont-value = lv_object_instance.
append lt_wf_cont.
CALL FUNCTION 'SAP_WAPI_START_WORKFLOW'
EXPORTING
TASK = 'WS30000015'
* LANGUAGE = SY-LANGU
DO_COMMIT = 'X'
* USER = SY-UNAME
* START_ASYNCHRONOUS = ' '
* DESIRED_START_DATE =
* DESIRED_START_TIME =
* IMPORTING
RETURN_CODE = lv_rc
* WORKITEM_ID = lv_wfid
* NEW_STATUS = lv_wistat
TABLES
INPUT_CONTAINER = lt_wf_cont
MESSAGE_LINES = lt_messages
* MESSAGE_STRUCT =
* AGENTS =
.
You should be using SAP_WAPI_START_WORKFLOW, not SWW_WI_START_SIMPLE.
regards
Rick Bakker
Hanabi Technology
Hi Mahi,
I think the problem is with the way you populate your container. Change your code in this way:
fs_swcont-element = 'AbsenceForm'.
fs_swcont-type = 'C'.
fs_swcont-value = '0000000013'.
append fs_swcont to t_swcont.
to
SWC_CREATE_OBJECT OBJECT 'ABSENCEFORM' '0000000013'.
SWC_SET_ELEMENT WI_CONTAINER 'AbsenceForm' OBJECT.
SWC_CONTAINER_TO_PERSISTENT WI_CONTAINER.
Regards,
Lim...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Check the below sample code for the FM call:
DATA: L_WF_CONTAINER TYPE WF_CONTAINER_ENTRY OCCURS 0.
EMPLOYEE_OBJKEY-PERNR = X_PERNR.
EMPLOYEE_OBJKEY-BEGDA = SY-DATUM.
SWC_CREATE_OBJECT BUSINESSOBJECT 'EMPLOYEET' EMPLOYEE_OBJKEY.
SWC_SET_ELEMENT L_WF_CONTAINER 'Employee' BUSINESSOBJECT.
"LIUAL0K074950
SWC_SET_ELEMENT L_WF_CONTAINER 'EMPLOYEE' BUSINESSOBJECT.
"LIUAL0K074950
YEA year to container
SWC_SET_ELEMENT L_WF_CONTAINER 'YEAYEAR' X_YEAYEAR.
start workflow
CALL FUNCTION 'SWW_WI_START_SIMPLE'
EXPORTING
TASK = L_WF_ID
IMPORTING
RETURN = L_WF_RETURNCODE_START_WF
TABLES
AGENTS = L_WF_AGENTS
WI_CONTAINER = L_WF_CONTAINER .
Regards,
Sivagami
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.