‎2007 Apr 17 3:16 PM
Hello all you XML gurus
I have written and ABAP as a client to connect to external web services which return an XML response and I now need to write and XSLT in order to transfer the data into my ABAP structure. Is there an easy way to write and XSLT transformation program using the XML as a base?
Take a look at the XML document returned from the webservice
<?xml version="1.0" encoding="utf-8"?>
<SchedRemote xmlns="http://scheduall.com/webservices/">
<Response>
<ClientDetails ERRCODE="0" ERRMSG="Ok">
<Field CL_ID="1127823" />
<Field PID="0" />
<Field NAME="Anthonys test client" />
<Field ADDRESS="" />
<Field CITY="" />
<Field STATE="" />
<Field ZIP="" />
<Field COUNTRY="" />
<Field PH1="0836078881" />
<Field PH2="" />
<Field FAX="0114674054" />
<Field NTS="" />
<Field SNTS="" />
<Field TAX1="" />
<Field TAX2="" />
<Field RATE_ID="0" />
<Field TAXCODE="0" />
<Field TERMS_ID="0" />
<Field STAT="0" />
<Field EXEC_ID="0" />
<Field SHORTNAME="" />
<Field CLIENTTYPE="0" />
<Field EXTID="" />
<Field T_SINCE="1/1/1970 12:00:00 AM" />
<Field BILLPARENT="0" />
<Field INHOUSE="0" />
<Field CRLIMIT="0" />
<Field POREQUIRED="0" />
<Field DISCOUNT="0" />
<Field LAST_MOD="4/16/2007 2:44:54 PM" />
<Field BADDRESS="" />
<Field BCITY="" />
<Field BSTATE="" />
<Field BZIP="" />
<Field BCOUNTRY="" />
<Field GMT_OFFSET="0" />
<Field EMAILADDR="" />
<Field LATECHARGE="0" />
<Field GROUP_1="0" />
<Field GROUP_2="0" />
<Field GROUP_3="0" />
<Field GROUP_4="0" />
<Field GROUP_5="0" />
<Field GROUP_6="0" />
<Field GROUP_7="0" />
<Field GROUP_8="0" />
<Field GROUP_9="0" />
<Field GROUP_10="0" />
<Field GROUP_11="0" />
<Field GROUP_12="0" />
<Field BILLATT="" />
<Field ALTEMAILAD="" />
<Field EXEC_ID2="0" />
<Field NOSENDSTMT="0" />
<Field SHIP_INST="" />
<Field PROD_ID="0" />
<Field CREATEDBY="ANDRE" />
<Field DATECREAT="4/16/2007 2:44:54 PM" />
<Field MOD_BY="ANDRE" />
<Field SHIP_VIA="" />
<Field SHIP_ACC="" />
<Field MB_NOBILL="0" />
<Field OT_EXEMPT="0" />
<Field USE_NIGHT="0" />
<Field CL_COLOR="0" />
<Field ASSOCFILE1="" />
<Field AUTOSELPRJ="0" />
<Field SALUTATION="" />
<Field CURR_ID="0" />
<Field LDR_PREFIX="" />
<Field TAX3="" />
<Field F_PRIMARY="0" />
<Field URL_SUPID="0" />
<Field TIMEZONE="0" />
<Field LOCSRCE_ID="0" />
<Field LOCDEST_ID="0" />
<Field DSTC_ID="0" />
<Field UTC_OFFSET="0" />
<Field AKA_FOR="0" />
<Field CRDLIMCHK="0" />
<Field TRAFF_STAT="0" />
<Field INS_EXPIR="1/1/1970 12:00:00 AM" />
<Field DEFSHADRID="0" />
<Field CXL_ID="0" />
<Field LIB_NOTES="" />
<Field USEMARKUP="0" />
<Field MARKUPPCT="0" />
<Field LNAME="" />
<Field FNAME="" />
<Field PLANTID="" />
<Field PRCHGRPID="" />
<Field B_NOBILL="0" />
<Field BARCODE1="" />
<Field BARCODE2="" />
<Field EXTID2="" />
<Field PENINVONLY="0" />
<Field CONTR_REQD="0" />
<Field NO_INVEXP="0" />
<CL_USER>
<Field CL_ID="1127823" />
<Field USER1="User field 1" />
<Field USER2="" />
<Field USER3="" />
<Field USER4="" />
<Field USER5="" />
<Field USER6="" />
<Field USER7="" />
<Field USER8="" />
<Field USER9="" />
<Field USER10="" />
<Field USER11="" />
<Field USER12="" />
<Field USER13="" />
<Field USER14="" />
<Field USER15="" />
<Field USER16="" />
<Field USER17="" />
<Field USER18="" />
<Field USER19="" />
<Field USER20="" />
<Field USER21="" />
<Field USER22="" />
<Field USER23="" />
<Field USER24="" />
<Field USER25="" />
<Field USER26="" />
<Field USER27="" />
<Field USERFLAG1="0" />
<Field USERFLAG2="0" />
<Field USERFLAG3="0" />
<Field USERFLAG4="0" />
<Field USERFLAG5="0" />
<Field USERFLAG6="0" />
<Field USERDATE1="1/1/1900 12:00:00 AM" />
<Field USERDATE2="1/1/1900 12:00:00 AM" />
</CL_USER>
</ClientDetails>
</Response>
</SchedRemote>
I have the following structure in my ABAP program which I would like a way of developing the XSLT in order to populate the results of each field into my program
data: begin of gs_clientdetails.
include structure zclient. " Contains all the CLIENT fields from Scheduall
include structure zcluser." Contains all the CL_USER fields from Scheduall
data: end of gs_clientdetails.
Any suggestions??
‎2007 Apr 18 2:05 AM
Hi,
I am not a XSLT expert but Tobias wrote some nice blogs about it. Read them here:
/people/tobias.trapp/blog
You might want to start with this one:
/people/tobias.trapp/blog/2005/05/04/xml-processing-in-abap-part-1
cheers
Thomas