Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Simple Transformation from Adobe Form XML document to Dictionary structures

Former Member
0 Likes
768

I have an XML document that I am receiving via email (the XML document is generated from an Adobe Interactive form). I would like to write a simple transformation that will map that XML document to a structure and internal table in my ABAP program. I am new to Simple Transformations and I am having trouble working out how to write a simple transformation for this type of XML document. I would prefer to write a custom transformation rather than using the identity transformation (ID). I would appreciate any help you can provide.

Please refer to the below for an example of the XML file.

This maps directly to 2 dictionary structures that exist within our system containing all of the same components. PIM_REQUEST_HDR has a corresponding SAP dictionary structure Y_REQUEST_HDR and PIM_REQUEST_ITEMS has a corresponding SAP dictionary structure Y_REQUEST_ITEMS.

Can anyone help with some instructions or examples of how to create the simple transformation?

Thanks for your help! We are using ECC 6.0

Sample XML to be transformed:

<?xml version="1.0" encoding="UTF-8" ?> 
 <data>
 <SFPSY>
  <DATE>2007-07-03</DATE> 
  <TIME>07:25:21</TIME> 
  <USERNAME>TLCITY</USERNAME> 
  <SUBRC>0</SUBRC> 
  </SFPSY>
 <PIM_REQUEST_HDR>
  <MANDT /> 
  <REQ_NUM /> 
  <REQ_DESC>blah blah blah</REQ_DESC> 
  <PROC_AREA>CTC</PROC_AREA> 
  <REQUESTED>2007-07-03</REQUESTED> 
  <REQUIRED>2007-07-03</REQUIRED> 
  <REQUESTOR>TLCITY</REQUESTOR> 
  <MOD_TYPE>SAP Note manual changes</MOD_TYPE> 
  <SAPNOTE_NUM>59549656</SAPNOTE_NUM> 
  <SAPMSG_NUM>0000000000</SAPMSG_NUM> 
  <TECH_SCRIPT /> 
  <REASON /> 
  <DEV_ENV>ECC6</DEV_ENV> 
  <INSTALL_NO>2861655161</INSTALL_NO> 
  <BASIS_REL>700</BASIS_REL> 
  <REG_STATUS /> 
  <REJ_REASON /> 
  <APP_DATE /> 
  <REJ_DATE /> 
  <APPROVER /> 
  <REGISTRATOR /> 
  <REG_DATE /> 
  </PIM_REQUEST_HDR>
 <PIM_REQUEST_ITEMS>
 <DATA>
  <MANDT /> 
  <REQ_NUM /> 
  <PGMID>R3TR</PGMID> 
  <OBJECT>PROG</OBJECT> 
  <OBJ_NAME>RSDIJOIJSDOIF</OBJ_NAME> 
  <ACCESSKEY /> 
  </DATA>
 <DATA>
  <MANDT /> 
  <REQ_NUM /> 
  <PGMID>R3TR</PGMID> 
  <OBJECT>PROG</OBJECT> 
  <OBJ_NAME>RRRSDIJOIJS03</OBJ_NAME> 
  <ACCESSKEY /> 
  </DATA>
  </PIM_REQUEST_ITEMS>
  </data>

I have an XML document that I am receiving via email (the XML document is generated from an Adobe Interactive form). I would like to write a simple transformation that will map that XML document to a structure and internal table in my ABAP program. I am new to Simple Transformations and I am having trouble working out how to write a simple transformation for this type of XML document. I would prefer to write a custom transformation rather than using the identity transformation (ID). I would appreciate any help you can provide.

Please refer to the below for an example of the XML file.

This maps directly to 2 dictionary structures that exist within our system containing all of the same components. PIM_REQUEST_HDR has a corresponding SAP dictionary structure Y_REQUEST_HDR and PIM_REQUEST_ITEMS has a corresponding SAP dictionary structure Y_REQUEST_ITEMS.

Can anyone help with some instructions or examples of how to create the simple transformation?

Thanks for your help! We are using ECC 6.0

Sample XML to be transformed:

