on 04-16-2012 9:20 AM
I tried to pass the value from program to a workflow ( the workflow is based on the workflow form so the container is the table structure ) via this source code but I am getting following error
"1 E The container passed has errors
2 E Structures of type 'ZMRNMASTER' cannot be assigned any constants"
data: t_wf_cont1 type swr_cont occurs 0 with header line.
move 'ZMRNMASTER' to t_wf_cont1-ELEMENT.
move '40000188' to t_wf_cont1-VALUE.
append t_wf_cont1.
t_task = 'WS97500055'.
CALL FUNCTION 'SAP_WAPI_START_WORKFLOW'
EXPORTING
task = t_task
LANGUAGE = SY-LANGU
DO_COMMIT = 'X'
USER = SY-UNAME
* START_ASYNCHRONOUS = ' '
* DESIRED_START_DATE =
* DESIRED_START_TIME =
* DESIRED_START_ZONLO = SY-ZONLO
* IFS_XML_CONTAINER =
IMPORTING
RETURN_CODE = retcode
WORKITEM_ID = workitemid
NEW_STATUS = newstatus
TABLES
*INPUT_CONTAINER1-VALUE
* INPUT_CONTAINER = INPUT_CONTAINER
INPUT_CONTAINER = t_wf_cont1
MESSAGE_LINES = MESSAGE_LINES
MESSAGE_STRUCT = MESSAGE_STRUCT
AGENTS = AGENTS
Hello,
I guess you can follow the direction sin this post :
http://scn.sap.com/thread/252219
Hope that helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
take a look at the container definition of the parameter ZMRNMASTER and try to start your WF with transaction SWUS to have a correct test case for your container.
Regards,
Gianluca
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
Is ZMRNMASTER an object? If so, here's an example of how to pass an object instance:
INCLUDE <CNTN01>.
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 (not necessary here)
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.
regards
Rick Bakker / hanabi technology
Hi,
To pass the value to a structure you can do like this way.
Sappose a structure ZMRNMASTER have 2 fields, a1 has size char10, a2 has size char10.
If you want to pass value to a2 . Then you write that way
data: t_wf_cont1 type swr_cont occurs 0 with header line.
move 'ZMRNMASTER' to t_wf_cont1-ELEMENT.
move ' 1234569 ' to t_wf_cont1-VALUE. " Here 10 spaces are there before 1234569
append t_wf_cont1.
I saw in your structure many fields are there. Count all the length of fields which is there before the field ZMR_NO. Pass that much spaces then the original you want to pass in t_wf_cont1-VALUE
Gianluca,
I tried following code and got this error
"t_wf_cont1-VALUE and ls_tab are not mutually convertable in a unicode program "
data: t_wf_cont1 type swr_cont occurs 0 with header line.
move 'ZMRNMASTER' to t_wf_cont1-ELEMENT.
data: ls_tab type ZMRNMASTER.
ls_tab-ZMR_NO = '40000188' .
t_wf_cont1-VALUE = ls_tab.
Hi,
...UNICODE... the quickest way to close your test is to try as suggested by Anjan Paul.
Regards,
Gianluca
I tried your code by its giving me following short dump
"Type conflict at call of a method."
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 (not necessary here)
swc_clear_container lt_wf_cont.
lv_object_instance-objtype = 'ZMR_NO'.
lv_object_instance-objkey = '40000188'.
lt_wf_cont-element = 'ZMRNMASTER'.
lt_wf_cont-value = lv_object_instance.
append lt_wf_cont.
I read the input container via FM SAP_WAPI_READ_CONTAINER
and the input container after reading look like that
Line ELEMENT VALUE
1 _WF_INITIATOR USSHAHS
2 _WF_PRIORITY 5
3 _WF_VERSION 0000
4 _WF_NESTING_LEVEL
5 ZMRNMASTER
6 _WI_GROUP_ID
7 _WORKITEM FLOWITEM 000000968263 * <OBJECT>*
8 _PREDECESSOR_WI
9 MRN
______________________________
data: t_wf_cont1 type swr_cont occurs 0 with header line.
move 'ZMRNMASTER' to t_wf_cont1-ELEMENT.
move ' 1234569 ' to t_wf_cont1-VALUE. " Here 10 spaces are there before 1234569
append t_wf_cont1.
******
*data: t_wf_cont1 type swr_cont occurs 0 with header line.
*move 'ZMRNMASTER' to t_wf_cont1-ELEMENT.
*move '40000188' to t_wf_cont1-VALUE.
*append t_wf_cont1.
t_task = 'WS97500055'.
CALL FUNCTION 'SAP_WAPI_START_WORKFLOW'
EXPORTING
task = t_task
LANGUAGE = SY-LANGU
DO_COMMIT = 'X'
USER = SY-UNAME
* START_ASYNCHRONOUS = ' '
* DESIRED_START_DATE =
* DESIRED_START_TIME =
* DESIRED_START_ZONLO = SY-ZONLO
* IFS_XML_CONTAINER =
IMPORTING
RETURN_CODE = retcode
WORKITEM_ID = workitemid
NEW_STATUS = newstatus
TABLES
*INPUT_CONTAINER1-VALUE
* INPUT_CONTAINER = INPUT_CONTAINER
INPUT_CONTAINER = t_wf_cont1
MESSAGE_LINES = MESSAGE_LINES
MESSAGE_STRUCT = MESSAGE_STRUCT
AGENTS = AGENTS
if you want the system access then send me an email on safeershah@hotmail.com
I tried following code but got the short dump "Type conflict when calling a function module (field length)"
data: t_wf_cont1 type swr_cont occurs 0 with header line.
move 'ZMRNMASTER' to t_wf_cont1-ELEMENT.
move ' 1234569 ' to t_wf_cont1-VALUE. " Here 10 spaces are there before 1234569
append t_wf_cont1.
t_task = 'WS97500055'.
CALL FUNCTION 'SWW_WI_START_SIMPLE'
EXPORTING
CREATOR = 'SHAHS '
* PRIORITY = SWFCO_NO_PRIO
TASK = t_task
* CALLED_IN_BACKGROUND = ' '
* DEADLINE_DATA = ' '
* NO_DEADLINE_PARAMETERS = ' '
* IMPORTING
* WI_ID =
* WI_HEADER =
* RETURN =
* WI_RESULT =
* SWF_RETURN =
TABLES
AGENTS = AGENTS
* DEADLINE_AGENTS =
* DESIRED_END_AGENTS =
* LATEST_START_AGENTS =
* EXCLUDED_AGENTS =
* NOTIFICATION_AGENTS =
* SECONDARY_METHODS =
WI_CONTAINER = t_wf_cont1
* 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 <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Hi,
What type structure 'ZMRNMASTER' it is. I think it not simple integer or string value. I think it has some different no of fields. Then it passing only single value will not work.
If ZMRNMASTER is only structure of integer. Then try to pass 40000188 without single code ' '.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.