SAP_WAPI_START_WORKFLOW vs. SWW_WI_START

Sample, Rick Rick.Sample at gbe.com
Wed Apr 16 16:23:43 EDT 2008


Got it. FINNALY!!!! (Good Grief!) LOL

Two things I was doing wrong, but not apparent. 

1. 
When passing the Container in the SAP_WAPI* call, we apparently 
MUST have the container element in the task or template. 
Not sure why, not mandatory or anything. But will NOT start the task if
it is missing.

2. 
I can NOT assign the TABLE element a data type in the task. 
I had to use MultiLine and no value. Then all was cool. A method
imported the 
table into the correct data type and got all my records. 

Neither one of these chucked a meaningful error, and was not obvious. 

Also, this is sure a lot more work than doing a simple SWC_SET_TABLE. 
What was SAP's reason for changing this anyway?

Thanks Mike!

Rick

Example Code:
FUNCTION y_test_start_dla_msg_new.

  INCLUDE: <cntn01>.

  DATA:
   container       TYPE STANDARD TABLE OF swr_cont,
   container_line  TYPE swr_cont,
   return_code     TYPE sy-subrc,
   workitem_id     TYPE swr_struct-workitemid,
   message_lines   TYPE swr_messag,
   message_struct  TYPE swr_mstruc,

   salesdocument   TYPE bapivbeln-vbeln.

  DATA:
* REPLACE WITH IT_BAD_ITEM table.
** Pushpinder, I will explain when we insert in your code...
   order_header_in TYPE bapisdh1 OCCURS 0 WITH HEADER LINE.

*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

* Sales Document#
  salesdocument = '0300029356'.
  container_line-element = 'salesdocument'.
  container_line-value   = salesdocument.
  APPEND container_line TO container.

* Record one
  order_header_in-collect_no = '0000000001'.
  order_header_in-sales_org  = 'ABCD'.
  APPEND order_header_in.

  container_line-element = 'order_header_in'.
  container_line-value   = order_header_in.
  APPEND container_line TO container.

* Record two
  order_header_in-collect_no = '0000000002'.
  order_header_in-sales_org  = 'EFGH'.
  APPEND order_header_in.

*  container_line-element = 'order_header_in'.
** NOTE:
*** Pushpinder, DO NOT ADD THE ABOVE LINE MORE THAN ONCE FOR A TABLE!
  container_line-value   = order_header_in.
  APPEND container_line TO container.

  CALL FUNCTION 'SAP_WAPI_START_WORKFLOW'
       EXPORTING
            task            = 'TS90000212'
       IMPORTING
            return_code     = return_code
            workitem_id     = workitem_id
       TABLES
            input_container = container.

ENDFUNCTION.





-----Original Message-----
From: sap-wug-bounces at mit.edu [mailto:sap-wug-bounces at mit.edu] On Behalf
Of Mike Pokraka
Sent: Wednesday, April 16, 2008 1:03 PM
To: SAP Workflow Users' Group
Subject: RE: SAP_WAPI_START_WORKFLOW vs. SWW_WI_START

Nope, it should definitely work. Test the SAP_WAPI in SE37 (with a
simple
test wf if necessary) and work back from there.



