cancel
Showing results for 
Search instead for 
Did you mean: 

Passing the values from BO event parameters to the wf container.

former_member226225
Contributor
0 Kudos

Dear Experts, I am new to workflow events concept . I developed a workflow which will create the purchase order based on my below program. I tested in SWUE transaction which is working fine data is passing to workflow but when I am running my workflow through a zprogram the values from the event parameter to the workflow container are not passing . I tried with swr_cont structure by passing the values to the internal table but I am getting syntax error so I changed the structure to swcont and passed through the macro and program is working fine but the values are not passing to the workflow container. Please find my below source code.

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member186746
Active Contributor
0 Kudos

Hi,

you should stick with SAP_WAPI_CREATE_EVENT.

Populating the event container is extemely easy.

TABLES
             input_container = lt_event_container


The event container is a table of type swr_cont and consists of 2 fields

element and value.


Check the name of the event parameter in the business object, that exact name, case sensitive is the element.

For Multiline element containers, simply repeat the element, for business object simply pass the key and everything should work fine.


SAP_WAPI_CREATE_EVENT has function module Documentation for more info.


Kind regards, Rob Dielemans

former_member226225
Contributor
0 Kudos

Hi Rob, I tried already by passing only single field with INPUT_CONTAINER TYPE SWR_CONT that is working fine, but my problem is with the structure type . POHEADER IS OF TYPE BAPIMEPOHEADER ( Which is a strcuture type ) I am assigning the values to the workarea but i can't able to pass the values to the swr_cont-value field .. I am getting error as "ARE NOT MUTUALLY CONVERTIBLE" Please find the attached screen shots.

former_member186746
Active Contributor
0 Kudos

Hi,

There are restrictions with event containers, so if you want to pass a value to your workflow that is larger than the maximum size, then either check if you don't really need all of the fields of the structure or find another way to get the information in the workflow by using maybe a table with a guid or something like that.

Kind regards, Rob Dielemans

former_member226225
Contributor
0 Kudos

Thanks Rob

anjan_paul
Active Contributor
0 Kudos

hi,

       Please the macro you used for container element 'POHEADER' . In workflow also you created with exactly same.   ie Upper case letter

former_member226225
Contributor
0 Kudos

Hi Experts. I changed the function module from 'SAP_WAPI_CREATE_EVENT' to 'SWE_EVENT_CREATE' and it is passing the parameters from event to the wf container Please find the below code. swc_create_container container. swc_set_element container 'USERNAME' sy-uname. swc_set_element container 'POHEADER' ls_poheader. swc_set_element container 'POHEADERX' ls_poheaderx. swc_set_element container 'POITEM' lt_poitem. swc_set_element container 'POITEMX' lt_poitemx. swc_set_element container 'POITEMX' lt_poitemx. swc_set_element container 'POSCHEDULE' lt_poschedule. swc_set_element container 'POSCHEDULEX' lt_poschedulex. CALL FUNCTION 'SWE_EVENT_CREATE'   EXPORTING     objtype                      = 'ZRK_BO'     objkey                        = '1222'     event                        = 'CREATE_PURCHASEORDER' *  CREATOR                      = ' ' *  TAKE_WORKITEM_REQUESTER      = ' ' *  START_WITH_DELAY              = ' ' *  START_RECFB_SYNCHRON          = ' ' *  NO_COMMIT_FOR_QUEUE          = ' ' *  DEBUG_FLAG                    = ' ' *  NO_LOGGING                    = ' ' *  IDENT                        = * IMPORTING *  EVENT_ID                      = *  RECEIVER_COUNT                = TABLES   event_container                = container EXCEPTIONS   objtype_not_found            = 1   OTHERS                        = 2. IF sy-subrc <> 0. * Implement suitable error handling here ENDIF. *CALL FUNCTION 'SAP_WAPI_CREATE_EVENT' *  EXPORTING *    object_type      = 'ZRK_BO' *    object_key        = '1221' *    event            = 'CREATE_PURCHASEORDER' *    commit_work      = 'X' *    event_language    = sy-langu *    language          = sy-langu *    user              = sy-uname **  IFS_XML_CONTAINER = *  IMPORTING *    return_code      = lv_return **  EVENT_ID          = *  TABLES *    input_container  = it_container. **  MESSAGE_LINES          = **  MESSAGE_STRUCT          = *** IF sy-subrc IS INITIAL AND lv_return IS INITIAL.   COMMIT WORK. ENDIF. But why it is not working for SAP_WAPI_CREATE_EVENT? Thanks in advance. Regards, Raghunadh Kodali.

former_member185167
Active Contributor
0 Kudos

Hello,

" I changed the function module from 'SAP_WAPI_CREATE_EVENT' to 'SWE_EVENT_CREATE'"

No, no no. You're going the wrong way. Always use SAP_WAPI* when you can.

regards

Rick

former_member226225
Contributor
0 Kudos

Hi Rick, Yes what you told is correct , but i am unable to pass the values and i am getting the below error. "WA_CONTAINER-VALUE" and "LS_POHEADER" are not mutually convertible in a Unicode program. program. I used same parameter names "POHEADER" in both program and event parameter. Please find the attachments.