<?xml version="1.0" encoding="UTF-8" ?> 
 <data>
 <SFPSY>
  <DATE>2007-07-03</DATE> 
  <TIME>07:25:21</TIME> 
  <USERNAME>TLCITY</USERNAME> 
  <SUBRC>0</SUBRC> 
  </SFPSY>
 <PIM_REQUEST_HDR>
  <MANDT /> 
  <REQ_NUM /> 
  <REQ_DESC>blah blah blah</REQ_DESC> 
  <PROC_AREA>CTC</PROC_AREA> 
  <REQUESTED>2007-07-03</REQUESTED> 
  <REQUIRED>2007-07-03</REQUIRED> 
  <REQUESTOR>TLCITY</REQUESTOR> 
  <MOD_TYPE>SAP Note manual changes</MOD_TYPE> 
  <SAPNOTE_NUM>59549656</SAPNOTE_NUM> 
  <SAPMSG_NUM>0000000000</SAPMSG_NUM> 
  <TECH_SCRIPT /> 
  <REASON /> 
  <DEV_ENV>ECC6</DEV_ENV> 
  <INSTALL_NO>2861655161</INSTALL_NO> 
  <BASIS_REL>700</BASIS_REL> 
  <REG_STATUS /> 
  <REJ_REASON /> 
  <APP_DATE /> 
  <REJ_DATE /> 
  <APPROVER /> 
  <REGISTRATOR /> 
  <REG_DATE /> 
  </PIM_REQUEST_HDR>
 <PIM_REQUEST_ITEMS>
 <DATA>
  <MANDT /> 
  <REQ_NUM /> 
  <PGMID>R3TR</PGMID> 
  <OBJECT>PROG</OBJECT> 
  <OBJ_NAME>RSDIJOIJSDOIF</OBJ_NAME> 
  <ACCESSKEY /> 
  </DATA>
 <DATA>
  <MANDT /> 
  <REQ_NUM /> 
  <PGMID>R3TR</PGMID> 
  <OBJECT>PROG</OBJECT> 
  <OBJ_NAME>RRRSDIJOIJS03</OBJ_NAME> 
  <ACCESSKEY /> 
  </DATA>
  </PIM_REQUEST_ITEMS>
  </data>

1 REPLY 1
Read only

Former Member
0 Likes
497

I have solved this one with the help of another collegue.

To simplify, we changed the XML to be as follows:

[code]

<?xml version="1.0" encoding="UTF-8" ?>

<data>

<PIM_REQUEST>

<REQ_HDR>

<MANDT />

<REQ_NUM />

<REQ_DESC>Key required for pricing routines</REQ_DESC>

<PROC_AREA>SD</PROC_AREA>

<REQUESTED>2007-07-30</REQUESTED>

<REQUIRED>2007-08-02</REQUIRED>

<REQUESTOR>TLCITY</REQUESTOR>

<MOD_TYPE>SAP Note: Manual Changes</MOD_TYPE>

<SAPNOTE_NUM>0000000000</SAPNOTE_NUM>

<SAPMSG_NUM>0000000000</SAPMSG_NUM>

<TECH_SCRIPT>TS-2498 Pricing Routines</TECH_SCRIPT>

<REASON>New pricing routines required</REASON>

<DEV_ENV>ECC6</DEV_ENV>

<INSTALL_NO>029</INSTALL_NO>

<BASIS_REL>700</BASIS_REL>

<REG_STATUS />

<REJ_REASON />

<APP_DATE />

<REJ_DATE />

<APPROVER />

<REGISTRATOR />

<REG_DATE />

</REQ_HDR>

<KEY_DETAILS>

<DATA>

<MANDT />

<REQ_NUM />

<PGMID>R3TR</PGMID>

<OBJECT>PROG</OBJECT>

<OBJ_NAME>RVGHT902</OBJ_NAME>

<ACCESSKEY />

</DATA>

<DATA>

<MANDT />

<REQ_NUM />

<PGMID>R3TR</PGMID>

<OBJECT>PROG</OBJECT>

<OBJ_NAME>RVGHT901</OBJ_NAME>

<ACCESSKEY />

</DATA>

</KEY_DETAILS>

</PIM_REQUEST>

</data>

[/code]