On Wed, April 16, 2008 6:00 pm, Sample, Rick wrote:
> That's what I thought. So, bottom line, can't user the WAPI_SAP_* to
> pass in TABLES?
>
> Back to using SWW_WI_START I suppose...
>
> -----Original Message-----
> From: sap-wug-bounces at mit.edu [mailto:sap-wug-bounces at mit.edu] On
Behalf
> Of Mike Pokraka
> Sent: Wednesday, April 16, 2008 10:23 AM
> To: SAP Workflow Users' Group
> Subject: RE: SAP_WAPI_START_WORKFLOW vs. SWW_WI_START
>
> Nope, the WAPI containers are simple containers. A different animal
> altogether, simple containers are just a name-value pair.
>
> data: lt_cont type standard table of swr_cont,
>       lv_cont type swr_cont.
>
> lv_cont-element = 'SINGEELEMENT'.
> lv_cont-value = 'somevalue'.
> append lv_cont to lt_cont.
>
> lv_cont-element = 'MULTIELEMENT'.
> lv_cont-value = 'value1'.
> append lv_cont to lt_cont.
>
> lv_cont-value = 'value2'.
> append lv_cont to lt_cont.
>
> On Wed, April 16, 2008 3:07 pm, Sample, Rick wrote:
>> Mike, I tried several different approaches to what I 'think' you are
>> saying, but WF still does not start.
>> Below is a Y test snip. Can you point out what you mean?
>>
>> FUNCTION y_test_start_dla_msg.
>>   INCLUDE: <cntn01>.
>>
>>   DATA:
>>    container        TYPE swcont OCCURS 0 WITH HEADER LINE,
>>    return_code     TYPE sy-subrc,
>>    workitem_id     TYPE swr_struct-workitemid,
>>    bapi_return      TYPE bapiret2 OCCURS 0 WITH HEADER LINE.
>>
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>
>>   bapi_return-type    = 'W'.
>>   bapi_return-message = '1'.
>>   APPEND bapi_return.
>>
>>   bapi_return-type    = 'S'.
>>   bapi_return-message = '2'.
>>   APPEND bapi_return.
>>
>>   swc_set_table container 'BAPI_Return' bapi_return.
>>
>>   CALL FUNCTION 'SAP_WAPI_START_WORKFLOW'
>>        EXPORTING
>>             task            = 'TS90000212'
>>        IMPORTING
>>             return_code     = return_code
>>             workitem_id     = workitem_id
>>        TABLES
>>             input_container = container.
>>
>> ENDFUNCTION.
>>
>> -----Original Message-----
>> From: sap-wug-bounces at mit.edu [mailto:sap-wug-bounces at mit.edu] On
> Behalf
>> Of Mike Pokraka
>> Sent: Wednesday, April 16, 2008 2:40 AM
>> To: SAP Workflow Users' Group
>> Subject: Re: SAP_WAPI_START_WORKFLOW vs. SWW_WI_START
>>
>> Hi Rick,
>> Just repeat the same container element name with different values for
>> the
>> SAP_WAPI container.
>> Cheers,
>> Mike
>>
>> On Tue, April 15, 2008 10:47 pm, Sample, Rick wrote:
>>> I forgot that the interface changed for SAP_WAPI_START_WORKFLOW. We
>> can
>>> no longer pass in 'tables' to this FM?
>>>
>>> What I need is, to start a WF and pass in TABLES.
>>>
>>> What are the risks of using SWW_WI_START? Or, how do I pass in
tables
>> to
>>> the
>>> new WAPIs?
>>>
>>> Rick Sample
>>> SAP Business Workflow Developer
>>> Graybar, Inc.
>>>
>>> _______________________________________________
>>> SAP-WUG mailing list
>>> SAP-WUG at mit.edu
>>> http://mailman.mit.edu/mailman/listinfo/sap-wug
>>>
>>
>>
>> _______________________________________________
>> SAP-WUG mailing list
>> SAP-WUG at mit.edu
>> http://mailman.mit.edu/mailman/listinfo/sap-wug
>>
>> _______________________________________________
>> SAP-WUG mailing list
>> SAP-WUG at mit.edu
>> http://mailman.mit.edu/mailman/listinfo/sap-wug
>>
>
>
> _______________________________________________
> SAP-WUG mailing list
> SAP-WUG at mit.edu
> http://mailman.mit.edu/mailman/listinfo/sap-wug
>
> _______________________________________________
> SAP-WUG mailing list
> SAP-WUG at mit.edu
> http://mailman.mit.edu/mailman/listinfo/sap-wug
>


_______________________________________________
SAP-WUG mailing list
SAP-WUG at mit.edu
http://mailman.mit.edu/mailman/listinfo/sap-wug




More information about the SAP-WUG mailing list