Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9129

Re: Simple Transformation for Sharepoint WSDL GetListItems

$
0
0

Hi Roger,

 

personally, I hate those generator machines. I try to solve the problem along as narrowly as possible, with minimum overhead along the lines of what is given and what is requested.

 

So in this case, a hand-written simple transformation will do the trick. I started with three fields, extracted from the row XML element, as a beginning. Use the fine and concise ABAP ST documentation and extend your ABAP datatype to transform more data.

 

Like always, the transformation works both ways, although in this case you probably won't need the backward direction (generating an XML in the format of Sharepoint's lists from your ABAP list). Usually, in those cases, I prefer XSLT because it has more flexibility. But for simple cases like this one, simple transformations are fine.

 

 

<?sap.transform simple?><tt:transform xmlns:tt="http://www.sap.com/transformation-templates">   <tt:root name="ROWS"/>   <tt:template>     <n0:GetListItemsResponse xmlns:n0="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">       <n0:GetListItemsResult xmlns:z="#RowsetSchema" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882">         <n0:listitems>           <rs:data ItemCount="8">             <tt:loop name="row" ref=".ROWS">               <z:row>                 <tt:attribute name="ows_LinkTitle" value-ref="$row.link_title"/>                 <tt:attribute name="ows_Plant" value-ref="$row.plant"/>                 <tt:attribute name="ows_Created" value-ref="$row.created"/>               </z:row>             </tt:loop>           </rs:data>         </n0:listitems>       </n0:GetListItemsResult>     </n0:GetListItemsResponse>   </tt:template></tt:transform>

For the usage of the transformation in a running ABAP report, see my pastebin at [ABAP] Transforming a sharepoint list to ABAP - Pastebin.com

 

* You may use data types prefixed with XSD... for conversion to special formats
types: begin of ty_row,          link_title type string,          plant      type string,          created    type xsddatetime_iso,        end of ty_row,        ty_rows type standard table of ty_row with empty key.
start-of-selection.   perform start.
* ---
form start.   data: lv_doc  type xstring,         lt_rows type ty_rows.   perform get_sharepoint changing lv_doc.   call transformation zshare     source xml lv_doc     result rows = lt_rows.   cl_demo_output=>display( lt_rows ).
endform.

Cheers,

Rüdiger


Viewing all articles
Browse latest Browse all 9129

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>