This maps directly to 1 dictionary structure that exists within our system containing all of the same components. PIM_REQUEST has a corresponding SAP dictionary structure Y_REQUEST_HDR which is a deep structure and has within it a structure REQ_HDR and a table KEY_DETAILS.

The corresponding simple transformation we have then used is as follws:

[code]

<?sap.transform simple?>

<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">

<tt:root name="root"/>

<tt:template>

<data>

<PIM_REQUEST>

<tt:copy ref="root"/>

</PIM_REQUEST>

</data>

</tt:template>

</tt:transform>

[/code]

Alternatively the following 2 options also work:

Option 2:

[code]

<?sap.transform simple?>

<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">

<tt:root name="root"/>

<tt:template>

<data>

<PIM_REQUEST>

<REQ_HDR>

<tt:copy ref="root.REQ_HDR"/>

</REQ_HDR>

<KEY_DETAILS>

<tt:loop name="KEY_DETAILS" ref="root.KEY_DETAILS">

<DATA>

<tt:copy ref="$KEY_DETAILS"/>

</DATA>

</tt:loop>

</KEY_DETAILS>

</PIM_REQUEST>

</data>

</tt:template>

</tt:transform>

[/code]

Option 3:

[code]

<?sap.transform simple?>

<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">

<tt:root name="root"/>

<tt:template>

<data>

<PIM_REQUEST>

<REQ_HDR>

<MANDT tt:value-ref="root.REQ_HDR.MANDT"/>

<REQ_NUM tt:value-ref="root.REQ_HDR.REQ_NUM"/>

<REQ_DESC tt:value-ref="root.REQ_HDR.REQ_DESC"/>

<PROC_AREA tt:value-ref="root.REQ_HDR.PROC_AREA"/>

<REQUESTED tt:value-ref="root.REQ_HDR.REQUESTED"/>

<REQUIRED tt:value-ref="root.REQ_HDR.REQUIRED"/>

<REQUESTOR tt:value-ref="root.REQ_HDR.REQUESTOR"/>

<MOD_TYPE tt:value-ref="root.REQ_HDR.MOD_TYPE"/>

<SAPNOTE_NUM tt:value-ref="root.REQ_HDR.SAPNOTE_NUM"/>

<SAPMSG_NUM tt:value-ref="root.REQ_HDR.SAPMSG_NUM"/>

<TECH_SCRIPT tt:value-ref="root.REQ_HDR.TECH_SCRIPT"/>

<REASON tt:value-ref="root.REQ_HDR.REASON"/>

<DEV_ENV tt:value-ref="root.REQ_HDR.DEV_ENV"/>

<INSTALL_NO tt:value-ref="root.REQ_HDR.INSTALL_NO"/>

<BASIS_REL tt:value-ref="root.REQ_HDR.BASIS_REL"/>

<REG_STATUS tt:value-ref="root.REQ_HDR.REG_STATUS"/>

<REJ_REASON tt:value-ref="root.REQ_HDR.REJ_REASON"/>

<APP_DATE tt:value-ref="root.REQ_HDR.APP_DATE"/>

<REJ_DATE tt:value-ref="root.REQ_HDR.REJ_DATE"/>

<APPROVER tt:value-ref="root.REQ_HDR.APPROVER"/>

<REGISTRATOR tt:value-ref="root.REQ_HDR.REGISTRATOR"/>

<REG_DATE tt:value-ref="root.REQ_HDR.REG_DATE"/>

</REQ_HDR>

<KEY_DETAILS>

<tt:loop ref="root.KEY_DETAILS" name="KEY_DETAILS">

<DATA>

<MANDT tt:value-ref="$KEY_DETAILS.MANDT"/>

<REQ_NUM tt:value-ref="$KEY_DETAILS.REQ_NUM"/>

<PGMID tt:value-ref="$KEY_DETAILS.PGMID"/>

<OBJECT tt:value-ref="$KEY_DETAILS.OBJECT"/>

<OBJ_NAME tt:value-ref="$KEY_DETAILS.OBJ_NAME"/>

<ACCESSKEY tt:value-ref="$KEY_DETAILS.ACCESSKEY"/>

</DATA>

</tt:loop>

</KEY_DETAILS>

</PIM_REQUEST>

</data>

</tt:template>

</tt:transform>

[/code]