SAP_WAPI_READ_CONTAINER - XML
Florin Wach
florin.wach at gmx.net
Mon May 10 03:18:01 EDT 2010
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.
More information about the SAP-WUG
mailing list