SAP_WAPI_READ_CONTAINER - XML

Florin Wach florin.wach at gmx.net
Tue May 11 08:23:34 EDT 2010


Hi there,

that were just self-existing examples.

Please have a look at the definition of CL_SWF_CNT_CONTAINER->create_from_XML

There's also an import element XML_STREAM (type XString). Use that import element instead of the one in the given example :-)

bw,
Florin

-------- Original-Nachricht --------
> Datum: Tue, 11 May 2010 08:35:37 +1000
> Von: Nigel Thurgood <Nigel.Thurgood at sanitarium.com.au>
> An: "SAP Workflow Users\' Group" <sap-wug at mit.edu>
> Betreff: RE: SAP_WAPI_READ_CONTAINER - XML

> Thanks for your response, Florin.
> 
> DATA: v_return LIKE sy-subrc,
>       v_data TYPE xstring,
>       v_schema TYPE xstring.
> 
> parameters: p_wiid TYPE swr_struct-workitemid.
> 
> CALL FUNCTION 'SAP_WAPI_READ_CONTAINER'
>   EXPORTING
>     workitem_id              = p_wiid
>   IMPORTING
>     return_code              = v_return
>     ifs_xml_container        = v_data
>     ifs_xml_container_schema = v_schema.
> 
> V_data is of type xstring, and the xml_table in the 'create_from_xml'
> method call is a standard table.
> 
> What should follow the function call 'SAP_WAPI_READ_CONTAINER'?
> 
> Sorry if I'm misreading you.
> 
> Cheers.
> 
> Nigel.
> 
> -----Original Message-----
> From: Florin Wach [mailto:florin.wach at gmx.net] 
> Sent: Monday, 10 May 2010 5:18 PM
> To: SAP Workflow Users' Group
> Subject: Re: SAP_WAPI_READ_CONTAINER - XML
> 
> Hi,
> 
> if you use the XML container, you can access the field Z_STRUCTURE
> directly and move it into the full structure without worrying about the internal
> storage (which is how you've described below - valid for those workflow
> definitions created prior to ECC 6.00 / otherwise stored in database as a
> persistent XML stream - valid for definitions created from ECC 6.00 on).
> 
> To create a container from XML stream use (the variable here is
> "event_container", in the case of the BAPI..READ.. the IFS_XML_CONTAINER should be
> it. You'll need to calculate string-length and use that as XML_Size.
> 
> ...
> code snippet
> 
>    DATA: lo_container         TYPE REF TO if_swf_cnt_container.
>    TRY.
>       lo_container = cl_swf_cnt_container=>create_from_XML( XML_Table =
> event_container
>                                                          XML_Rendered_Size
> = XML_Size ).
>       CATCH CX_ROOT.
>          "On any problems, we leave the simple container blank
>    ENDTRY.
> 
> 
> ...
> and another code snipped to read a (structured) element:
> 
>    DATA: ls_initiator       TYPE SWHACTOR.
>    TRY.
>       CALL METHOD lo_container->if_swf_ifs_parameter_container~get
>                      EXPORTING
>                         name    = 'ACTUALAGENT'
>                      IMPORTING
>                         value   = ls_initiator.
>       CATCH CX_SWF_CNT_ELEM_NOT_FOUND.
>          "Can be ignored, as the event just doesn't has this as a
> parameter
>       CATCH CX_SWF_CNT_CONTAINER.
>          "Other exceptions are ignored, as well
>    ENDTRY.
> 
> 
> 
> Best wishes,
> Florin
> 
> -------- Original-Nachricht --------
> > Datum: Mon, 10 May 2010 10:55:55 +1000
> > Von: Nigel Thurgood <Nigel.Thurgood at sanitarium.com.au>
> > An: "sap-wug at mit.edu" <sap-wug at mit.edu>
> > Betreff: SAP_WAPI_READ_CONTAINER - XML
> 
> > Hi,
> > 
> > Recently upgraded from 4.7 to ECC 6.
> > 
> > In 4.7, the above function would return the first 256 characters of a
> > structure as a single string, e.g.:
> > 
> > Field                                      Value
> > Z_STRUCTURE                   Value_1               Value_2             
> > Value_3               $etc.
> > 
> > In ECC 6, the structure is now broken down as follows:
> > 
> > Field                                      Value
> > Z_STRUCTURE                   Value_1
> > Z_STRUCTURE                   Value_2
> > Z_STRUCTURE                   Value_3
> > Z_STRUCTURE                   &etc.
> > 
> > The latter would be better as the whole structure is available, not just
> > the first 255 characters - however the structure field names (e.g.
> > Z_STRUCTURE-MATNR) are not shown, only the structure name.
> > 
> > I would think that the XML container parameter of
> SAP_WAPI_READ_CONTAINER
> > would give me what I'm looking for?
> > 
> > Can anyone point me towards an example of converting
> > SAP_WAPI_READ_CONTAINER's IFS_XML_CONTAINER and IFS_XML_CONTAINER_SCHEMA
> into something like
> > value pairs?
> > 
> > Cheers.
> > 
> > Nigel E Thurgood
> > 
> > 
> > 
> > ------------------------------------------------------
> > This is an email from Australian Health & Nutrition Association Limited,
> > ABN 63 096 452 872 trading as Sanitarium Health Food Company.
> > 
> > THIS E-MAIL IS CONFIDENTIAL..
> > Any recipient who is not the intended recipient is requested to
> > notify the sender by return e-mail and erase all copies of the message
> > and attachments. The sender cannot guarantee that this email or any
> > attachment to it is free of computer viruses or other conditions which
> may
> > damage or interfere with data, hardware or software with which it might
> be
> > used.
> > 
> > If you do not wish to receive commercial email messages from Sanitarium
> > Health Food Company, please send an unsubscribe message to the sender of
> this
> > email, or contact unsubscribe at sanitarium.com.au.
> 
> 
> _______________________________________________
> 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