cancel
Showing results for 
Search instead for 
Did you mean: 

Problem When Transferring Values from program to workflow

safeer_shah2
Participant
0 Kudos

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

Accepted Solutions (0)

Answers (3)

Answers (3)

vimalv
Active Participant
0 Kudos

Hello,

I guess you can follow the direction sin this post :

http://scn.sap.com/thread/252219

Hope that helps.

Former Member
0 Kudos

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

safeer_shah2
Participant
0 Kudos

ZMRNMASTER is a table structure I want to pass the value in a field of this structure right now or more fields later , right now i want to move value in ZMRNMASTER-ZMR_NO ( Material rejection number ) field

safeer_shah2
Participant
0 Kudos
safeer_shah2
Participant
0 Kudos

for the refernce i posted screenshots so you can have better idea

Former Member
0 Kudos

Hi,

   try creating a local variable ls_tab type ZMRNMASTER,

ls_tab-ZMR_NO = '40000188' .

t_wf_cont1-VALUE = ls_tab.

...

Regards,

     Gianluca


former_member185167
Active Contributor
0 Kudos

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

anjan_paul
Active Contributor
0 Kudos

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

safeer_shah2
Participant
0 Kudos

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.

Former Member
0 Kudos

Hi,

   ...UNICODE... the quickest way to close your test is to try as suggested by Anjan Paul.

Regards,

     Gianluca

safeer_shah2
Participant
0 Kudos

Rick is not an object i.e. not an business object, the workflow is based on form so the ZRMNMASTER is a structure , you can see in above screen shots

safeer_shah2
Participant
0 Kudos

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.

safeer_shah2
Participant
0 Kudos

Paul,

i tried your code too but i got the same error which I posted in the begining of my issue

"1 E The container passed has errors

2 E Structures of type 'ZMRNMASTER' cannot be assigned any constants"

safeer_shah2
Participant
0 Kudos

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

______________________________

Former Member
0 Kudos

Hi,

     create a copy of the structure ZRMNMASTER as local type and substitute all the numeric field of the ZRMNMASTER with char type of the same lenght, then try again

ls_tab type (NEW_ZMRNMASTER),

ls_tab-ZMR_NO = '40000188' .

t_wf_cont1-VALUE = ls_tab.

Regards,

    Gianluca

anjan_paul
Active Contributor
0 Kudos

Give your code

safeer_shah2
Participant
0 Kudos

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

anjan_paul
Active Contributor
0 Kudos

Hi,

Here you pass

  *move  '40000188' to t_wf_cont1-VALUE

I told you first take all size of the fields which is there before ZMR_NO field. then

put that no of spaces in single code, then put element value look like

*move   '                                                     40000188'  to t_wf_cont1-VALUE


safeer_shah2
Participant
0 Kudos

there is only MANDT field before ZMR_No so i put 3 space before ZMR_NO. the line your are talking about is commited so it cant effect the code

safeer_shah2
Participant
0 Kudos

if you want the system access then send me an email on safeershah@hotmail.com

anjan_paul
Active Contributor
0 Kudos

I think structure size is more than 255. So SAP_WAPI_START_WORKFLOW can't be used. Try to use fm  SWW_WI_START_SIMPLE.

safeer_shah2
Participant
0 Kudos

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.

anjan_paul
Active Contributor
0 Kudos

Hi,

First no need pass 3 space, as mandt is not count.

Second got to ST22, find out what is the error.

I think please check the FM import export type, it is same or not.

safeer_shah2
Participant
0 Kudos

import , export type ? what do you mean ?

anjan_paul
Active Contributor
0 Kudos

Hi,

For the function module the import parameter type , output parameter type  is same as in your program.

anjan_paul
Active Contributor
0 Kudos

Did you find the solution?

anjan_paul
Active Contributor
0 Kudos

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 ' '.