Skip to Content
0
May 20, 2015 at 01:21 PM

Ref-Node Error when running Simple Transformation

1130 Views

Hi there,

i have a problem with using a simple transformation i can't figure out:

Running the code gives me the following error message:

"Fehler bei Zugriff auf Ref-Node 'ORGANIZATION_RATING.ORGANIZATION_RATING_ATTRIBUTE'. Der Ref-Node ist nicht definiert oder hat nicht den erforderlichen Typ."

This is my Simple-Transformation:

<?sap.transform simple?>

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

<tt:root name="Organization_Roots"/>
<tt:root name="Organization_Root"/>

<tt:template>
<Organization_Roots>
<tt:loop name="Organization_Root" ref="Organization_Root">
<Organization_Root>
<Organization_ID>
<tt:value ref="$Organization_Root.Organization_id"/>
</Organization_ID>
<Organization_Ratings>
<Organization_Rating>
<Organization_ID>
<tt:value ref="$Organization_Root.organization_rating.Organization_id"/>
</Organization_ID>
<Rating_Class_Number>
<tt:value ref="$Organization_Root.organization_rating.Rating_Class_Number"/>
</Rating_Class_Number>
<Organization_Rating_Attributes>
<tt:loop name="z" ref="$Organization_Root.organization_rating.Organization_Rating_Attribute">
<Organization_Rating_Attribute>
<Organization_ID>
<tt:value ref="$z.Organization_ID"/>
</Organization_ID>
<Rating_Attribute_Type_Code>
<tt:value ref="$z.Rating_Attribute_Type_Code"/>
</Rating_Attribute_Type_Code>
</Organization_Rating_Attribute>
</tt:loop>
</Organization_Rating_Attributes>
</Organization_Rating>
</Organization_Ratings>
</Organization_Root>
</tt:loop>
</Organization_Roots>
</tt:template>

</tt:transform>

My Abap (stripped down to the relevant part):

   TYPES: BEGIN OF organization_rating_attributes,
organization_id TYPE i,
rating_attribute_type_code TYPE string,
END OF organization_rating_attributes,
tt_organization_rating_attr TYPE TABLE OF organization_rating_attributes.

DATA: BEGIN OF ty_test,
organization_id TYPE i,
BEGIN OF organization_rating,
organization_id TYPE i,
rating_class_number TYPE string,

organization_rating_attributes TYPE tt_organization_rating_attr,
END OF organization_rating,
END OF ty_test.


DATA: xml_string TYPE string,
lt_result LIKE TABLE OF ty_test.



CALL TRANSFORMATION z_traf_cfg_orga
SOURCE XML xml_string
RESULT organization_root = lt_result.

And finally the XML-File i'd like to process:

It consists of several <Organization_Root> and several Organization_Rating_Attribute - and the later one is where the problem occurs.

<?xml version="1.0" encoding="utf-8"?>
<Organization_Roots>
 <Organization_Root action="NoAction">
  <Organization_ID indicator="_">148050</Organization_ID>
  <Organization_Ratings>
   <Organization_Rating action="NoAction">
    <Organization_ID indicator="_">148050</Organization_ID>
    <Rating_Class_Number indicator="_">-2</Rating_Class_Number>
    <Organization_Rating_Attributes>
     <Organization_Rating_Attribute action="NoAction">
      <Organization_ID indicator="_">148050</Organization_ID>
      <Rating_Attribute_Type_Code indicator="_">5156627</Rating_Attribute_Type_Code>
     </Organization_Rating_Attribute>
     <Organization_Rating_Attribute action="NoAction">
      <Organization_ID indicator="_">148050</Organization_ID>
      <Rating_Attribute_Type_Code indicator="_">5156627</Rating_Attribute_Type_Code>
     </Organization_Rating_Attribute>     
    </Organization_Rating_Attributes>
   </Organization_Rating>
  </Organization_Ratings>
 </Organization_Root>
</Organization_Roots>

Actually ma problem can be proken down to: How to adress nested table correctly?

Any hint is greatly appreceated.

Thanks in advance,

Daniel